Changeset 562 for soft/giet_vm
- Timestamp:
- Apr 15, 2015, 4:01:29 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_python/mapping.py
r560 r562 282 282 periph, # peripheral containing IRQ (PIC or XCU) 283 283 index, # peripheral input port index 284 src, # interrupt source peripheral 284 285 isrtype, # ISR type 285 286 channel = 0 ): # channel for multi-channels ISR … … 294 295 irq.index = self.total_irqs 295 296 self.total_irqs += 1 297 298 # pointer from the source to the interrupt controller peripheral 299 if src.irq_ctrl == None: src.irq_ctrl = periph 300 if src.irq_ctrl != periph: 301 print '[genmap error] in addIrq():' 302 print ' two different interrupt controller for the same peripheral' 303 sys.exit(1) 296 304 297 305 return irq … … 1171 1179 # to one or several drivers identified by ("major","minor") 1172 1180 1181 chosen_tty = False 1173 1182 for cluster in self.clusters: 1174 1183 x = cluster.x … … 1186 1195 size = pseg.size 1187 1196 1188 s += ' ram_%d_%d: ram@0x%x {\n' % (x, y, pseg.base)1197 s += ' %s@0x%x {\n' % (pseg.name, pseg.base) 1189 1198 s += ' device_type = "memory";\n' 1190 1199 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) … … 1200 1209 if ( (periph.ptype == 'XCU') ): 1201 1210 found_xcu = True 1202 xcu = periph 1203 irq_ctrl_name = 'xcu_%d_%d' % (x, y) 1204 1205 s += ' %s: xcu@0x%x {\n' % (irq_ctrl_name, periph.pseg.base) 1211 1212 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) 1206 1213 s += ' compatible = "soclib,vci_xicu","soclib,vci_xicu_timer";\n' 1207 1214 s += ' interrupt-controller;\n' … … 1214 1221 if ( periph.ptype == 'PIC' ): 1215 1222 found_pic = True 1216 pic = periph 1217 irq_ctrl_name = 'pic' 1218 1219 s += ' %s: pic@0x%x {\n' % (irq_ctrl_name, periph.pseg.base) 1223 1224 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) 1220 1225 s += ' compatible = "soclib,vci_iopic";\n' 1221 1226 s += ' interrupt-controller;\n' … … 1225 1230 1226 1231 # we need one interrupt controler in any cluster containing peripherals 1227 if ( (found_xcu == False) and 1228 (found_pic == False) and 1232 if ( (found_xcu == False) and 1233 (found_pic == False) and 1229 1234 (len(cluster.periphs) > 0) ): 1230 1235 print '[genmap error] in linux_dts()' 1231 1236 print ' No XCU/PIC in cluster(%d,%d)' % (x,y) 1232 1237 sys.exit(1) 1233 1234 if ( found_pic == True ): irq_ctrl = pic1235 else: irq_ctrl = xcu1236 1238 1237 1239 # scan all periphs to find TTY and IOC in current cluster … … 1241 1243 size = periph.pseg.size 1242 1244 1245 irq_ctrl = periph.irq_ctrl 1246 if irq_ctrl != None: 1247 irq_ctrl_name = '%s@0x%x' % (irq_ctrl.pseg.name, irq_ctrl.pseg.base) 1248 1243 1249 # search TTY (non replicated) 1244 if ( periph.ptype == 'TTY' ): 1250 if periph.ptype == 'TTY': 1251 assert irq_ctrl != None 1245 1252 1246 1253 # get HWI index to XCU or PIC (only TTY0 is used by Linux) … … 1255 1262 sys.exit(1) 1256 1263 1257 s += ' tty: tty@0x%x {\n' % (periph.pseg.base) 1264 if chosen_tty == False: 1265 chosen_tty = True 1266 s += ' tty:\n' 1267 1268 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) 1258 1269 s += ' compatible = "soclib,vci_multi_tty";\n' 1259 s += ' interrupt-parent = <& %s>;\n' % (irq_ctrl_name)1270 s += ' interrupt-parent = <&{/%s}>;\n' % (irq_ctrl_name) 1260 1271 s += ' interrupts = <%d>;\n' % hwi_id 1261 1272 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1262 1273 s += ' };\n\n' 1263 1274 1275 1264 1276 # search IOC (non replicated) 1265 1277 elif ( periph.ptype == 'IOC' ): 1278 assert irq_ctrl != None 1266 1279 1267 1280 if ( periph.subtype == 'BDV' ): … … 1277 1290 sys.exit(1) 1278 1291 1279 s += ' bdv: bdv@0x%x {\n' % (periph.pseg.base)1292 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) 1280 1293 s += ' compatible = "tsar,vci_block_device";\n' 1281 s += ' interrupt-parent = <& %s>;\n' % (irq_ctrl_name)1294 s += ' interrupt-parent = <&{/%s}>;\n' % (irq_ctrl_name) 1282 1295 s += ' interrupts = <%d>;\n' % hwi_id 1283 1296 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) … … 1299 1312 1300 1313 # clocks 1301 s += ' /*** clocks ***/\n\n'1302 1314 s += ' clocks {\n' 1303 1315 s += ' freq: freq@50MHZ {\n' … … 1367 1379 y = cluster.y 1368 1380 1369 # research XCU component1381 # research XCU or PIC component 1370 1382 found_xcu = False 1383 found_pic = False 1371 1384 for periph in cluster.periphs: 1372 1385 if ( (periph.ptype == 'XCU') ): … … 1380 1393 s += ' device_type = "soclib:xicu:root";\n' 1381 1394 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb,lsb,size) 1382 s += ' input_lines = <%d>;\n' % periph.arg 1383 s += ' ipis = <%d>;\n' % periph.arg 1384 s += ' timers = <%d>;\n' % periph.arg 1395 s += ' input_lines = <%d>;\n' % periph.arg0 1396 s += ' ipis = <%d>;\n' % periph.arg1 1397 s += ' timers = <%d>;\n' % periph.arg2 1385 1398 1386 1399 output_id = 0 # output index from XCU … … 1400 1413 s += ' };\n' 1401 1414 1402 # research PIC component1403 found_pic = False1404 for periph in cluster.periphs:1405 1415 if ( periph.ptype == 'PIC' ): 1406 1416 found_pic = True … … 1413 1423 s += ' device_type = "soclib:pic:root";\n' 1414 1424 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1415 s += ' input_lines = <%d>;\n' 1425 s += ' input_lines = <%d>;\n' % periph.channels 1416 1426 s += ' };\n' 1417 1427 … … 1422 1432 sys.exit(1) 1423 1433 1424 if ( found_pic == True ): irq_tgt = pic1425 else: irq_tgt = xcu1426 1427 1434 # get all others peripherals in cluster 1428 1435 for periph in cluster.periphs: … … 1431 1438 size = periph.pseg.size 1432 1439 1440 irq_ctrl = periph.irq_ctrl 1441 if irq_ctrl != None: 1442 irq_ctrl_name = '%s@0x%x' % (irq_ctrl.pseg.name, irq_ctrl.pseg.base) 1443 1444 # XCU or PIC have been already parsed 1445 if ( periph.ptype == 'XCU' ) or ( periph.ptype == 'PIC' ): 1446 pass 1447 1433 1448 # research DMA component 1434 if ( periph.ptype == 'DMA' ):1449 elif ( periph.ptype == 'DMA' ): 1435 1450 1436 1451 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) … … 1477 1492 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) 1478 1493 s += ' device_type = "soclib:mmc";\n' 1479 s += ' irq = <&{/%s @0x%x} %d>;\n' % (irq_tgt.pseg.name, irq_tgt.pseg.base, irq_in)1494 s += ' irq = <&{/%s} %d>;\n' % (irq_ctrl_name, irq_in) 1480 1495 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1481 1496 s += ' };\n' … … 1487 1502 s += ' device_type = "soclib:framebuffer";\n' 1488 1503 s += ' mode = <32>;\n' # bits par pixel 1489 s += ' width = <%d>;\n' % periph.arg 1490 s += ' height = <%d>;\n' % periph.arg 1504 s += ' width = <%d>;\n' % periph.arg0 1505 s += ' height = <%d>;\n' % periph.arg1 1491 1506 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1492 1507 s += ' };\n' … … 1499 1514 # get irq line index associated to bdv 1500 1515 irq_in = 0xFFFFFFFF 1501 for irq in irq_ tgt.irqs:1516 for irq in irq_ctrl.irqs: 1502 1517 if ( irq.isrtype == 'ISR_BDV' ): irq_in = irq.srcid 1503 1518 if ( irq_in == 0xFFFFFFFF ): … … 1508 1523 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) 1509 1524 s += ' device_type = "soclib:blockdevice";\n' 1510 s += ' irq = <&{/%s @0x%x} %d>;\n' % (irq_tgt.pseg.name,irq_tgt.pseg.base,irq_in)1525 s += ' irq = <&{/%s} %d>;\n' % (irq_ctrl_name, irq_in) 1511 1526 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1512 1527 s += ' };\n' 1513 1528 1514 1529 elif ( periph.subtype == 'HBA' ): 1530 1515 1531 print '[genmap error] in netbsd_dts()' 1516 1532 print ' HBA peripheral not supported by NetBSD' 1517 sys.exit(1)1518 1533 1519 1534 elif ( periph.subtype == 'SDC' ): … … 1521 1536 # get irq line index associated to sdc 1522 1537 irq_in = 0xFFFFFFFF 1523 for irq in irq_ tgt.irqs:1538 for irq in irq_ctrl.irqs: 1524 1539 if ( irq.isrtype == 'ISR_SDC' ): irq_in = irq.srcid 1525 1540 if ( irq_in == 0xFFFFFFFF ): … … 1530 1545 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) 1531 1546 s += ' device_type = "soclib:sdc";\n' 1532 s += ' irq = <&{/%s @0x%x} %d>;\n' % (irq_tgt.pseg.name,irq_tgt.pseg.base,irq_in)1547 s += ' irq = <&{/%s} %d>;\n' % (irq_ctrl_name, irq_in) 1533 1548 s += ' reg = <0x%x 0x%x 0x%x>;\n' % (msb, lsb, size) 1534 1549 s += ' };\n' 1535 1550 1536 1551 # research ROM component 1537 elif ( periph.ptype == 'ROM' ) :1552 elif ( periph.ptype == 'ROM' ) or ( periph.ptype == 'DROM' ): 1538 1553 1539 1554 s += ' %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base) … … 1562 1577 for channel in xrange( periph.channels ): 1563 1578 hwi_id = 0xFFFFFFFF 1564 for irq in irq_ tgt.irqs:1579 for irq in irq_ctrl.irqs: 1565 1580 if ( (irq.isrtype == 'ISR_TTY_RX') and (irq.channel == channel) ): 1566 1581 hwi_id = irq.srcid … … 1570 1585 sys.exit(1) 1571 1586 1572 name = '%s @0x%x' % (irq_tgt.pseg.name, irq_tgt.pseg.base)1587 name = '%s' % (irq_ctrl_name) 1573 1588 s += ' irq@%d{\n' % channel 1574 1589 s += ' device_type = "soclib:periph:irq";\n' … … 1600 1615 for channel in xrange( periph.channels ): 1601 1616 hwi_id = 0xFFFFFFFF 1602 for irq in irq_ tgt.irqs:1617 for irq in irq_ctrl.irqs: 1603 1618 if ( (irq.isrtype == 'ISR_NIC_RX') and (irq.channel == channel) ): 1604 1619 hwi_id = irq.srcid … … 1608 1623 sys.exit(1) 1609 1624 1610 name = '%s @0x%x' % (irq_tgt.pseg.name, irq_tgt.pseg.base)1625 name = '%s' % (irq_ctrl_name) 1611 1626 s += ' irq_rx@%d{\n' % channel 1612 1627 s += ' device_type = "soclib:periph:irq";\n' … … 1617 1632 1618 1633 hwi_id = 0xFFFFFFFF 1619 for irq in irq_ tgt.irqs:1634 for irq in irq_ctrl.irqs: 1620 1635 if ( (irq.isrtype == 'ISR_NIC_TX') and (irq.channel == channel) ): 1621 1636 hwi_id = irq.srcid … … 1625 1640 sys.exit(1) 1626 1641 1627 name = '%s @0x%x' % (irq_tgt.pseg.name, irq_tgt.pseg.base)1642 name = '%s' % (irq_ctrl_name) 1628 1643 s += ' irq_tx@%d{\n' % channel 1629 1644 s += ' device_type = "soclib:periph:irq";\n' … … 1646 1661 for channel in xrange( periph.channels ): 1647 1662 hwi_id = 0xFFFFFFFF 1648 for irq in irq_ tgt.irqs:1663 for irq in irq_ctrl.irqs: 1649 1664 if ( (irq.isrtype == 'ISR_CMA') and (irq.channel == channel) ): 1650 1665 hwi_id = irq.srcid … … 1655 1670 sys.exit(1) 1656 1671 1657 name = '%s @0x%x' % (irq_tgt.pseg.name, irq_tgt.pseg.base)1672 name = '%s' % (irq_ctrl_name) 1658 1673 s += ' irq@%d{\n' % channel 1659 1674 s += ' device_type = "soclib:periph:irq";\n' … … 1665 1680 s += ' };\n' 1666 1681 1667 # research TIM component 1668 elif ( periph.ptype == 'TIM' ): 1682 else: 1669 1683 1670 1684 print '[genmap error] in netbsd_dts()' 1671 print ' TIM peripheral not supported by NetBSD' 1672 sys.exit(1) 1673 1674 # research MWR component 1675 elif ( periph.ptype == 'MWR' ): 1676 1677 print '[genmap error] in netbsd_dts()' 1678 print ' MWR peripheral not supported by NetBSD' 1679 sys.exit(1) 1685 print ' %s peripheral not supported by NetBSD' % periph.ptype 1686 1680 1687 1681 1688 # topology … … 2342 2349 self.pseg = pseg 2343 2350 self.irqs = [] 2351 self.irq_ctrl = None # interrupt controller peripheral 2344 2352 return 2345 2353
Note: See TracChangeset
for help on using the changeset viewer.