Changeset 557 for soft/giet_vm/giet_boot


Ignore:
Timestamp:
Apr 13, 2015, 5:28:46 PM (9 years ago)
Author:
alain
Message:

Update the GIET-VM bootloader to use distributed MWR_CPY coprocessor
that replace the MULTI_DMA in the tsar_generic_iob platform.

File:
1 edited

Legend:

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

    r552 r557  
    14131413
    14141414
     1415///////////////////////////////////////////////////
     1416void boot_dma_copy( unsigned int        cluster_xy,     
     1417                    unsigned long long  dst_paddr,
     1418                    unsigned long long  src_paddr,
     1419                    unsigned int        size )   
     1420{
     1421    // size must be multiple of 64 bytes
     1422    if ( size & 0x3F ) size = (size & (~0x3F)) + 0x40;
     1423
     1424    unsigned int mode = MODE_DMA_NO_IRQ;
     1425
     1426    unsigned int src     = 0;
     1427    unsigned int src_lsb = (unsigned int)src_paddr;
     1428    unsigned int src_msb = (unsigned int)(src_paddr>>32);
     1429   
     1430    unsigned int dst     = 1;
     1431    unsigned int dst_lsb = (unsigned int)dst_paddr;
     1432    unsigned int dst_msb = (unsigned int)(dst_paddr>>32);
     1433
     1434    // initializes src channel
     1435    _mwr_set_channel_register( cluster_xy , src , MWR_CHANNEL_MODE       , mode );
     1436    _mwr_set_channel_register( cluster_xy , src , MWR_CHANNEL_SIZE       , size );
     1437    _mwr_set_channel_register( cluster_xy , src , MWR_CHANNEL_BUFFER_LSB , src_lsb );
     1438    _mwr_set_channel_register( cluster_xy , src , MWR_CHANNEL_BUFFER_MSB , src_msb );
     1439    _mwr_set_channel_register( cluster_xy , src , MWR_CHANNEL_RUNNING    , 1 );
     1440
     1441    // initializes dst channel
     1442    _mwr_set_channel_register( cluster_xy , dst , MWR_CHANNEL_MODE       , mode );
     1443    _mwr_set_channel_register( cluster_xy , dst , MWR_CHANNEL_SIZE       , size );
     1444    _mwr_set_channel_register( cluster_xy , dst , MWR_CHANNEL_BUFFER_LSB , dst_lsb );
     1445    _mwr_set_channel_register( cluster_xy , dst , MWR_CHANNEL_BUFFER_MSB , dst_msb );
     1446    _mwr_set_channel_register( cluster_xy , dst , MWR_CHANNEL_RUNNING    , 1 );
     1447
     1448    // start CPY coprocessor (write non-zero value into config register)
     1449    _mwr_set_coproc_register( cluster_xy, 0 , 1 );
     1450
     1451    // poll dst channel status register to detect completion
     1452    unsigned int status;
     1453    do
     1454    {
     1455        status = _mwr_get_channel_register( cluster_xy , dst , MWR_CHANNEL_STATUS );
     1456    } while ( status == MWR_CHANNEL_BUSY );
     1457
     1458    if ( status )
     1459    {
     1460        _printf("\n[BOOT ERROR] in boot_dma_copy()\n");
     1461        _exit();
     1462    } 
     1463 
     1464    // stop CPY coprocessor and DMA channels
     1465    _mwr_set_channel_register( cluster_xy , src , MWR_CHANNEL_RUNNING    , 0 );
     1466    _mwr_set_channel_register( cluster_xy , dst , MWR_CHANNEL_RUNNING    , 0 );
     1467    _mwr_set_coproc_register ( cluster_xy , 0 , 0 );
     1468
     1469}  // end boot_dma_copy()
     1470
    14151471//////////////////////////////////////////////////////////////////////////////////
    14161472// This function load all loadable segments contained in the .elf file identified
     
    14431499
    14441500#if BOOT_DEBUG_ELF
    1445 _printf("\n[DEBUG BOOT_ELF] P[%d,%d,%d] enters load_one_elf_file() : %s\n",
     1501_printf("\n[DEBUG BOOT_ELF] load_one_elf_file() : P[%d,%d,%d] enters for %s\n",
    14461502        x , y , p , pathname );
    14471503#endif
     
    14981554             (ptr->e_ident[EI_MAG3] != ELFMAG3) )
    14991555        {
    1500             _printf("\n[BOOT ERROR] load_elf() : file %s does not use ELF format\n",
     1556            _printf("\n[BOOT ERROR] load_one_elf_file() : %s not ELF format\n",
    15011557                    pathname );
    15021558            _exit();
     
    15041560
    15051561#if BOOT_DEBUG_ELF
    1506 _printf("\n[DEBUG BOOT_ELF] P[%d,%d,%d] load file %s\n",
    1507         x , y , p , pathname );
     1562_printf("\n[DEBUG BOOT_ELF] load_one_elf_file() : P[%d,%d,%d] load %s at cycle %d\n",
     1563        x , y , p , pathname , _get_proctime() );
    15081564#endif
    15091565
     
    15801636                    paddr_t      seg_paddr  = vseg[vseg_id].pbase;
    15811637                    unsigned int seg_size   = vseg[vseg_id].length;
    1582                     unsigned int extend    = (unsigned int)(seg_paddr>>32);
    1583                     unsigned int cx         = extend >> Y_WIDTH;
    1584                     unsigned int cy         = extend & ((1<<Y_WIDTH)-1);
     1638                    unsigned int cluster_xy = (unsigned int)(seg_paddr>>32);
     1639                    unsigned int cx         = cluster_xy >> Y_WIDTH;
     1640                    unsigned int cy         = cluster_xy & ((1<<Y_WIDTH)-1);
    15851641
    15861642                    // check vseg size
     
    15941650
    15951651                    // P[x,y,0] copy the segment from boot buffer in cluster[0,0]
    1596                     // to destination buffer in cluster[x,y],
     1652                    // to destination buffer in cluster[x,y], using DMA if available
    15971653                    if ( (cx == x) && (cy == y) )
    15981654                    {
    1599                         if( NB_DMA_CHANNELS > 0 )
     1655                        if( USE_MWR_CPY )
    16001656                        {
    1601                             _dma_physical_copy( extend,    // DMA in cluster[x,y]       
    1602                                                 0,         // DMA channel 0
    1603                                                 seg_paddr,
    1604                                                 (paddr_t)src_vaddr,
    1605                                                 seg_filesz );   
     1657                            boot_dma_copy( cluster_xy,  // DMA in cluster[x,y]       
     1658                                           seg_paddr,
     1659                                           (paddr_t)src_vaddr,
     1660                                           seg_filesz );   
     1661#if BOOT_DEBUG_ELF
     1662_printf("\n[DEBUG BOOT_ELF] load_one_elf_file() : DMA[%d,%d] copy segment %d :\n"
     1663        "  vaddr = %x / size = %x / paddr = %l\n",
     1664        x , y , seg_id , seg_vaddr , seg_memsz , seg_paddr );
     1665#endif
    16061666                        }
    16071667                        else
     
    16101670                                              (paddr_t)src_vaddr,   // source paddr
    16111671                                              seg_filesz );         // size
    1612                         }
    16131672#if BOOT_DEBUG_ELF
    1614 _printf("\n[DEBUG BOOT_ELF] P[%d,%d,%d] copy segment %d :\n"
     1673_printf("\n[DEBUG BOOT_ELF] load_one_elf_file() : P[%d,%d,%d] copy segment %d :\n"
    16151674        "  vaddr = %x / size = %x / paddr = %l\n",
    16161675        x , y , p , seg_id , seg_vaddr , seg_memsz , seg_paddr );
    16171676#endif
     1677                        }
    16181678                    }
    16191679                }
Note: See TracChangeset for help on using the changeset viewer.