Changeset 524


Ignore:
Timestamp:
Mar 10, 2015, 3:24:01 PM (9 years ago)
Author:
alain
Message:

The boot.c file has been modified to comply with the removal
of the coproc and cp_ports objects in the mapping.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_boot/boot.c

    r513 r524  
    10371037            xcu = &periph[periph_id];
    10381038
    1039             if ( xcu->arg < (nprocs * header->irq_per_proc) )
     1039            if ( xcu->arg0 < (nprocs * header->irq_per_proc) )
    10401040            {
    10411041                _printf("\n[BOOT ERROR] Not enough inputs for XCU[%d,%d]\n", x, y );
     
    13671367void boot_mapping_init()
    13681368{
    1369     // desactivates IOC interrupt
    1370     _ioc_init( 0 );
    1371 
    13721369    // open file "map.bin"
    13731370    int fd_id = _fat_open( IOC_BOOT_MODE,
     
    14251422         (header->vspaces   > GIET_NB_VSPACE_MAX)    )
    14261423    {
     1424        _printf("\n[BOOT ERROR] Illegal mapping signature: %x\n", header->signature );
     1425        _exit();
     1426    }
    14271427
    14281428#if BOOT_DEBUG_MAPPING
     
    14451445}
    14461446#endif
    1447         _printf("\n[BOOT ERROR] Illegal mapping signature: %x\n", header->signature );
    1448         _exit();
    1449     }
    14501447
    14511448#if BOOT_DEBUG_MAPPING
     
    17401737
    17411738////////////////////////////////////////////////////////////////////////////////
    1742 // This function intializes the periherals and coprocessors, as specified
    1743 // in the mapping_info file.
     1739// This function intializes the external peripherals in cluster_io.
    17441740////////////////////////////////////////////////////////////////////////////////
    17451741void boot_peripherals_init()
     
    17481744    mapping_cluster_t * cluster = _get_cluster_base(header);
    17491745    mapping_periph_t * periph   = _get_periph_base(header);
    1750     mapping_vseg_t * vseg       = _get_vseg_base(header);
    1751     mapping_coproc_t * coproc   = _get_coproc_base(header);
    1752     mapping_cp_port_t * cp_port = _get_cp_port_base(header);
    17531746    mapping_irq_t * irq         = _get_irq_base(header);
    17541747
    1755     unsigned int cluster_id;
    17561748    unsigned int periph_id;
    1757     unsigned int coproc_id;
    1758     unsigned int cp_port_id;
    17591749    unsigned int channel_id;
    17601750
    1761     // loop on all physical clusters
    1762     for (cluster_id = 0; cluster_id < X_SIZE*Y_SIZE; cluster_id++)
    1763     {
    1764         // computes cluster coordinates
    1765         unsigned int x          = cluster[cluster_id].x;
    1766         unsigned int y          = cluster[cluster_id].y;
    1767         unsigned int cluster_xy = (x<<Y_WIDTH) + y;
    1768 
    17691751#if BOOT_DEBUG_PERI
    1770 _printf("\n[BOOT] Peripherals initialisation in cluster[%d,%d]\n", x , y );
    1771 #endif
    1772 
    1773         // loop on peripherals
    1774         for (periph_id = cluster[cluster_id].periph_offset;
    1775              periph_id < cluster[cluster_id].periph_offset +
    1776              cluster[cluster_id].periphs; periph_id++)
    1777         {
    1778             unsigned int type       = periph[periph_id].type;
    1779             unsigned int subtype    = periph[periph_id].subtype;
    1780             unsigned int channels   = periph[periph_id].channels;
    1781 
    1782             switch (type)
    1783             {
    1784                 case PERIPH_TYPE_IOC:    // vci_block_device component
     1752_printf("\n[BOOT] External peripherals initialisation in cluster[%d,%d]\n",
     1753        X_IO , Y_IO );
     1754#endif
     1755
     1756    // get pointer on cluster_io
     1757    mapping_cluster_t * cluster_io = &cluster[X_IO * Y_SIZE + Y_IO];
     1758
     1759    // loop on peripherals
     1760    for (periph_id = cluster_io->periph_offset;
     1761         periph_id < cluster_io->periph_offset + cluster_io->periphs;
     1762         periph_id++)
     1763    {
     1764        unsigned int type       = periph[periph_id].type;
     1765        unsigned int subtype    = periph[periph_id].subtype;
     1766        unsigned int channels   = periph[periph_id].channels;
     1767
     1768        switch (type)
     1769        {
     1770            case PERIPH_TYPE_IOC:    // vci_block_device component
     1771            {
     1772                if ( subtype == IOC_SUBTYPE_BDV )
    17851773                {
    1786                     if ( subtype == PERIPH_SUBTYPE_BDV )
    1787                     {
    1788                         _bdv_init();
    1789                     }
    1790                     else if ( subtype == PERIPH_SUBTYPE_HBA )
    1791                     {
    1792                         for (channel_id = 0; channel_id < channels; channel_id++)
    1793                             _hba_init( channel_id );
    1794                     }
    1795                     else if ( subtype == PERIPH_SUBTYPE_SPI )
    1796                     {
    1797                         //TODO
    1798                     }
    1799                     break;
     1774                    _bdv_init();
    18001775                }
    1801                 case PERIPH_TYPE_TTY:    // vci_multi_tty component
     1776                else if ( subtype == IOC_SUBTYPE_HBA )
    18021777                {
    18031778                    for (channel_id = 0; channel_id < channels; channel_id++)
    1804                     {
    1805                         _tty_init( channel_id );
    1806                     }
    1807                     break;
     1779                        _hba_init( channel_id );
    18081780                }
    1809                 case PERIPH_TYPE_NIC:    // vci_multi_nic component
     1781                else if ( subtype == IOC_SUBTYPE_SPI )
    18101782                {
    1811                     _nic_global_init( 1,      // broadcast accepted
    1812                                       1,      // bypass activated
    1813                                       0,      // tdm non activated
    1814                                       0 );    // tdm period
    1815                     break;
     1783                    //TODO
    18161784                }
    1817                 case PERIPH_TYPE_IOB:    // vci_io_bridge component
     1785                break;
     1786            }
     1787            case PERIPH_TYPE_TTY:    // vci_multi_tty component
     1788            {
     1789                for (channel_id = 0; channel_id < channels; channel_id++)
    18181790                {
    1819                     if (GIET_USE_IOMMU)
    1820                     {
    1821                         // TODO
    1822                         // get the iommu page table physical address
    1823                         // set IOMMU page table address
    1824                         // pseg_base[IOB_IOMMU_PTPR] = ptab_pbase;   
    1825                         // activate IOMMU
    1826                         // pseg_base[IOB_IOMMU_ACTIVE] = 1;       
    1827                     }
    1828                     break;
     1791                    _tty_init( channel_id );
    18291792                }
    1830                 case PERIPH_TYPE_PIC:    // vci_iopic component
     1793                break;
     1794            }
     1795            case PERIPH_TYPE_NIC:    // vci_multi_nic component
     1796            {
     1797                _nic_global_init( 1,      // broadcast accepted
     1798                                  1,      // bypass activated
     1799                                  0,      // tdm non activated
     1800                                  0 );    // tdm period
     1801                break;
     1802            }
     1803            case PERIPH_TYPE_IOB:    // vci_io_bridge component
     1804            {
     1805                if (GIET_USE_IOMMU)
    18311806                {
    1832                     // scan all IRQs defined in mapping for PIC component,
    1833                     // and initialises addresses for WTI IRQs
    1834                     for ( channel_id = periph[periph_id].irq_offset ;
    1835                           channel_id < periph[periph_id].irq_offset + periph[periph_id].irqs ;
    1836                           channel_id++ )
    1837                     {
    1838                         unsigned int hwi_id     = irq[channel_id].srcid;   // HWI index in PIC
    1839                         unsigned int wti_id     = irq[channel_id].dest_id; // WTI index in XCU
    1840                         unsigned int cluster_xy = irq[channel_id].dest_xy; // XCU coordinates
    1841                         unsigned int vaddr;
    1842 
    1843                         _xcu_get_wti_address( wti_id, &vaddr );
    1844                         _pic_init( hwi_id, vaddr, cluster_xy );
     1807                    // TODO
     1808                    // get the iommu page table physical address
     1809                    // set IOMMU page table address
     1810                    // pseg_base[IOB_IOMMU_PTPR] = ptab_pbase;   
     1811                    // activate IOMMU
     1812                    // pseg_base[IOB_IOMMU_ACTIVE] = 1;       
     1813                }
     1814                break;
     1815            }
     1816            case PERIPH_TYPE_PIC:    // vci_iopic component
     1817            {
     1818                // scan all IRQs defined in mapping for PIC component,
     1819                // and initialises addresses for WTI IRQs
     1820                for ( channel_id = periph[periph_id].irq_offset ;
     1821                      channel_id < periph[periph_id].irq_offset +
     1822                      periph[periph_id].irqs ; channel_id++ )
     1823                {
     1824                    unsigned int hwi_id     = irq[channel_id].srcid;   // HWI in PIC
     1825                    unsigned int wti_id     = irq[channel_id].dest_id; // WTI in XCU
     1826                    unsigned int cluster_xy = irq[channel_id].dest_xy; // XCU coordinates
     1827                    unsigned int vaddr;
     1828
     1829                    _xcu_get_wti_address( wti_id, &vaddr );
     1830                    _pic_init( hwi_id, vaddr, cluster_xy );
    18451831
    18461832#if BOOT_DEBUG_PERI
     
    18481834        hwi_id , wti_id , cluster_xy >> Y_WIDTH , cluster_xy & ((1<<Y_WIDTH)-1) );
    18491835#endif
    1850                     }
    1851                     break;
    18521836                }
    1853             }  // end switch periph type
    1854         }  // end for periphs
    1855 
    1856 #if BOOT_DEBUG_PERI
    1857 _printf("\n[BOOT] Coprocessors initialisation in cluster[%d,%d]\n", x , y );
    1858 #endif
    1859 
    1860         // loop on coprocessors
    1861         for ( coproc_id = cluster[cluster_id].coproc_offset;
    1862               coproc_id < cluster[cluster_id].coproc_offset +
    1863               cluster[cluster_id].coprocs; coproc_id++ )
    1864         {
    1865             // loop on the coprocessor ports
    1866             for ( cp_port_id = coproc[coproc_id].port_offset;
    1867                   cp_port_id < coproc[coproc_id].port_offset + coproc[coproc_id].ports;
    1868                   cp_port_id++ )
    1869             {
    1870                 // get global index of associted vseg
    1871                 unsigned int vseg_id   = cp_port[cp_port_id].mwmr_vseg_id;
    1872 
    1873                 // get MWMR channel base address
    1874                 page_table_t* ptab  = (page_table_t*)_ptabs_vaddr[0][x][y];
    1875                 unsigned int  vbase = vseg[vseg_id].vbase;
    1876                 unsigned int  ppn;
    1877                 unsigned int  flags;
    1878                 paddr_t       pbase;
    1879 
    1880                 _v2p_translate( ptab,
    1881                                 vbase>>12 ,
    1882                                 &ppn,
    1883                                 &flags );
    1884 
    1885                 pbase = ((paddr_t)ppn)<<12;
    1886 
    1887                 // initialise cp_port
    1888                 _mwr_hw_init( cluster_xy,
    1889                               cp_port_id,
    1890                               cp_port[cp_port_id].direction,
    1891                               pbase );
    1892 
    1893             } // end for cp_ports
    1894         } // end for coprocs
    1895     } // end for clusters
     1837                break;
     1838            }
     1839        }  // end switch periph type
     1840    } // end loop on peripherals
    18961841} // end boot_peripherals_init()
    18971842
     
    19531898void boot_init()
    19541899{
    1955     mapping_header_t*  header     = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
    1956     mapping_cluster_t* cluster    = _get_cluster_base(header);
    19571900
    19581901    unsigned int       gpid       = _get_procid();
     
    19601903    unsigned int       cy         = (gpid >> P_WIDTH) & ((1<<Y_WIDTH)-1);
    19611904    unsigned int       lpid       = gpid & ((1 << P_WIDTH) -1);
    1962     unsigned int       cluster_id = (cx * Y_SIZE) + cy;
    19631905
    19641906    // Phase ONE : only P[0][0][0] execute it
     
    19791921        // Load the map.bin file into memory
    19801922        boot_mapping_init();
     1923
     1924        mapping_header_t*  header     = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
     1925        mapping_cluster_t* cluster    = _get_cluster_base(header);
    19811926
    19821927        _printf("\n[BOOT] Mapping %s loaded at cycle %d\n",
     
    20702015            boot_elf_load();
    20712016        }
    2072 /* 
    2073         // Each processor P[x][y][0] checks sequencially its local page table
    2074         unsigned int seq_x;
    2075         unsigned int seq_y;
    2076         for ( seq_x = 0 ; seq_x < X_SIZE ; seq_x++ )
    2077         {
    2078             for ( seq_y = 0 ; seq_y < Y_SIZE ; seq_y++ )
    2079             {
    2080                 if ( (cx == seq_x) && (cy == seq_y) ) boot_ptab_check( cx , cy );
    2081                
    2082                 //////////////////////////////////////////////
    2083                 _simple_barrier_wait( &_barrier_all_clusters );
    2084                 //////////////////////////////////////////////
    2085             }
    2086         }
    2087 */         
     2017
    20882018        //////////////////////////////////////////////
    20892019        _simple_barrier_wait( &_barrier_all_clusters );
     
    20912021       
    20922022        // each processor P[x][y][0] wake up other processors in same cluster
    2093         unsigned int cluster_xy = (cx << Y_WIDTH) + cy;
     2023        mapping_header_t*  header     = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
     2024        mapping_cluster_t* cluster    = _get_cluster_base(header);
     2025        unsigned int       cluster_xy = (cx << Y_WIDTH) + cy;
     2026        unsigned int       cluster_id = (cx * Y_SIZE) + cy;
    20942027        unsigned int p;
    20952028        for ( p = 1 ; p < cluster[cluster_id].procs ; p++ )
Note: See TracChangeset for help on using the changeset viewer.