Changeset 557 for soft/giet_vm/giet_boot
- Timestamp:
- Apr 13, 2015, 5:28:46 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_boot/boot.c
r552 r557 1413 1413 1414 1414 1415 /////////////////////////////////////////////////// 1416 void 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 1415 1471 ////////////////////////////////////////////////////////////////////////////////// 1416 1472 // This function load all loadable segments contained in the .elf file identified … … 1443 1499 1444 1500 #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", 1446 1502 x , y , p , pathname ); 1447 1503 #endif … … 1498 1554 (ptr->e_ident[EI_MAG3] != ELFMAG3) ) 1499 1555 { 1500 _printf("\n[BOOT ERROR] load_ elf() : file %s does not useELF format\n",1556 _printf("\n[BOOT ERROR] load_one_elf_file() : %s not ELF format\n", 1501 1557 pathname ); 1502 1558 _exit(); … … 1504 1560 1505 1561 #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() ); 1508 1564 #endif 1509 1565 … … 1580 1636 paddr_t seg_paddr = vseg[vseg_id].pbase; 1581 1637 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); 1585 1641 1586 1642 // check vseg size … … 1594 1650 1595 1651 // 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 1597 1653 if ( (cx == x) && (cy == y) ) 1598 1654 { 1599 if( NB_DMA_CHANNELS > 0)1655 if( USE_MWR_CPY ) 1600 1656 { 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 1606 1666 } 1607 1667 else … … 1610 1670 (paddr_t)src_vaddr, // source paddr 1611 1671 seg_filesz ); // size 1612 }1613 1672 #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" 1615 1674 " vaddr = %x / size = %x / paddr = %l\n", 1616 1675 x , y , p , seg_id , seg_vaddr , seg_memsz , seg_paddr ); 1617 1676 #endif 1677 } 1618 1678 } 1619 1679 }
Note: See TracChangeset
for help on using the changeset viewer.