Changeset 962 for trunk/softs


Ignore:
Timestamp:
Apr 1, 2015, 3:42:03 PM (10 years ago)
Author:
alain
Message:

Introducing a new IOC driver supporting the VciMultiAhci? disk controller (in polling mode only).
Extending the MMC driver to support the SYNC command requested by the AHCI protocol on the tsar_generic_iob platform.

Location:
trunk/softs/tsar_boot
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/softs/tsar_boot/Makefile

    r866 r962  
    8181              reset_bdv.c        \
    8282              reset_rdk.c        \
     83              reset_hba.c        \
    8384              sdcard.c           \
    8485              spi.c
  • trunk/softs/tsar_boot/conf/platform_de2_115_fpga/hard_config.h

    r832 r962  
    3131
    3232#define USE_IOC_BDV            0
    33 #define USE_IOC_SPI            1
     33#define USE_IOC_SDC            1
    3434#define USE_IOC_HBA            0
    3535#define USE_IOC_RDK            0
  • trunk/softs/tsar_boot/drivers/reset_bdv.c

    r758 r962  
    4343};
    4444
     45////////////////////
    4546int reset_bdv_init()
    4647{
     
    4849}
    4950
    50 int reset_bdv_read( unsigned int lba, void* buffer, unsigned int count )
     51////////////////////////////////////
     52int reset_bdv_read( unsigned int lba,
     53                    void* buffer,
     54                    unsigned int count )
    5155{
    52     /*
    53      * block_device configuration
    54      */
     56    // block_device configuration
    5557    iowrite32( &ioc_address[BLOCK_DEVICE_BUFFER], (unsigned int) buffer );
    5658    iowrite32( &ioc_address[BLOCK_DEVICE_COUNT], count );
     
    5860    iowrite32( &ioc_address[BLOCK_DEVICE_IRQ_ENABLE], 0 );
    5961
    60     /*
    61      * block_device trigger transfer
    62      */
     62    //  trigger transfer
    6363    iowrite32( &ioc_address[BLOCK_DEVICE_OP], ( unsigned int )
    6464               BLOCK_DEVICE_READ );
     65
     66#if (RESET_HARD_CC == 0) || USE_IOB
     67    // inval buffer in L1 cache
     68    reset_L1_inval( buffer , count * 512 );
     69#endif
     70
     71#if USE_IOB
     72    // inval buffer in L2 cache
     73    reset_L2_inval( buffer , count * 512 );
     74#endif
    6575
    6676    unsigned int status = 0;
     
    7282            break;
    7383        }
    74         if ( status == BLOCK_DEVICE_READ_ERROR   ) {
     84        if ( status == BLOCK_DEVICE_READ_ERROR   )
     85        {
    7586            reset_puts("ERROR during read on the BLK device\n");
    7687            return 1;
     
    7889    }
    7990
    80 #if (RESET_HARD_CC == 0) || USE_IOB
    81     reset_buf_invalidate(buffer, count * 512, USE_IOB);
    82 #endif
    8391    return 0;
    8492}
  • trunk/softs/tsar_boot/drivers/reset_inval.c

    r911 r962  
    22 * \file   reset_inval.c
    33 * \date   December 14, 2014
    4  * \author Cesar Fuguet
     4 * \author Cesar Fuguet / Alain Greiner
    55 */
    66
     
    1313#endif
    1414
    15 static int* const mcc_address = (int* const)SEG_MMC_BASE;
     15static int* const mmc_address = (int* const)SEG_MMC_BASE;
    1616
    1717enum memc_registers
     
    3131
    3232/**
    33  * \brief Invalidate all data cache lines corresponding to a memory buffer
    34  *        (identified by an address and a size) in L1 cache and L2 cache.
     33 * \brief Invalidate all L1 cache lines corresponding to a memory buffer
     34 *        (identified by an address and a size).
    3535 */
    36 void reset_buf_invalidate (void* const buffer, size_t size, int inval_memc)
     36void reset_L1_inval( void* const buffer, size_t size )
    3737{
    3838    unsigned int i;
     
    4545            : /* no outputs */
    4646            : "i" (0x11), "R" (*((char*)buffer + i))
    47             : "memory"
    48             );
     47            : "memory" );
    4948    }
     49}
    5050
    51     if (inval_memc)
    52     {
    53         // this preloader uses only the cluster 0
    54         // It does not use the ADDR_HI bits, and does not take
    55         // any lock for exclusive access to MCC
    56         iowrite32(&mcc_address[MCC_ADDR_LO], (unsigned int) buffer);
    57         iowrite32(&mcc_address[MCC_ADDR_HI], (unsigned int) 0);
    58         iowrite32(&mcc_address[MCC_LENGTH] , (unsigned int) size);
    59         iowrite32(&mcc_address[MCC_CMD]    , (unsigned int) MCC_CMD_INVAL);
    60     }
     51/**
     52 * \brief Invalidate all L2 cache lines corresponding to a memory buffer
     53 *        (identified by an address and a size).
     54 */
     55void reset_L2_inval( void* const buffer, size_t size )
     56{
     57    iowrite32( &mmc_address[MCC_ADDR_LO], (unsigned int)buffer );
     58    iowrite32( &mmc_address[MCC_ADDR_HI], 0 );
     59    iowrite32( &mmc_address[MCC_LENGTH] , size );
     60    iowrite32( &mmc_address[MCC_CMD]    , MCC_CMD_INVAL);
     61}
     62
     63/**
     64 * \brief Update external RAM for all L2 cache lines corresponding to
     65 *        a memory buffer (identified by an address and a size).
     66 */
     67void reset_L2_sync ( void* const buffer, size_t size )
     68{
     69    iowrite32( &mmc_address[MCC_ADDR_LO], (unsigned int)buffer );
     70    iowrite32( &mmc_address[MCC_ADDR_HI], 0 );
     71    iowrite32( &mmc_address[MCC_LENGTH] , size );
     72    iowrite32( &mmc_address[MCC_CMD]    , MCC_CMD_SYNC );
    6173}
    6274
  • trunk/softs/tsar_boot/drivers/reset_inval.h

    r758 r962  
    1010#include <inttypes.h>
    1111
    12 void reset_mcc_invalidate (void* const buffer, size_t size);
     12void reset_L1_inval (void* const buffer, size_t size);
    1313
    14 void reset_buf_invalidate (void* const buffer, size_t size, int inval_memc);
     14void reset_L2_inval (void* const buffer, size_t size);
     15
     16void reset_L2_sync (void* const buffer, size_t size);
    1517
    1618#endif
  • trunk/softs/tsar_boot/include/reset_ioc.h

    r758 r962  
    77 *
    88 * \note   These functions call the specific disk controller driver depending
    9  *         on the USE_IOC_BDV, USE_IOC_SPI or USE_RAMDISK constants
     9 *         on the USE_IOC_BDV, USE_IOC_SDC or USE_IOC_HBA USE_IOC_RDK flags
    1010 */
    1111#ifndef RESET_IOC_H
  • trunk/softs/tsar_boot/include/reset_utils.h

    r758 r962  
    5454void check_elf_header(Elf32_Ehdr *ehdr);
    5555void reset_print_elf_phdr(Elf32_Phdr * elf_phdr_ptr);
     56void reset_display_block( char* buffer );
    5657
    5758#endif /* RESET_UTILS_H */
  • trunk/softs/tsar_boot/src/reset_elf_loader.c

    r949 r962  
    4343        goto error;
    4444    }
     45
     46#if (RESET_DEBUG == 1)
     47    reset_display_block( (char*)&elf_header );
     48#endif
     49
    4550    check_elf_header(&elf_header);
    4651
  • trunk/softs/tsar_boot/src/reset_ioc.c

    r796 r962  
    77 *
    88 * \note   These functions call the specific disk controller driver depending
    9  *         on the USE_IOC_BDV, USE_IOC_SPI or USE_IOC_RDK constants
     9 *         on the USE_IOC_BDV, USE_IOC_SDC or USE_IOC_RDK constants
    1010 */
    1111
     
    1313#include <defs.h>
    1414
    15 #if !defined(USE_IOC_BDV) && !defined(USE_IOC_SPI) && !defined(USE_IOC_RDK)
    16 #   error "One of the USE_IOC_* constants must be defined in the hard_config.h"
     15#if (USE_IOC_BDV + USE_IOC_SDC + USE_IOC_RDK + USE_IOC_HBA) != 1
     16#   error "in reset_ioc.c : undefined disk controller in hard_config.h"
    1717#endif
    1818
    19 #if (USE_IOC_BDV + USE_IOC_SPI + USE_IOC_RDK) != 1
    20 #   error "Only one disk controller must be used"
    21 #endif
    22 
    23 #if USE_IOC_SPI
     19#if USE_IOC_SDC
    2420#include <reset_sdc.h>
    2521#endif
     
    3329#endif
    3430
     31#if USE_IOC_HBA
     32#include <reset_hba.h>
     33#endif
     34
     35
    3536/**
    3637 * \brief Initialize the disk controller
     
    4041#if USE_IOC_BDV
    4142    return reset_bdv_init();
    42 #elif USE_IOC_SPI
     43#elif USE_IOC_SDC
    4344    return reset_sdc_init();
    4445#elif USE_IOC_RDK
    4546    return reset_rdk_init();
     47#elif USE_IOC_HBA
     48    return reset_hba_init();
    4649#else
    47 #   error "reset_ioc_init() : Not supported disk controller chosen"
     50#   error "in reset_ioc_init.c : undefined disk controller in hard_config.h"
    4851#endif
    4952}
     
    6366#if USE_IOC_BDV
    6467    return reset_bdv_read(lba, buffer, count);
    65 #elif USE_IOC_SPI
     68#elif USE_IOC_SDC
    6669    return reset_sdc_read(lba, buffer, count);
    6770#elif USE_IOC_RDK
    6871    return reset_rdk_read(lba, buffer, count);
     72#elif USE_IOC_HBA
     73    return reset_hba_read(lba, buffer, count);
    6974#else
    70 #   error "reset_ioc_read() : Not supported disk controller chosen"
     75#   error "in reset_ioc_read.c : undefined disk controller in hard_config.h"
    7176#endif
    7277}
  • trunk/softs/tsar_boot/src/reset_utils.c

    r930 r962  
    178178        (ehdr->e_ident[EI_MAG3] != ELFMAG3))
    179179    {
    180         reset_puts("[RESET ERROR] Unrecognized file format (not an ELF format)\n");
     180        reset_puts("\n[RESET ERROR] Unrecognized file format (not an ELF format)\n");
    181181        reset_exit();
    182182    }
     
    220220}
    221221
     222/**
     223 * \param buffer : Pointer to the char buffer
     224 *
     225 * \brief Print a 512 bytes buffer
     226 */
     227#if (RESET_DEBUG == 1 )
     228void reset_display_block( char* buffer )
     229{
     230    unsigned int line;
     231    unsigned int word;
     232
     233    reset_puts("***********************************************************************\n");
     234    for ( line = 0 ; line < 32 ; line++ )
     235    {
     236        // display line index
     237        reset_putx( line );
     238        reset_puts(" : ");
     239
     240        // display 8*4 bytes hexa
     241        for ( word=0 ; word<4 ; word++ )
     242        {
     243            unsigned int byte  = (line<<5) + (word<<2);
     244            unsigned int hexa  = (buffer[byte  ]<<24) |
     245                                 (buffer[byte+1]<<16) |
     246                                 (buffer[byte+2]<< 8) |
     247                                 (buffer[byte+3]);
     248            reset_putx( hexa );
     249            reset_puts(" | ");
     250        }
     251        reset_puts("\n");
     252    }
     253    reset_puts("***********************************************************************\n");
     254}   
     255#endif
     256
    222257/*
    223258 * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
Note: See TracChangeset for help on using the changeset viewer.