Index: trunk/softs/tsar_boot/Makefile
===================================================================
--- trunk/softs/tsar_boot/Makefile	(revision 960)
+++ trunk/softs/tsar_boot/Makefile	(revision 962)
@@ -81,4 +81,5 @@
               reset_bdv.c        \
               reset_rdk.c        \
+              reset_hba.c        \
               sdcard.c           \
               spi.c
Index: trunk/softs/tsar_boot/conf/platform_de2_115_fpga/hard_config.h
===================================================================
--- trunk/softs/tsar_boot/conf/platform_de2_115_fpga/hard_config.h	(revision 960)
+++ trunk/softs/tsar_boot/conf/platform_de2_115_fpga/hard_config.h	(revision 962)
@@ -31,5 +31,5 @@
 
 #define USE_IOC_BDV            0
-#define USE_IOC_SPI            1
+#define USE_IOC_SDC            1
 #define USE_IOC_HBA            0
 #define USE_IOC_RDK            0
Index: trunk/softs/tsar_boot/drivers/reset_bdv.c
===================================================================
--- trunk/softs/tsar_boot/drivers/reset_bdv.c	(revision 960)
+++ trunk/softs/tsar_boot/drivers/reset_bdv.c	(revision 962)
@@ -43,4 +43,5 @@
 };
 
+////////////////////
 int reset_bdv_init()
 {
@@ -48,9 +49,10 @@
 }
 
-int reset_bdv_read( unsigned int lba, void* buffer, unsigned int count )
+////////////////////////////////////
+int reset_bdv_read( unsigned int lba, 
+                    void* buffer, 
+                    unsigned int count )
 {
-    /*
-     * block_device configuration
-     */
+    // block_device configuration
     iowrite32( &ioc_address[BLOCK_DEVICE_BUFFER], (unsigned int) buffer );
     iowrite32( &ioc_address[BLOCK_DEVICE_COUNT], count );
@@ -58,9 +60,17 @@
     iowrite32( &ioc_address[BLOCK_DEVICE_IRQ_ENABLE], 0 );
 
-    /*
-     * block_device trigger transfer
-     */
+    //  trigger transfer
     iowrite32( &ioc_address[BLOCK_DEVICE_OP], ( unsigned int )
                BLOCK_DEVICE_READ );
+
+#if (RESET_HARD_CC == 0) || USE_IOB
+    // inval buffer in L1 cache
+    reset_L1_inval( buffer , count * 512 );
+#endif
+
+#if USE_IOB
+    // inval buffer in L2 cache
+    reset_L2_inval( buffer , count * 512 );
+#endif
 
     unsigned int status = 0;
@@ -72,5 +82,6 @@
             break;
         }
-        if ( status == BLOCK_DEVICE_READ_ERROR   ) {
+        if ( status == BLOCK_DEVICE_READ_ERROR   ) 
+        {
             reset_puts("ERROR during read on the BLK device\n");
             return 1;
@@ -78,7 +89,4 @@
     }
 
-#if (RESET_HARD_CC == 0) || USE_IOB
-    reset_buf_invalidate(buffer, count * 512, USE_IOB);
-#endif
     return 0;
 }
Index: trunk/softs/tsar_boot/drivers/reset_inval.c
===================================================================
--- trunk/softs/tsar_boot/drivers/reset_inval.c	(revision 960)
+++ trunk/softs/tsar_boot/drivers/reset_inval.c	(revision 962)
@@ -2,5 +2,5 @@
  * \file   reset_inval.c
  * \date   December 14, 2014
- * \author Cesar Fuguet
+ * \author Cesar Fuguet / Alain Greiner
  */
 
@@ -13,5 +13,5 @@
 #endif
 
-static int* const mcc_address = (int* const)SEG_MMC_BASE;
+static int* const mmc_address = (int* const)SEG_MMC_BASE;
 
 enum memc_registers
@@ -31,8 +31,8 @@
 
 /**
- * \brief Invalidate all data cache lines corresponding to a memory buffer
- *        (identified by an address and a size) in L1 cache and L2 cache.
+ * \brief Invalidate all L1 cache lines corresponding to a memory buffer
+ *        (identified by an address and a size).
  */
-void reset_buf_invalidate (void* const buffer, size_t size, int inval_memc)
+void reset_L1_inval( void* const buffer, size_t size )
 {
     unsigned int i;
@@ -45,18 +45,30 @@
             : /* no outputs */
             : "i" (0x11), "R" (*((char*)buffer + i))
-            : "memory"
-            );
+            : "memory" );
     }
+}
 
-    if (inval_memc)
-    {
-        // this preloader uses only the cluster 0
-        // It does not use the ADDR_HI bits, and does not take
-        // any lock for exclusive access to MCC 
-        iowrite32(&mcc_address[MCC_ADDR_LO], (unsigned int) buffer);
-        iowrite32(&mcc_address[MCC_ADDR_HI], (unsigned int) 0);
-        iowrite32(&mcc_address[MCC_LENGTH] , (unsigned int) size);
-        iowrite32(&mcc_address[MCC_CMD]    , (unsigned int) MCC_CMD_INVAL);
-    }
+/**
+ * \brief Invalidate all L2 cache lines corresponding to a memory buffer
+ *        (identified by an address and a size).
+ */
+void reset_L2_inval( void* const buffer, size_t size )
+{
+    iowrite32( &mmc_address[MCC_ADDR_LO], (unsigned int)buffer );
+    iowrite32( &mmc_address[MCC_ADDR_HI], 0 );
+    iowrite32( &mmc_address[MCC_LENGTH] , size );
+    iowrite32( &mmc_address[MCC_CMD]    , MCC_CMD_INVAL);
+}
+
+/**
+ * \brief Update external RAM for all L2 cache lines corresponding to 
+ *        a memory buffer (identified by an address and a size).
+ */
+void reset_L2_sync ( void* const buffer, size_t size )
+{
+    iowrite32( &mmc_address[MCC_ADDR_LO], (unsigned int)buffer );
+    iowrite32( &mmc_address[MCC_ADDR_HI], 0 );
+    iowrite32( &mmc_address[MCC_LENGTH] , size );
+    iowrite32( &mmc_address[MCC_CMD]    , MCC_CMD_SYNC );
 }
 
Index: trunk/softs/tsar_boot/drivers/reset_inval.h
===================================================================
--- trunk/softs/tsar_boot/drivers/reset_inval.h	(revision 960)
+++ trunk/softs/tsar_boot/drivers/reset_inval.h	(revision 962)
@@ -10,7 +10,9 @@
 #include <inttypes.h>
 
-void reset_mcc_invalidate (void* const buffer, size_t size);
+void reset_L1_inval (void* const buffer, size_t size);
 
-void reset_buf_invalidate (void* const buffer, size_t size, int inval_memc);
+void reset_L2_inval (void* const buffer, size_t size);
+
+void reset_L2_sync (void* const buffer, size_t size);
 
 #endif
Index: trunk/softs/tsar_boot/include/reset_ioc.h
===================================================================
--- trunk/softs/tsar_boot/include/reset_ioc.h	(revision 960)
+++ trunk/softs/tsar_boot/include/reset_ioc.h	(revision 962)
@@ -7,5 +7,5 @@
  *
  * \note   These functions call the specific disk controller driver depending
- *         on the USE_IOC_BDV, USE_IOC_SPI or USE_RAMDISK constants
+ *         on the USE_IOC_BDV, USE_IOC_SDC or USE_IOC_HBA USE_IOC_RDK flags
  */
 #ifndef RESET_IOC_H
Index: trunk/softs/tsar_boot/include/reset_utils.h
===================================================================
--- trunk/softs/tsar_boot/include/reset_utils.h	(revision 960)
+++ trunk/softs/tsar_boot/include/reset_utils.h	(revision 962)
@@ -54,4 +54,5 @@
 void check_elf_header(Elf32_Ehdr *ehdr);
 void reset_print_elf_phdr(Elf32_Phdr * elf_phdr_ptr);
+void reset_display_block( char* buffer );
 
 #endif /* RESET_UTILS_H */
Index: trunk/softs/tsar_boot/src/reset_elf_loader.c
===================================================================
--- trunk/softs/tsar_boot/src/reset_elf_loader.c	(revision 960)
+++ trunk/softs/tsar_boot/src/reset_elf_loader.c	(revision 962)
@@ -43,4 +43,9 @@
         goto error;
     }
+
+#if (RESET_DEBUG == 1)
+    reset_display_block( (char*)&elf_header );
+#endif
+
     check_elf_header(&elf_header);
 
Index: trunk/softs/tsar_boot/src/reset_ioc.c
===================================================================
--- trunk/softs/tsar_boot/src/reset_ioc.c	(revision 960)
+++ trunk/softs/tsar_boot/src/reset_ioc.c	(revision 962)
@@ -7,5 +7,5 @@
  *
  * \note   These functions call the specific disk controller driver depending
- *         on the USE_IOC_BDV, USE_IOC_SPI or USE_IOC_RDK constants
+ *         on the USE_IOC_BDV, USE_IOC_SDC or USE_IOC_RDK constants
  */
 
@@ -13,13 +13,9 @@
 #include <defs.h>
 
-#if !defined(USE_IOC_BDV) && !defined(USE_IOC_SPI) && !defined(USE_IOC_RDK)
-#   error "One of the USE_IOC_* constants must be defined in the hard_config.h"
+#if (USE_IOC_BDV + USE_IOC_SDC + USE_IOC_RDK + USE_IOC_HBA) != 1
+#   error "in reset_ioc.c : undefined disk controller in hard_config.h"
 #endif
 
-#if (USE_IOC_BDV + USE_IOC_SPI + USE_IOC_RDK) != 1
-#   error "Only one disk controller must be used"
-#endif
-
-#if USE_IOC_SPI
+#if USE_IOC_SDC
 #include <reset_sdc.h>
 #endif
@@ -33,4 +29,9 @@
 #endif
 
+#if USE_IOC_HBA
+#include <reset_hba.h>
+#endif
+
+
 /**
  * \brief Initialize the disk controller
@@ -40,10 +41,12 @@
 #if USE_IOC_BDV
     return reset_bdv_init();
-#elif USE_IOC_SPI
+#elif USE_IOC_SDC
     return reset_sdc_init();
 #elif USE_IOC_RDK
     return reset_rdk_init();
+#elif USE_IOC_HBA
+    return reset_hba_init();
 #else
-#   error "reset_ioc_init() : Not supported disk controller chosen"
+#   error "in reset_ioc_init.c : undefined disk controller in hard_config.h"
 #endif
 }
@@ -63,10 +66,12 @@
 #if USE_IOC_BDV
     return reset_bdv_read(lba, buffer, count);
-#elif USE_IOC_SPI
+#elif USE_IOC_SDC
     return reset_sdc_read(lba, buffer, count);
 #elif USE_IOC_RDK
     return reset_rdk_read(lba, buffer, count);
+#elif USE_IOC_HBA
+    return reset_hba_read(lba, buffer, count);
 #else
-#   error "reset_ioc_read() : Not supported disk controller chosen"
+#   error "in reset_ioc_read.c : undefined disk controller in hard_config.h"
 #endif
 }
Index: trunk/softs/tsar_boot/src/reset_utils.c
===================================================================
--- trunk/softs/tsar_boot/src/reset_utils.c	(revision 960)
+++ trunk/softs/tsar_boot/src/reset_utils.c	(revision 962)
@@ -178,5 +178,5 @@
         (ehdr->e_ident[EI_MAG3] != ELFMAG3))
     {
-        reset_puts("[RESET ERROR] Unrecognized file format (not an ELF format)\n");
+        reset_puts("\n[RESET ERROR] Unrecognized file format (not an ELF format)\n");
         reset_exit();
     }
@@ -220,4 +220,39 @@
 }
 
+/**
+ * \param buffer : Pointer to the char buffer
+ *
+ * \brief Print a 512 bytes buffer
+ */
+#if (RESET_DEBUG == 1 )
+void reset_display_block( char* buffer )
+{
+    unsigned int line;
+    unsigned int word;
+
+    reset_puts("***********************************************************************\n");
+    for ( line = 0 ; line < 32 ; line++ )
+    {
+        // display line index 
+        reset_putx( line );
+        reset_puts(" : ");
+
+        // display 8*4 bytes hexa
+        for ( word=0 ; word<4 ; word++ )
+        {
+            unsigned int byte  = (line<<5) + (word<<2);
+            unsigned int hexa  = (buffer[byte  ]<<24) |
+                                 (buffer[byte+1]<<16) |
+                                 (buffer[byte+2]<< 8) |
+                                 (buffer[byte+3]);
+            reset_putx( hexa );
+            reset_puts(" | ");
+        }
+        reset_puts("\n");
+    }
+    reset_puts("***********************************************************************\n");
+}   
+#endif
+
 /*
  * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
