Changeset 562


Ignore:
Timestamp:
Apr 15, 2015, 4:01:29 PM (9 years ago)
Author:
cfuguet
Message:

improve the platform's interrupt infrastructure description

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_python/mapping.py

    r560 r562  
    282282                periph,                # peripheral containing IRQ (PIC or XCU)
    283283                index,                 # peripheral input port index
     284                src,                   # interrupt source peripheral
    284285                isrtype,               # ISR type
    285286                channel = 0 ):         # channel for multi-channels ISR
     
    294295        irq.index = self.total_irqs
    295296        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)
    296304
    297305        return irq
     
    11711179        # to one or several drivers identified by ("major","minor")
    11721180
     1181        chosen_tty = False
    11731182        for cluster in self.clusters:
    11741183            x               = cluster.x
     
    11861195                    size = pseg.size
    11871196
    1188                     s += '  ram_%d_%d: ram@0x%x {\n' % (x, y, pseg.base)
     1197                    s += '  %s@0x%x {\n' % (pseg.name, pseg.base)
    11891198                    s += '    device_type = "memory";\n'
    11901199                    s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
     
    12001209                if ( (periph.ptype == 'XCU') ):
    12011210                    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)
    12061213                    s += '    compatible = "soclib,vci_xicu","soclib,vci_xicu_timer";\n'
    12071214                    s += '    interrupt-controller;\n'
     
    12141221                if ( periph.ptype == 'PIC' ):
    12151222                    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)
    12201225                    s += '    compatible = "soclib,vci_iopic";\n'
    12211226                    s += '    interrupt-controller;\n'
     
    12251230
    12261231            # 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
    12291234                 (len(cluster.periphs) > 0) ):
    12301235                print '[genmap error] in linux_dts()'
    12311236                print '    No XCU/PIC in cluster(%d,%d)' % (x,y)
    12321237                sys.exit(1)
    1233 
    1234             if ( found_pic == True ): irq_ctrl = pic
    1235             else:                     irq_ctrl = xcu
    12361238
    12371239            # scan all periphs to find TTY and IOC in current cluster
     
    12411243                size    = periph.pseg.size
    12421244
     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
    12431249                # search TTY (non replicated)
    1244                 if ( periph.ptype == 'TTY' ):
     1250                if periph.ptype == 'TTY':
     1251                    assert irq_ctrl != None
    12451252
    12461253                    # get HWI index to XCU or PIC (only TTY0 is used by Linux)
     
    12551262                        sys.exit(1)
    12561263
    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)
    12581269                    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)
    12601271                    s += '    interrupts = <%d>;\n' % hwi_id
    12611272                    s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
    12621273                    s += '  };\n\n'
    12631274
     1275
    12641276                # search IOC (non replicated)
    12651277                elif ( periph.ptype == 'IOC' ):
     1278                    assert irq_ctrl != None
    12661279
    12671280                    if ( periph.subtype == 'BDV' ):
     
    12771290                            sys.exit(1)
    12781291
    1279                         s += '  bdv: bdv@0x%x {\n' % (periph.pseg.base)
     1292                        s += '  %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base)
    12801293                        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)
    12821295                        s += '    interrupts = <%d>;\n' % hwi_id
    12831296                        s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
     
    12991312
    13001313        # clocks
    1301         s += '  /*** clocks ***/\n\n'
    13021314        s += '  clocks {\n'
    13031315        s += '    freq: freq@50MHZ {\n'
     
    13671379            y = cluster.y
    13681380
    1369             # research XCU component
     1381            # research XCU or PIC component
    13701382            found_xcu = False
     1383            found_pic = False
    13711384            for periph in cluster.periphs:
    13721385                if ( (periph.ptype == 'XCU') ):
     
    13801393                    s += '    device_type = "soclib:xicu:root";\n'
    13811394                    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
    13851398
    13861399                    output_id = 0            # output index from XCU
     
    14001413                    s += '  };\n'
    14011414
    1402             # research PIC component
    1403             found_pic = False
    1404             for periph in cluster.periphs:
    14051415                if ( periph.ptype == 'PIC' ):
    14061416                    found_pic = True
     
    14131423                    s += '    device_type = "soclib:pic:root";\n'
    14141424                    s += '    reg         = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
    1415                     s += '    input_lines = <%d>;\n'    % periph.channels
     1425                    s += '    input_lines = <%d>;\n' % periph.channels
    14161426                    s += '  };\n'
    14171427
     
    14221432                sys.exit(1)
    14231433
    1424             if ( found_pic == True ):  irq_tgt = pic
    1425             else:                      irq_tgt = xcu
    1426 
    14271434            # get all others peripherals in cluster
    14281435            for periph in cluster.periphs:
     
    14311438                size = periph.pseg.size
    14321439
     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
    14331448                # research DMA component
    1434                 if ( periph.ptype == 'DMA' ):
     1449                elif ( periph.ptype == 'DMA' ):
    14351450
    14361451                    s += '  %s@0x%x {\n'  % (periph.pseg.name, periph.pseg.base)
     
    14771492                    s += '  %s@0x%x {\n'  % (periph.pseg.name, periph.pseg.base)
    14781493                    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)
    14801495                    s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
    14811496                    s += '  };\n'
     
    14871502                    s += '    device_type = "soclib:framebuffer";\n'
    14881503                    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
    14911506                    s += '    reg         = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
    14921507                    s += '  };\n'
     
    14991514                        # get irq line index associated to bdv
    15001515                        irq_in = 0xFFFFFFFF
    1501                         for irq in irq_tgt.irqs:
     1516                        for irq in irq_ctrl.irqs:
    15021517                            if ( irq.isrtype == 'ISR_BDV' ): irq_in = irq.srcid
    15031518                        if ( irq_in == 0xFFFFFFFF ):
     
    15081523                        s += '  %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base)
    15091524                        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)
    15111526                        s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
    15121527                        s += '  };\n'
    15131528
    15141529                    elif ( periph.subtype == 'HBA' ):
     1530
    15151531                        print '[genmap error] in netbsd_dts()'
    15161532                        print '    HBA peripheral not supported by NetBSD'
    1517                         sys.exit(1)
    15181533
    15191534                    elif ( periph.subtype == 'SDC' ):
     
    15211536                        # get irq line index associated to sdc
    15221537                        irq_in = 0xFFFFFFFF
    1523                         for irq in irq_tgt.irqs:
     1538                        for irq in irq_ctrl.irqs:
    15241539                            if ( irq.isrtype == 'ISR_SDC' ): irq_in = irq.srcid
    15251540                        if ( irq_in == 0xFFFFFFFF ):
     
    15301545                        s += '  %s@0x%x {\n'  % (periph.pseg.name, periph.pseg.base)
    15311546                        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)
    15331548                        s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
    15341549                        s += '  };\n'
    15351550
    15361551                # research ROM component
    1537                 elif ( periph.ptype == 'ROM' ):
     1552                elif ( periph.ptype == 'ROM' ) or ( periph.ptype == 'DROM' ):
    15381553
    15391554                    s += '  %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base)
     
    15621577                    for channel in xrange( periph.channels ):
    15631578                        hwi_id = 0xFFFFFFFF
    1564                         for irq in irq_tgt.irqs:
     1579                        for irq in irq_ctrl.irqs:
    15651580                            if ( (irq.isrtype == 'ISR_TTY_RX') and (irq.channel == channel) ):
    15661581                                hwi_id = irq.srcid
     
    15701585                            sys.exit(1)
    15711586
    1572                         name = '%s@0x%x' % (irq_tgt.pseg.name, irq_tgt.pseg.base)
     1587                        name = '%s' % (irq_ctrl_name)
    15731588                        s += '    irq@%d{\n' % channel
    15741589                        s += '      device_type = "soclib:periph:irq";\n'
     
    16001615                    for channel in xrange( periph.channels ):
    16011616                        hwi_id = 0xFFFFFFFF
    1602                         for irq in irq_tgt.irqs:
     1617                        for irq in irq_ctrl.irqs:
    16031618                            if ( (irq.isrtype == 'ISR_NIC_RX') and (irq.channel == channel) ):
    16041619                                hwi_id = irq.srcid
     
    16081623                            sys.exit(1)
    16091624
    1610                         name = '%s@0x%x' % (irq_tgt.pseg.name, irq_tgt.pseg.base)
     1625                        name = '%s' % (irq_ctrl_name)
    16111626                        s += '    irq_rx@%d{\n' % channel
    16121627                        s += '      device_type = "soclib:periph:irq";\n'
     
    16171632
    16181633                        hwi_id = 0xFFFFFFFF
    1619                         for irq in irq_tgt.irqs:
     1634                        for irq in irq_ctrl.irqs:
    16201635                            if ( (irq.isrtype == 'ISR_NIC_TX') and (irq.channel == channel) ):
    16211636                                hwi_id = irq.srcid
     
    16251640                            sys.exit(1)
    16261641
    1627                         name = '%s@0x%x' % (irq_tgt.pseg.name, irq_tgt.pseg.base)
     1642                        name = '%s' % (irq_ctrl_name)
    16281643                        s += '    irq_tx@%d{\n' % channel
    16291644                        s += '      device_type = "soclib:periph:irq";\n'
     
    16461661                    for channel in xrange( periph.channels ):
    16471662                        hwi_id = 0xFFFFFFFF
    1648                         for irq in irq_tgt.irqs:
     1663                        for irq in irq_ctrl.irqs:
    16491664                            if ( (irq.isrtype == 'ISR_CMA') and (irq.channel == channel) ):
    16501665                                hwi_id = irq.srcid
     
    16551670                            sys.exit(1)
    16561671
    1657                         name = '%s@0x%x' % (irq_tgt.pseg.name, irq_tgt.pseg.base)
     1672                        name = '%s' % (irq_ctrl_name)
    16581673                        s += '    irq@%d{\n' % channel
    16591674                        s += '      device_type = "soclib:periph:irq";\n'
     
    16651680                    s += '  };\n'
    16661681
    1667                 # research TIM component
    1668                 elif ( periph.ptype == 'TIM' ):
     1682                else:
    16691683
    16701684                    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
    16801687
    16811688        # topology
     
    23422349        self.pseg     = pseg
    23432350        self.irqs     = []
     2351        self.irq_ctrl = None         # interrupt controller peripheral
    23442352        return
    23452353
Note: See TracChangeset for help on using the changeset viewer.