Changeset 411 for soft/giet_vm/giet_python
- Timestamp:
- Sep 29, 2014, 11:56:47 AM (10 years ago)
- Location:
- soft/giet_vm/giet_python
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_python/genmap
r401 r411 13 13 # 2) The optionals "map.bin" and vsegs.ld" files are used to configure the GietVM. 14 14 # 3) The optional "netbsd.dts" file can be used to configure NetBSD. 15 # 4) The optional "arch.bib" file can be used to configure ALMOS. 16 # 5) An optional "map.xml" file can be generated for debug. 15 # 4) The optional "netbsd.dts" file can be used to configure NetBSD. 16 # 5) The optional "arch.bib" file can be used to configure ALMOS. 17 # 6) An optional "map.xml" file can be generated for debug. 17 18 ####################################################################################### 18 19 # The hardware parameters are: … … 57 58 help = 'define number of processors per cluster' ) 58 59 60 parser.add_option( '--fbf', type = 'int', dest = 'fbf_size', 61 default = 128, 62 help = 'define frame buffer width and heigth' ) 63 59 64 parser.add_option( '--v', action = 'store_true', dest = 'verbose', 60 65 default = False, … … 63 68 parser.add_option( '--netbsd', type = 'string', dest = 'netbsd_path', 64 69 help = 'define pathname for the netbsd.dts file' ) 70 71 parser.add_option( '--linux', type = 'string', dest = 'linux_path', 72 help = 'define pathname for the linux.dts file' ) 65 73 66 74 parser.add_option( '--almos', type = 'string', dest = 'almos_path', … … 99 107 y_size = options.y_size # number of clusters in a column 100 108 nprocs = options.nprocs # number of processors in a cluster 109 fbf_size = options.fbf_size # frame buffer width & heigth 101 110 102 111 verbose = options.verbose # report on map.bin generation if True 103 112 104 113 netbsd_path = options.netbsd_path # path for netbsd.dts file 114 linux_path = options.linux_path # path for linux.dts file 105 115 almos_path = options.almos_path # path for arch.bib file 106 116 giet_path = options.giet_path # path for map.bin & vsegs.ld files … … 130 140 131 141 # build mapping calling the function (function name) 132 mapping = select.arch( x_size, y_size, nprocs )142 mapping = select.arch( x_size, y_size, nprocs, fbf_size ) 133 143 print '[genmap] platform %s build' % mapping.name 134 144 … … 172 182 f = open ( pathname, 'w' ) 173 183 f.write( mapping.netbsd_dts() ) 174 print '[genmap] %s generated for netbsd' % pathname 184 print '[genmap] %s generated' % pathname 185 186 ###################################################################################### 187 # Generate linux.dts file if required. 188 # It is used for LINUX configuration. 189 ###################################################################################### 190 191 if ( (linux_path != None) and (arch_path != None) ): 192 pathname = linux_path + '/linux.dts' 193 f = open ( pathname, 'w' ) 194 f.write( mapping.linux_dts() ) 195 print '[genmap] %s generated' % pathname 175 196 176 197 ###################################################################################### -
soft/giet_vm/giet_python/mapping.py
r406 r411 23 23 ########################################################################################## 24 24 # Implementation Note 25 # As described above, the various objectsare distributed in the PYTHON structure:25 # The various objects used to describe a mapping are distributed in the PYTHON structure: 26 26 # For example the psegs set is split in several subsets (one subset per cluster), 27 27 # or the tasks set is split in several subsets (one subset per vspace), etc... … … 33 33 ########################################################################################## 34 34 35 ###################################################################################### 36 # These global lists must be consistent with enums in mapping_info.h or irq_handler.h 37 ###################################################################################### 35 ########################################################################################## 36 # Various constants 37 ########################################################################################## 38 39 PADDR_WIDTH = 40 # number of bits for physical address 40 X_WIDTH = 4 # number of bits encoding x coordinate 41 Y_WIDTH = 4 # number of bits encoding y coordinate 42 P_WIDTH = 4 # number of bits encoding local proc_id 43 VPN_ANTI_MASK = 0x00000FFF # mask virtual address to get offset in a small page 44 BPN_MASK = 0xFFE00000 # mask virtual address to get the BPN (big page) 45 PERI_INCREMENT = 0x10000 # virtual address increment for replicated global vsegs 46 RESET_ADDRESS = 0xBFC00000 # Processor wired boot_address 47 MAPPING_SIGNATURE = 0xDACE2014 # Magic number indicating a valid C binary struture 48 49 ########################################################################################## 50 # These global lists must be consistent with enums in mapping_info.h or irq_handler. 51 ########################################################################################## 38 52 PERIPHTYPES = [ 39 53 'CMA', … … 131 145 ########################################################################################## 132 146 def __init__( self, 133 name, # mapping name 134 x_size, # number of clusters in a row 135 y_size, # number of clusters in a column 136 procs_max = 2, # max number of processors per cluster 137 x_width = 4, # number of bits encoding x coordinate 138 y_width = 4, # number of bits encoding y coordinate 139 p_width = 2, # number of bits encoding local proc id 140 paddr_width = 40, # number of bits for physical address 141 coherence = 1, # hardware cache coherence when non-zero 142 irq_per_proc = 1, # number or IRQs from XCU to processor 143 use_ramdisk = False, # use ramdisk when true 144 x_io = 0, # cluster_io x coordinate 145 y_io = 0, # cluster_io y coordinate 146 peri_increment = 0x10000, # address increment for globals 147 reset_address = 0xBFC00000, # Processor wired boot_address 148 ram_base = 0, # RAM physical base address in cluster[0,0] 149 ram_size = 0 ): # RAM size in each cluster (bytes) 150 151 assert (procs_max <= (1 << p_width)) 152 153 self.signature = 0xDACE2014 147 name, # mapping name 148 x_size, # number of clusters in a row 149 y_size, # number of clusters in a column 150 nprocs, # max number of processors per cluster 151 x_width = X_WIDTH, # number of bits encoding x coordinate 152 y_width = Y_WIDTH, # number of bits encoding y coordinate 153 p_width = P_WIDTH, # number of bits encoding local proc_id 154 paddr_width = PADDR_WIDTH, # number of bits for physical address 155 coherence = 1, # hardware cache coherence when non-zero 156 irq_per_proc = 1, # number or IRQs from XCU to processor 157 use_ramdisk = False, # use ramdisk when true 158 x_io = 0, # cluster_io x coordinate 159 y_io = 0, # cluster_io y coordinate 160 peri_increment = PERI_INCREMENT, # address increment for globals 161 reset_address = RESET_ADDRESS, # Processor wired boot_address 162 ram_base = 0, # RAM physical base in cluster[0,0] 163 ram_size = 0 ): # RAM size in each cluster (bytes) 164 165 assert ( x_size <= (1<<X_WIDTH) ) 166 assert ( y_size <= (1<<Y_WIDTH) ) 167 assert ( nprocs <= (1<<P_WIDTH) ) 168 169 self.signature = MAPPING_SIGNATURE 154 170 self.name = name 155 171 self.paddr_width = paddr_width … … 157 173 self.x_size = x_size 158 174 self.y_size = y_size 159 self. procs_max = procs_max175 self.nprocs = nprocs 160 176 self.x_width = x_width 161 177 self.y_width = y_width … … 170 186 self.ram_size = ram_size 171 187 172 173 188 self.total_vspaces = 0 174 189 self.total_globals = 0 … … 201 216 size ): # pseg length (bytes) 202 217 203 # c heck coordinates (obtained from the base address)218 # computes coordinates from the base address extension 204 219 paddr_lsb_width = self.paddr_width - self.x_width - self.y_width 205 220 cluster_xy = base >> paddr_lsb_width … … 207 222 y = cluster_xy & ((1 << self.y_width) - 1) 208 223 209 assert (base & 0xFFF) == 0224 assert (base & VPN_ANTI_MASK) == 0 210 225 211 226 assert (x < self.x_size) and (y < self.y_size) … … 242 257 assert (x < self.x_size) and (y < self.y_size) 243 258 244 assert (base & 0xFFF) == 0259 assert (base & VPN_ANTI_MASK) == 0 245 260 246 261 assert ptype in PERIPHTYPES … … 347 362 return port 348 363 349 ############################ add one (or several) global vseg into mapping 350 def addGlobal( self, 351 name, # vseg name 352 vbase, # virtual base address 353 size, # vobj length (bytes) 354 mode, # CXWU flags 355 vtype, # vobj type 356 x, # destination x coordinate 357 y, # destination y coordinate 358 pseg, # destination pseg name 359 identity = False, # identity mapping required if true 360 binpath = '', # pathname for binary code 361 local = False ): # non shared vseg when true 364 ############################ add one global vseg into mapping 365 def addGlobal( self, 366 name, # vseg name 367 vbase, # virtual base address 368 size, # vobj length (bytes) 369 mode, # CXWU flags 370 vtype, # vobj type 371 x, # destination x coordinate 372 y, # destination y coordinate 373 pseg, # destination pseg name 374 identity = False, # identity mapping required if true 375 binpath = '', # pathname for binary code if required 376 align = 0, # alignment required 377 local = False, # only mapped in local PTAB if true 378 big = False ): # to be mapped in a big physical page 362 379 363 380 assert mode in VSEGMODES … … 365 382 assert vtype in VOBJTYPES 366 383 367 assert (vbase & 0xFFF) == 0368 369 384 assert (x < self.x_size) and (y < self.y_size) 385 386 # two global vsegs must not overlap if they have different names 387 for prev in self.globs: 388 prev_vbase = prev.vbase 389 prev_size = prev.vobjs[0].length 390 391 if ( ((prev_vbase + prev_size) > vbase ) and 392 ((vbase + size) > prev_vbase) and 393 (prev.name != name) ): 394 print '[genmap error] in addGlobal() : %s overlap %s' % (name, prev.name) 395 print ' %s : base = %x / size = %x' %( name, vbase, size ) 396 print ' %s : base = %x / size = %x' %( prev.name, prev_vbase, prev_size ) 397 sys.exit(1) 370 398 371 399 # add one vseg into mapping 372 400 vseg = Vseg( name, vbase, mode, x, y, pseg, 373 identity = identity, local = local )401 identity = identity, local = local, big = big ) 374 402 375 403 self.globs.append( vseg ) … … 413 441 align = 0, # alignment required 414 442 init = 0, # initial value 415 local = False ): # non shared when true 443 local = False, # only mapped in local PTAB if true 444 big = False ): # to be mapped in a big physical page 416 445 417 446 assert mode in VSEGMODES … … 422 451 423 452 # add one vseg into mapping 424 vseg = Vseg( name, vbase, mode, x, y, pseg, local = local )453 vseg = Vseg( name, vbase, mode, x, y, pseg, local = local, big = big ) 425 454 vspace.vsegs.append( vseg ) 426 455 vseg.index = self.total_vsegs … … 473 502 474 503 assert (x < self.x_size) and (y < self.y_size) 475 assert lpid < self. procs_max504 assert lpid < self.nprocs 476 505 477 506 # add one task into mapping … … 509 538 return byte_stream 510 539 511 ################ 512 def xml( self ): # xml file generation for mapping540 #################################################################################### 541 def xml( self ): # compute string for map.xml file generation 513 542 514 543 s = '<?xml version="1.0"?>\n\n' … … 545 574 return s 546 575 547 ######################### 548 def cbin( self, verbose ): # C binary structure generation for mapping576 ##################################################################################### 577 def cbin( self, verbose ): # C binary structure for map.bin file generation 549 578 550 579 byte_stream = bytearray() … … 705 734 # end of cbin() 706 735 707 ####################### 708 def giet_vsegs( self ): # compute string for giet_vsegs.ld file 736 ################################################################################## 737 def giet_vsegs( self ): # compute string for giet_vsegs.ld file generation 709 738 # required by giet_vm compilation 710 739 … … 798 827 return s 799 828 800 ######################## 801 def hard_config( self ): # compute string for hard_config.h file required by 829 ################################################################################### 830 def hard_config( self ): # compute string for hard_config.h file generation, 831 # required by 802 832 # - top.cpp compilation 803 833 # - giet_vm compilation … … 1094 1124 s += '#define X_IO %d\n' % self.x_io 1095 1125 s += '#define Y_IO %d\n' % self.y_io 1096 s += '#define NB_PROCS_MAX %d\n' % self. procs_max1126 s += '#define NB_PROCS_MAX %d\n' % self.nprocs 1097 1127 s += '#define IRQ_PER_PROCESSOR %d\n' % self.irq_per_proc 1098 1128 s += '#define RESET_ADDRESS 0x%x\n' % self.reset_address … … 1201 1231 # end of hard_config() 1202 1232 1203 ####################### 1233 ################################################################################ 1234 def linux_dts( self ): # compute string for linux.dts file generation 1235 # used for linux configuration 1236 # header 1237 s = '/dts-v1/;\n' 1238 s += '\n' 1239 s += '/{\n' 1240 s += ' compatible = "tsar, %s";\n' % self.name 1241 s += ' #address-cells = <2>;\n' # physical address on 64 bits 1242 s += ' #size-cells = <1>;\n' # segment size on 32 bits 1243 s += ' model = "%s";\n' % self.name 1244 s += '\n' 1245 1246 # linux globals arguments 1247 s += ' chosen {\n' 1248 s += ' linux,stdout-path = &tty;\n' 1249 s += ' bootargs = "console=tty0 console=ttyVTTY0 earlyprintk";\n' 1250 s += ' };\n\n' 1251 1252 # cpus (for each cluster) 1253 s += ' cpus {\n' 1254 s += ' #address-cells = <1>;\n' 1255 s += ' #size-cells = <0>;\n' 1256 1257 for cluster in self.clusters: 1258 for proc in cluster.procs: 1259 x = cluster.x 1260 y = cluster.y 1261 l = proc.lpid 1262 proc_id = (((x << self.y_width) + y) * self.nprocs) + l 1263 s += ' cpu@%d_%d_%d {\n' %(x,y,l) 1264 s += ' device_type = "cpu";\n' 1265 s += ' compatible = "soclib,mips32el";\n' 1266 s += ' reg = <0x%x>;\n' % proc_id 1267 s += ' };\n' 1268 s += '\n' 1269 1270 s += ' };\n\n' 1271 1272 # devices (ram or peripheral) are grouped per cluster 1273 # the "compatible" attribute links a peripheral device 1274 # to one or several drivers identified by ("major","minor") 1275 1276 for cluster in self.clusters: 1277 x = cluster.x 1278 y = cluster.y 1279 found_xcu = False 1280 found_pic = False 1281 1282 s += ' /*** cluster[%d,%d] ***/\n\n' % (x,y) 1283 1284 # scan all psegs to find RAM in current cluster 1285 for pseg in cluster.psegs: 1286 if ( pseg.segtype == 'RAM' ): 1287 msb = pseg.base >> 32 1288 lsb = pseg.base & 0xFFFFFFFF 1289 size = pseg.size 1290 1291 s += ' ram@%d_%d: ram@%d_%d {\n' % (x,y,x,y) 1292 s += ' device_type = "memory";\n' 1293 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1294 s += ' };\n\n' 1295 1296 # scan all periphs to find XCU or PIC in current cluster 1297 for periph in cluster.periphs: 1298 msb = periph.pseg.base >> 32 1299 lsb = periph.pseg.base & 0xFFFFFFFF 1300 size = periph.pseg.size 1301 1302 # search XCU (can be replicated) 1303 if ( (periph.ptype == 'XCU') ): 1304 found_xcu = True 1305 xcu = periph 1306 irq_ctrl_name = 'xcu@%d_%d' % (x,y) 1307 1308 s += ' %s: %s {\n' % (irq_ctrl_name, irq_ctrl_name) 1309 s += ' compatible = "soclib, vci_xicu", "soclib, vci_xicu_timer";\n' 1310 s += ' interrupt-controller;\n' 1311 s += ' #interrupt-cells = <1>;\n' 1312 s += ' clocks = <&freq>;\n' # the XCU component contains a timer 1313 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1314 s += ' };\n\n' 1315 1316 # search PIC (non replicated) 1317 if ( periph.ptype == 'PIC' ): 1318 found_pic = True 1319 pic = periph 1320 irq_ctrl_name = 'pic' 1321 1322 s += ' %s: %s {\n' % (irq_ctrl_name, irq_ctrl_name) 1323 s += ' compatible = "soclib, vci_iopic";\n' 1324 s += ' interrupt-controller;\n' 1325 s += ' #interrupt-cells = <1>;\n' 1326 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1327 s += ' };\n\n' 1328 1329 # search ICU (non supported by Linux) 1330 if ( periph.ptype == 'ICU' ): 1331 print '[genmap warning] in linux_dts() : ICU peripheral not supported by LINUX' 1332 1333 # we need one interrupt controler in any cluster containing peripherals 1334 if ( (found_xcu == False) and (found_pic == False) and (len(cluster.periphs) > 0) ): 1335 print '[genmap error] in linux_dts() : No XCU/PIC in cluster(%d,%d)' % (x,y) 1336 sys.exit(1) 1337 1338 if ( found_pic == True ): irq_ctrl = pic 1339 else: irq_ctrl = xcu 1340 1341 # scan all periphs to find TTY and IOC in current cluster 1342 for periph in cluster.periphs: 1343 msb = periph.pseg.base >> 32 1344 lsb = periph.pseg.base & 0xFFFFFFFF 1345 size = periph.pseg.size 1346 1347 # search TTY (non replicated) 1348 if ( periph.ptype == 'TTY' ): 1349 1350 # get HWI index to XCU or PIC (only TTY channel 0 is used by Linux) 1351 hwi_id = 0xFFFFFFFF 1352 for irq in irq_ctrl.irqs: 1353 if ( (irq.isrtype == 'ISR_TTY_RX') and (irq.channel == 0) ): hwi_id = irq.srcid 1354 if ( hwi_id == 0xFFFFFFFF ): 1355 print '[genmap error] in linux.dts() IRQ_TTY_RX not found' 1356 sys.exit(1) 1357 1358 s += ' tty: tty {\n' 1359 s += ' compatible = "soclib, vci_multi_tty";\n' 1360 s += ' interrupt-parent = <&%s>;\n' % (irq_ctrl_name) 1361 s += ' interrupt = <%d>;\n' % hwi_id 1362 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1363 s += ' };\n\n' 1364 1365 # search IOC (non replicated) 1366 elif ( periph.ptype == 'IOC' ): 1367 1368 if ( periph.subtype == 'BDV' ): 1369 1370 # get irq line index associated to bdv 1371 hwi_id = 0xFFFFFFFF 1372 for irq in irq_ctrl.irqs: 1373 if ( irq.isrtype == 'ISR_BDV' ): hwi_id = irq.srcid 1374 if ( hwi_id == 0xFFFFFFFF ): 1375 print '[genmap error] in linux.dts() ISR_BDV not found' 1376 sys.exit(1) 1377 1378 s += ' bdv: bdv {\n' 1379 s += ' compatible = "soclib:vci_blockdevice";\n' 1380 s += ' interrupt-parent = <&%s>;\n' % (irq_ctrl_name) 1381 s += ' interrupt = <%d>;\n' % hwi_id 1382 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1383 s += ' };\n\n' 1384 1385 elif ( periph.subtype == 'HBA' ): 1386 1387 print '[genmap error] in linux_dts() : HBA peripheral not supported by LINUX' 1388 sys.exit(1) 1389 1390 elif ( periph.subtype == 'SPI' ): 1391 1392 print '[genmap error] in linux_dts() : SPI peripheral not supported by LINUX' 1393 sys.exit(1) 1394 1395 # other peripherals 1396 else: 1397 type = periph.ptype 1398 print '[genmap warning] in linux_dts() : %s peripheral not supported by LINUX' % (type) 1399 1400 # clocks 1401 s += ' /*** clocks ***/\n\n' 1402 s += ' clocks {\n' 1403 s += ' freq@50MHZ: freq@50MHZ {\n' 1404 s += ' #clock-cells = <0>;\n' 1405 s += ' compatible = "fixed-clock";\n' 1406 s += ' clock-frequency = <50000000>;\n' 1407 s += ' };\n' 1408 s += ' };\n\n' 1409 s += ' cpuclk {\n' 1410 s += ' compatible = "soclib, mips32_clksrc";\n' 1411 s += ' clocks = <&freq@50MHZ>;\n' 1412 s += ' };\n' 1413 s += '};\n' 1414 1415 return s 1416 # end linux_dts() 1417 1418 1419 ############################################################################# 1204 1420 def netbsd_dts( self ): # compute string for netbsd.dts file generation, 1205 1421 # used for netbsd configuration … … 1230 1446 s += ' };\n' 1231 1447 1232 # rams (for each cluster)1448 # physical memory banks (for each cluster) 1233 1449 for cluster in self.clusters: 1234 1450 for pseg in cluster.psegs: … … 1247 1463 # peripherals (for each cluster) 1248 1464 for cluster in self.clusters: 1465 x = cluster.x 1466 y = cluster.y 1249 1467 1250 1468 # research XCU component … … 1272 1490 s += ' out@%d {\n' % output_id 1273 1491 s += ' device_type = "soclib:xicu:filter";\n' 1274 s += ' irq 1492 s += ' irq = <&{/cpus/Mips,32@0x%x} %d>;\n' % (proc_id, itid) 1275 1493 s += ' output_line = <%d>;\n' % output_id 1276 s += ' parent 1494 s += ' parent = <&{/%s@0x%x}>;\n' % (periph.pseg.name, periph.pseg.base) 1277 1495 s += ' };\n' 1278 1496 … … 1297 1515 s += ' };\n' 1298 1516 1517 # at least one interrupt controller 1299 1518 if ( (found_xcu == False) and (found_pic == False) and (len(cluster.periphs) > 0) ): 1300 print '[genmap error] in netbsd_dts() : No XCU/PIC in cluster(%d,%d)' % ( cluster.x, cluster.y)1519 print '[genmap error] in netbsd_dts() : No XCU/PIC in cluster(%d,%d)' % (x,y) 1301 1520 sys.exit(1) 1302 1521 … … 1314 1533 1315 1534 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) 1316 s += ' device_type 1317 s += ' reg 1535 s += ' device_type = "soclib:dma";\n' 1536 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1318 1537 s += ' channel_count = <%d>;\n' % periph.channels 1319 1538 … … 1332 1551 s += ' device_type = "soclib:periph:irq";\n' 1333 1552 s += ' output_line = <%d>;\n' % channel 1334 s += ' irq 1335 s += ' parent 1553 s += ' irq = <&{/%s} %d>;\n' % (name, hwi_id) 1554 s += ' parent = <&{/%s@0x%x}>;\n' % (periph.pseg.name, periph.pseg.base) 1336 1555 s += ' };\n' 1337 1556 … … 1351 1570 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) 1352 1571 s += ' device_type = "soclib:mmc";\n' 1353 s += ' irq 1354 s += ' reg 1572 s += ' irq = <&{/%s@0x%x} %d>;\n' % (irq_tgt.pseg.name, irq_tgt.pseg.base, irq_in) 1573 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1355 1574 s += ' };\n' 1356 1575 … … 1358 1577 elif ( periph.ptype == 'FBF' ): 1359 1578 1360 s += ' %s@0x%x {\n' 1579 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) 1361 1580 s += ' device_type = "soclib:framebuffer";\n' 1362 1581 s += ' mode = <32>;\n' # bits par pixel … … 1379 1598 sys.exit(1) 1380 1599 1381 s += ' %s@0x%x {\n' 1600 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) 1382 1601 s += ' device_type = "soclib:blockdevice";\n' 1383 s += ' irq = <&{/%s@0x%x} %d>;\n' % (irq_tgt.pseg.name, irq_tgt.pseg.base,irq_in)1384 s += ' reg 1602 s += ' irq = <&{/%s@0x%x} %d>;\n' % (irq_tgt.pseg.name,irq_tgt.pseg.base,irq_in) 1603 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1385 1604 s += ' };\n' 1386 1605 … … 1401 1620 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) 1402 1621 s += ' device_type = "soclib:spi";\n' 1403 s += ' irq = <&{/%s@0x%x} %d>;\n' % (irq_tgt.pseg.name, irq_tgt.pseg.base,irq_in)1404 s += ' reg 1622 s += ' irq = <&{/%s@0x%x} %d>;\n' % (irq_tgt.pseg.name,irq_tgt.pseg.base,irq_in) 1623 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1405 1624 s += ' };\n' 1406 1625 … … 1408 1627 elif ( periph.ptype == 'ROM' ): 1409 1628 1410 s += ' %s@0x%x {\n' 1629 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) 1411 1630 s += ' device_type = "rom";\n' 1412 s += ' cached 1413 s += ' reg 1631 s += ' cached = <1>;\n' 1632 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1414 1633 s += ' };\n' 1415 1634 … … 1425 1644 elif ( periph.ptype == 'TTY' ): 1426 1645 1427 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) 1428 s += ' device_type = "soclib:tty";\n' 1429 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1646 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) 1647 s += ' device_type = "soclib:tty";\n' 1430 1648 s += ' channel_count = < %d >;\n' % periph.channels 1649 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1431 1650 1432 1651 # multi-channels : get HWI index (to XCU or PIC) for each channel … … 1444 1663 s += ' device_type = "soclib:periph:irq";\n' 1445 1664 s += ' output_line = <%d>;\n' % channel 1446 s += ' irq 1447 s += ' parent 1665 s += ' irq = <&{/%s} %d>;\n' % (name, hwi_id) 1666 s += ' parent = <&{/%s@0x%x}>;\n' % (periph.pseg.name, periph.pseg.base) 1448 1667 s += ' };\n' 1449 1668 … … 1525 1744 s += ' device_type = "soclib:periph:irq";\n' 1526 1745 s += ' output_line = <%d>;\n' % channel 1527 s += ' irq 1528 s += ' parent 1746 s += ' irq = <&{/%s} %d>;\n' % (name, hwi_id) 1747 s += ' parent = <&{/%s@0x%x}>;\n' % (periph.pseg.name, periph.pseg.base) 1529 1748 s += ' };\n' 1530 1749 … … 1570 1789 1571 1790 return s 1572 # end netbsd_dts( 1791 # end netbsd_dts() 1573 1792 1574 1793 ########################### … … 1583 1802 s += ' XMAX=%d\n' % self.x_size 1584 1803 s += ' YMAX=%d\n' % self.y_size 1585 s += ' CPU_NR=%d\n' % self. procs_max1804 s += ' CPU_NR=%d\n' % self.nprocs 1586 1805 s += '\n' 1587 1806 … … 1983 2202 psegname, 1984 2203 identity = False, 1985 local = False ): 2204 local = False, 2205 big = False ): 1986 2206 1987 2207 assert mode in VSEGMODES … … 1995 2215 self.psegname = psegname # name of pseg in destination cluster 1996 2216 self.identity = identity # identity mapping required 1997 self.local = local # one copy per cluster 2217 self.local = local # only mapped in local PTAB when true 2218 self.big = big # to be mapped in a big physical page 1998 2219 self.vobjs = [] 1999 2220 return … … 2006 2227 if ( self.identity ): s += ' ident="1"' 2007 2228 if ( self.local ): s += ' local="1"' 2229 if ( self.big ): s += ' big="1"' 2008 2230 s += ' >\n' 2009 2231 for vobj in self.vobjs: s += vobj.xml() … … 2057 2279 byte_stream += mapping.int2bytes( 4, len(self.vobjs) ) # number of vobjs in vseg 2058 2280 byte_stream += mapping.int2bytes( 4, vobj_id ) # first vobj global index 2059 byte_stream += mapping.int2bytes( 4, 0 ) # linked list of vsegs on samepseg2281 byte_stream += mapping.int2bytes( 4, 0 ) # linked list of vsegs on pseg 2060 2282 byte_stream += mapping.int2bytes( 1, 0 ) # mapped when non zero 2061 byte_stream += mapping.int2bytes( 1, self.identity ) # identity mapping whennon zero2062 byte_stream += mapping.int2bytes( 1, self.local ) # non shared if non zero2063 byte_stream += mapping.int2bytes( 1, 0 ) # reserved (padding)2283 byte_stream += mapping.int2bytes( 1, self.identity ) # identity mapping if non zero 2284 byte_stream += mapping.int2bytes( 1, self.local ) # only mapped in local PTAB 2285 byte_stream += mapping.int2bytes( 1, self.big ) # to be mapped in big physical page 2064 2286 2065 2287 if ( verbose ): … … 2137 2359 byte_stream += mapping.int2bytes( 4 , self.align ) # required alignment 2138 2360 byte_stream += mapping.int2bytes( 4 , 0 ) # virtual base address 2139 byte_stream += mapping.int2bytes( 8 , 0 ) # physical base address2140 2361 byte_stream += mapping.int2bytes( 4 , self.init ) # init value 2141 2362
Note: See TracChangeset
for help on using the changeset viewer.