Ignore:
Timestamp:
Jan 31, 2014, 5:05:21 PM (10 years ago)
Author:
cfuguet
Message:
  • Modifying HBA driver to respect new IOC driver interface.
  • Modifying XML parser and XML driver to manage the HBA controller as an IOC subtype.
Location:
branch/giet_vm_ioc_drivers
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branch/giet_vm_ioc_drivers/Makefile

    r283 r286  
    1414
    1515### Objects to be linked for kernel.elf
    16 KERNEL_OBJS  = build/common/utils.o        \
    17                build/common/vmem.o          \
     16KERNEL_OBJS  = build/common/utils.o       \
     17               build/common/vmem.o        \
    1818               build/fat32/fat32.o        \
    1919               build/drivers/dma_driver.o \
     
    2323               build/drivers/ioc_driver.o \
    2424               build/drivers/bdv_driver.o \
     25               build/drivers/hba_driver.o \
    2526               build/drivers/sdc_driver.o \
    2627               build/drivers/spi_driver.o \
     
    4041
    4142### Objects to be linked for boot.elf
    42 BOOT_OBJS    = build/common/utils.o        \
    43                build/common/vmem.o          \
     43BOOT_OBJS    = build/common/utils.o       \
     44               build/common/vmem.o        \
    4445               build/fat32/fat32.o        \
    4546               build/drivers/tty_driver.o \
     
    4950               build/drivers/ioc_driver.o \
    5051               build/drivers/bdv_driver.o \
     52               build/drivers/hba_driver.o \
    5153               build/drivers/sdc_driver.o \
    5254               build/drivers/spi_driver.o \
     
    196198        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
    197199
     200build/drivers/hba_driver.o: giet_drivers/hba_driver.c  \
     201                            giet_drivers/hba_driver.h  \
     202                            giet_config.h              \
     203                            $(MAP_XML)
     204        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
     205
    198206build/drivers/sdc_driver.o: giet_drivers/sdc_driver.c  \
    199207                            giet_drivers/sdc_driver.h  \
  • branch/giet_vm_ioc_drivers/giet_drivers/hba_driver.c

    r283 r286  
    7777#include <ctx_handler.h>
    7878#include <mmc_driver.h>
     79#include <hba_driver.h>
    7980#include <vmem.h>
    8081
     
    128129    if( channel >= NB_HBA_CHANNELS )
    129130    {
    130         _get_lock(&_tty_put_lock);
     131        _tty_get_lock( 0 );
    131132        _puts("\n[GIET ERROR] in _hba_get_status() : illegal channel\n");
    132         _release_lock(&_tty_put_lock);
     133        _tty_release_lock( 0 );
    133134        return 1;
    134135    }
     
    150151    if( channel >= NB_HBA_CHANNELS )
    151152    {   
    152         _get_lock(&_tty_put_lock);
     153        _tty_get_lock( 0 );
    153154        _puts("\n[GIET ERROR] in _hba_reset_status() : illegal channel\n");
    154         _release_lock(&_tty_put_lock);
     155        _tty_release_lock( 0 );
    155156        return 1;
    156157    }
     
    191192    hba_cmd_table_t*   cmd_table;      // command table pointer
    192193
    193     // TODO The block size must be obtained from the hardware...
    194     block_size = 512;
     194    block_size = _hba_get_block_size();
    195195
    196196    // check buffer alignment
    197197    if( buf_vaddr & (block_size-1) )
    198198    {
    199         _get_lock(&_tty_put_lock);
     199        _tty_get_lock( 0 );
    200200        _puts("\n[GIET ERROR] in _hba_set_cmd() : user buffer not block aligned\n");
    201         _release_lock(&_tty_put_lock);
     201        _tty_release_lock( 0 );
    202202        return 1;
    203203    }
     
    207207    if ( channel_id == 0xFFFFFFFF )
    208208    {
    209         _get_lock(&_tty_put_lock);
     209        _tty_get_lock( 0 );
    210210        _puts("\n[GIET ERROR] in _hba_set_cmd() : no HBA channel allocated\n");
    211         _release_lock(&_tty_put_lock);
     211        _tty_release_lock( 0 );
    212212        return 1;
    213213    }
     
    223223    if( pxci & (1<<cmd_id ) )
    224224    {
    225         _get_lock(&_tty_put_lock);
     225        _tty_get_lock( 0 );
    226226        _puts("\n[GIET ERROR] in _hba_set_cmd() : command list full in channel \n");
    227227        _putd( channel_id );
    228228        _puts("\n");
    229         _release_lock(&_tty_put_lock);
     229        _tty_release_lock( 0 );
    230230        return 1;
    231231    }
     
    262262        if ( ko )
    263263        {
    264             _get_lock(&_tty_put_lock);
     264            _tty_get_lock( 0 );
    265265            _puts("[GIET ERROR] in _hba_set_cmd() : user buffer unmapped\n");
    266             _release_lock(&_tty_put_lock);
     266            _tty_release_lock( 0 );
    267267            return 1;
    268268        }
    269269        if ((flags & PTE_U) == 0)
    270270        {
    271             _get_lock(&_tty_put_lock);
     271            _tty_get_lock( 0 );
    272272            _puts("[GIET ERROR] in _hba_set_cmd() : user buffer not in user space\n");
    273             _release_lock(&_tty_put_lock);
     273            _tty_release_lock( 0 );
    274274            return 1;
    275275        }
    276276        if (((flags & PTE_W) == 0 ) && (is_read == 0) )
    277277        {
    278             _get_lock(&_tty_put_lock);
     278            _tty_get_lock( 0 );
    279279            _puts("[GIET ERROR] in _hba_set_cmd() : user buffer not writable\n");
    280             _release_lock(&_tty_put_lock);
     280            _tty_release_lock( 0 );
    281281            return 1;
    282282        }
     
    285285        if( buf_id > 245 )
    286286        {
    287             _get_lock(&_tty_put_lock);
     287            _tty_get_lock( 0 );
    288288            _puts("[GIET ERROR] in _hba_set_cmd() : max number of buffers is 248\n");
    289             _release_lock(&_tty_put_lock);
     289            _tty_release_lock( 0 );
    290290            return 1;
    291291        }
     
    415415// Returns 0 if success, > 0 if error.
    416416///////////////////////////////////////////////////////////////////
    417 unsigned int _hba_write( unsigned int  lba,
     417unsigned int _hba_write( unsigned int  mode,
     418                         unsigned int  lba,
    418419                         void*         buffer,
    419420                         unsigned int  count )
     
    427428// Returns 0 if success, > 0 if error.
    428429///////////////////////////////////////////////////////////////////
    429 unsigned int _hba_read( unsigned int  lba,
     430unsigned int _hba_read( unsigned int  mode,
     431                        unsigned int  lba,
    430432                        void*         buffer,
    431433                        unsigned int  count )
     
    440442// - the command tables physical addresses array,
    441443//////////////////////////////////////////////////////////////////
    442 void _hba_init( unsigned int channel )
     444unsigned int _hba_init( unsigned int channel )
    443445{
    444446    unsigned int ppn;
     
    473475    if ( fail )
    474476    {
    475         _get_lock(&_tty_put_lock);
     477        _tty_get_lock( 0 );
    476478        _puts("[GIET ERROR] in _hba_init() : command list unmapped\n");
    477         _release_lock(&_tty_put_lock);
    478         _exit();
     479        _tty_release_lock( 0 );
     480        return 1;
    479481    }
    480482    hba_cmd_list_paddr[channel] = ((paddr_t)ppn) | (vbase & 0xFFF);
     
    490492        if ( fail )
    491493        {
    492             _get_lock(&_tty_put_lock);
     494            _tty_get_lock( 0 );
    493495            _puts("[GIET ERROR] in _hba_init() : command table unmapped\n");
    494             _release_lock(&_tty_put_lock);
    495             _exit();
     496            _tty_release_lock( 0 );
     497            return 1;
    496498        }
    497499        hba_cmd_table_paddr[channel][c] = ((paddr_t)ppn) | (vbase & 0xFFF);
    498500    }
     501
     502    return 0;
    499503}
    500504
     505///////////////////////////////////////////////////////////////////////////////
     506//     _hba_get_block_size()
     507// This function returns the block_size of HBA controller
     508///////////////////////////////////////////////////////////////////////////////
     509unsigned int _hba_get_block_size()
     510{
     511    // TODO The block size must be obtained from the hardware...
     512    return 512;
     513}
    501514
    502515
  • branch/giet_vm_ioc_drivers/giet_drivers/hba_driver.h

    r258 r286  
    9494
    9595///////////////////////////////////////////////////////////////////////////////////
    96 // HBA device access functions  (vci_multi_nic)
     96// HBA device access functions  (vci_hba)
    9797///////////////////////////////////////////////////////////////////////////////////
    9898
    99 unsigned int _hba_write( unsigned int lba,       // logic bloc address on device
     99unsigned int _hba_write( unsigned int mode,
     100                         unsigned int lba,       // logic bloc address on device
    100101                         void*        buffer,    // memory buffer base address
    101102                         unsigned int count );   // number of blocs
    102103
    103 unsigned int _hba_read ( unsigned int lba,       // logic bloc address on device
     104unsigned int _hba_read ( unsigned int mode,
     105                         unsigned int lba,       // logic bloc address on device
    104106                         void*        buffer,    // memory buffer base address
    105107                         unsigned int count );   // number of blocks
    106108
    107 void _hba_init();
     109unsigned int _hba_init ( unsigned int channel );
    108110
    109111unsigned int _hba_get_status( unsigned int   channel,
     
    111113
    112114unsigned int _hba_reset_status( unsigned int channel );
     115
     116unsigned int _hba_get_block_size ();
    113117
    114118
  • branch/giet_vm_ioc_drivers/giet_xml/mapping_info.h

    r283 r286  
    104104    PERIPH_TYPE_DMA       = 1,
    105105    PERIPH_TYPE_FBF       = 2,
    106     PERIPH_TYPE_HBA       = 3,
    107     PERIPH_TYPE_ICU       = 4,
    108     PERIPH_TYPE_IOB       = 5,
    109     PERIPH_TYPE_IOC       = 6,
    110     PERIPH_TYPE_MMC       = 7,
    111     PERIPH_TYPE_MWR       = 8,
    112     PERIPH_TYPE_NIC       = 9,
    113     PERIPH_TYPE_ROM       = 10,
    114     PERIPH_TYPE_SIM       = 11,
    115     PERIPH_TYPE_TIM       = 12,
    116     PERIPH_TYPE_TTY       = 13,
    117     PERIPH_TYPE_XCU       = 14,
    118 
    119     PERIPH_TYPE_MAX_VALUE = 15,
     106    PERIPH_TYPE_ICU       = 3,
     107    PERIPH_TYPE_IOB       = 4,
     108    PERIPH_TYPE_IOC       = 5,
     109    PERIPH_TYPE_MMC       = 6,
     110    PERIPH_TYPE_MWR       = 7,
     111    PERIPH_TYPE_NIC       = 8,
     112    PERIPH_TYPE_ROM       = 9,
     113    PERIPH_TYPE_SIM       = 10,
     114    PERIPH_TYPE_TIM       = 11,
     115    PERIPH_TYPE_TTY       = 12,
     116    PERIPH_TYPE_XCU       = 13,
     117
     118    PERIPH_TYPE_MAX_VALUE = 14,
    120119};
    121120
     
    153152    unsigned int fbf_cluster;        // index of cluster containing FBF controler
    154153    unsigned int fbf_cluster_bis;    // index of cluster containing second FBF controler
    155 
    156     unsigned int hba_cluster;        // index of cluster containing HBA controler
    157     unsigned int hba_cluster_bis;    // index of cluster containing second HBA controler
    158154
    159155    unsigned int iob_cluster;        // index of cluster containing IOB controler
  • branch/giet_vm_ioc_drivers/giet_xml/xml_driver.c

    r283 r286  
    6262        "DMA",
    6363        "FBF",
    64         "HBA",
    6564        "ICU",
    6665        "IOB",
  • branch/giet_vm_ioc_drivers/giet_xml/xml_parser.c

    r283 r286  
    13021302        }
    13031303        /////////////////////////////////
    1304         else if (strcmp(str, "HBA") == 0)
    1305         {
    1306             periph[periph_index]->type = PERIPH_TYPE_HBA;
    1307             use_hba = 1;
    1308             if (header->hba_cluster == 0xFFFFFFFF)
    1309             {
    1310                 header->hba_cluster  = cluster_index;
    1311                 hba_channels = periph[periph_index]->channels;
    1312             }
    1313             else if (header->hba_cluster_bis == 0xFFFFFFFF)
    1314             {
    1315                 header->hba_cluster_bis = cluster_index;
    1316                 assert( (hba_channels == periph[periph_index]->channels) &&
    1317                 "[XML ERROR] unconsistent non replicated peripheral");
    1318             }
    1319             else
    1320             {
    1321                 error = 1;
    1322             }
    1323         }
    1324         /////////////////////////////////
    13251304        else if (strcmp(str, "IOB") == 0)
    13261305        {
     
    23532332    header->fbf_cluster     = 0xFFFFFFFF;
    23542333    header->fbf_cluster_bis = 0xFFFFFFFF;
    2355 
    2356     header->hba_cluster     = 0xFFFFFFFF;
    2357     header->hba_cluster_bis = 0xFFFFFFFF;
    23582334
    23592335    header->iob_cluster     = 0xFFFFFFFF;
     
    27502726    ld_write(fdout, "seg_cma_base            ",   periph_vbase_array[PERIPH_TYPE_CMA]);
    27512727    ld_write(fdout, "seg_fbf_base            ",   periph_vbase_array[PERIPH_TYPE_FBF]);
    2752     ld_write(fdout, "seg_hba_base            ",   periph_vbase_array[PERIPH_TYPE_HBA]);
    27532728    ld_write(fdout, "seg_iob_base            ",   periph_vbase_array[PERIPH_TYPE_IOB]);
    27542729    ld_write(fdout, "seg_ioc_base            ",   periph_vbase_array[PERIPH_TYPE_IOC]);
Note: See TracChangeset for help on using the changeset viewer.