Index: trunk/platforms/tsar_generic_leti/arch.py
===================================================================
--- trunk/platforms/tsar_generic_leti/arch.py	(revision 960)
+++ trunk/platforms/tsar_generic_leti/arch.py	(revision 967)
@@ -14,23 +14,31 @@
 #  and kernel objects (global vsegs).
 #
-#  The x_size & y_size parameters define the total number of clusters.
+#  This platform includes 6 external peripherals controllers located 
+#  in cluster[x_size-1][y_size-1]: TTY, IOC, FBF, NIC, CMA, PIC.
+#  It does not use the IOB component.
+#  It does not use an external ROM, as the preloader code is (pre)loaded
+#  at address 0x0, in the physical memory of cluster[0][0].
+#  It can use an - optional - RAMDISK located in cluster[0][0].
 #  The upper row (y = y_size-1) does not contain processors or memory.
 #
-#  It does not use the IOB component:
-#  The external peripherals are located in cluster[x_size-1][y_size-1].
+#  The "constructor" parameters (defined in Makefile) are:
+#  - x_size         : number of clusters in a row
+#  - y_size         : number of clusters in a column
+#  - nb_procs       : number of processors per cluster
+#  - nb_ttys        : number of TTY channels
+#  - fbf_width      : frame_buffer width = frame_buffer heigth
+#  - ioc_type       : can be 'BDV','HBA','SDC','RDK' 
 #
-#  It does not use an external ROM, as the preloader code is (pre)loaded
-#  at address 0x0, in the physical memory of cluster[0][0].
-#
-#  It can use an - optional - RAMDISK located in cluster[0][0].
-#
-#  The others hardware parameters are:
-#  - fbf_width      : frame_buffer width = frame_buffer heigth
-#  - nb_ttys        : number of TTY channels
+#  The others hardware parameters (defined below) are:
 #  - nb_nics        : number of NIC channels
 #  - nb_cmas        : number of CMA channels
+#  - x_io           : cluster_io x coordinate
+#  - y_io           : cluster_io y coordinate
+#  - x_width        : number of bits for x coordinate
+#  - y_width        : number of bits for y coordinate
+#  - paddr_width    : number of bits for physical address
 #  - irq_per_proc   : number of input IRQs per processor
 #  - use_ramdisk    : use a RAMDISK when True
-#  - peri_increment : address increment for replicated peripherals
+#  - peri_increment : address increment for replicated vsegs
 #
 #  Regarding the boot and kernel vsegs mapping :
@@ -52,5 +60,6 @@
           nb_procs  = 4,
           nb_ttys   = 1,
-          fbf_width = 128 ):
+          fbf_width = 128,
+          ioc_type  = 'HBA' ):
 
     ### define architecture constants
@@ -58,14 +67,13 @@
     nb_nics         = 1
     nb_cmas         = 2
-    x_io            = x_size - 1
-    y_io            = y_size - 1
+    x_io            = x_size - 1  # LETI constraint
+    y_io            = y_size - 1  # LETI constraint
     x_width         = 4
     y_width         = 4
-    p_width         = 2
+    p_width         = 2           # LETI constraint
     paddr_width     = 40
-    irq_per_proc    = 4
-    use_ramdisk     = False
-    peri_increment  = 0x10000     # distributed peripherals vbase increment
-    reset_address   = 0x00000000  # wired preloader pbase address
+    irq_per_proc    = 4           # NetBSD constraint
+    peri_increment  = 0x10000 
+    reset_address   = 0x00000000  # LETI constraint
 
     ### parameters checking
@@ -75,10 +83,12 @@
     assert( x_size <= (1 << x_width) )
 
-    assert( y_size <= (1 << y_width) )
-
+    assert( (y_size > 1) and (y_size <= (1 << y_width)) )
+
+    assert( ioc_type in [ 'BDV' , 'HBA' , 'SDC' , 'RDK' ] )
+  
     ### define type and name 
 
-    platform_type  = 'tsar_leti'
-    platform_name  = '%s_%d_%d_%d' % (platform_type, x_size, y_size, nb_procs )
+    platform_name  = 'tsar_leti_%d_%d_%d' % ( x_size, y_size, nb_procs )
+    platform_name  += '_%d_%d_%s' % ( fbf_width , nb_ttys , ioc_type )
 
     ### define physical segments replicated in all clusters
@@ -97,6 +107,6 @@
     ## These segments are only defined in cluster_io
 
-    bdv_base  = 0xF2000000
-    bdv_size  = 0x1000                     # 4kbytes
+    ioc_base  = 0xF2000000
+    ioc_size  = 0x1000                     # 4kbytes
 
     tty_base  = 0xF4000000
@@ -120,5 +130,5 @@
     ### => boot cost is one BPP in cluster[0][0]
 
-    preloader_vbase      = 0x00000000      # ident
+    preloader_vbase      = reset_address   # ident
     preloader_size       = 0x00010000      # 64 Kbytes
 
@@ -176,5 +186,5 @@
                        coherence      = True,
                        irq_per_proc   = irq_per_proc,
-                       use_ramdisk    = use_ramdisk,
+                       use_ramdisk    = (ioc_type == 'RDK'),
                        x_io           = x_io,
                        y_io           = y_io,
@@ -215,6 +225,7 @@
             if ( (x==x_io) and (y==y_io) ):
 
-                bdv = mapping.addPeriph( 'BDV', base = bdv_base + offset, size = bdv_size, 
-                                         ptype = 'IOC', subtype = 'BDV' )
+                if ( ioc_type != 'RDK' ):
+                    ioc = mapping.addPeriph( 'IOC', base = ioc_base + offset, size = ioc_size, 
+                                             ptype = 'IOC', subtype = ioc_type )
 
                 tty = mapping.addPeriph( 'TTY', base = tty_base + offset, size = tty_size, 
@@ -244,5 +255,10 @@
                 mapping.addIrq( pic, index = 7 , isrtype = 'ISR_CMA'   , channel = 3 )
 
-                mapping.addIrq( pic, index = 8 , isrtype = 'ISR_BDV'   , channel = 0 )
+                if ( ioc_type == 'BDV' ):
+                    mapping.addIrq( pic, index = 8 , isrtype = 'ISR_BDV'   , channel = 0 )
+                if ( ioc_type == 'HBA' ):
+                    mapping.addIrq( pic, index = 8 , isrtype = 'ISR_HBA'   , channel = 0 )
+                if ( ioc_type == 'SDC' ):
+                    mapping.addIrq( pic, index = 8 , isrtype = 'ISR_SDC'   , channel = 0 )
 
                 mapping.addIrq( pic, index = 16, isrtype = 'ISR_TTY_RX', channel = 0 )
@@ -284,5 +300,5 @@
     ### global vseg for RAM-DISK in cluster[0][0]
     ### identity mapping / non local / big pages
-    if use_ramdisk:
+    if (ioc_type == 'RDK'):
 
         mapping.addGlobal( 'seg_ramdisk', ramdisk_vbase, ramdisk_size,
@@ -342,6 +358,6 @@
     ### global vsegs for external peripherals: non local / big page
     ### only mapped in cluster_io
-    mapping.addGlobal( 'seg_bdv', bdv_base, bdv_size,
-                       '__W_', vtype = 'PERI', x = x_io, y = y_io, pseg = 'BDV',
+    mapping.addGlobal( 'seg_ioc', ioc_base, ioc_size,
+                       '__W_', vtype = 'PERI', x = x_io, y = y_io, pseg = 'IOC',
                        local = False, big = True )
 
