Changeset 188 for trunk/tools/bootloader_tsar
- Timestamp:
- Jul 12, 2017, 8:12:41 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/bootloader_tsar/boot.c
r68 r188 394 394 } 395 395 396 /////////////////////////////////////////////////// 396 397 // loop on arch-info peripherals in io_cluster, 397 398 // to initialize the boot_info array of external peripherals … … 399 400 #if DEBUG_BOOT_INFO 400 401 boot_printf("\n[BOOT INFO] %s : external peripherals at cycle %d\n", 401 __FUNCTION__ , cxy ,boot_get_proctime() );402 __FUNCTION__ , boot_get_proctime() ); 402 403 #endif 403 404 … … 407 408 device++ ) 408 409 { 409 // initialise one entry for each external peripheral 410 if( device_id >= CONFIG_MAX_EXT_DEV ) 411 { 412 boot_printf("\n[ERROR] in %s : too much external devices in arch_info\n", 413 __FUNCTION__ ); 414 boot_exit(); 415 } 416 417 // keep only external devices 410 418 if( (device->type != DEV_TYPE_RAM_SCL) && 411 419 (device->type != DEV_TYPE_ICU_XCU) && … … 433 441 } 434 442 435 // Initialize array of irq descriptors for PIC443 // handle IRQs for PIC 436 444 if (device->type == DEV_TYPE_PIC_TSR) 437 445 { 438 for (irq_id = 0; irq_id < CONFIG_MAX_ IRQS_PER_PIC; irq_id++)446 for (irq_id = 0; irq_id < CONFIG_MAX_EXTERNAL_IRQS ; irq_id++) 439 447 { 440 448 boot_dev->irq[irq_id].valid = 0; … … 465 473 466 474 #if DEBUG_BOOT_INFO 467 boot_printf("\n[BOOT INFO] %s : cores in cluster %x\n", __FUNCTION__ ); 468 #endif 469 475 boot_printf("\n[BOOT INFO] %s : cores in cluster %x\n", __FUNCTION__ , cxy ); 476 #endif 477 478 //////////////////////////////////////// 470 479 // Initialize array of core descriptors 471 480 core_id = 0; … … 488 497 boot_info->cores_nr = core_id; 489 498 490 // initialise internal devices (RAM, XCU, MMC, DMA)491 // set default values, then scan all local devices499 ////////////////////////////////////////////////////////////////////// 500 // initialise boot_info array of internal devices (RAM, ICU, MMC, DMA) 492 501 493 502 #if DEBUG_BOOT_INFO 494 boot_printf("\n[BOOT INFO] %s : internal peripherals in cluster %x\n", __FUNCTION__ ); 495 #endif 496 497 boot_info->pages_nr = 0; 498 boot_info->dev_icu.channels = 0; 499 boot_info->dev_mmc.channels = 0; 500 boot_info->dev_dma.channels = 0; 501 503 boot_printf("\n[BOOT INFO] %s : internal peripherals in cluster %x\n", __FUNCTION__ , cxy ); 504 #endif 505 506 device_id = 0; 502 507 for (device = &device_base[my_cluster->device_offset]; 503 508 device < &device_base[my_cluster->device_offset + my_cluster->devices]; 504 509 device++ ) 505 510 { 506 if (device->type == DEV_TYPE_RAM_SCL) 511 // keep only internal devices 512 if( (device->type == DEV_TYPE_RAM_SCL) || 513 (device->type == DEV_TYPE_ICU_XCU) || 514 (device->type == DEV_TYPE_MMC_TSR) || 515 (device->type == DEV_TYPE_DMA_SCL) ) 507 516 { 508 // set number of physical memory pages 509 boot_info->pages_nr = device->size >> CONFIG_PPM_PAGE_SHIFT; 517 if (device->type == DEV_TYPE_RAM_SCL) // RAM 518 { 519 // set number of physical memory pages 520 boot_info->pages_nr = device->size >> CONFIG_PPM_PAGE_SHIFT; 510 521 511 522 #if DEBUG_BOOT_INFO 512 523 boot_printf(" - RAM : %x pages\n", boot_info->pages_nr ); 513 524 #endif 514 } 515 else if (device->type == DEV_TYPE_ICU_XCU) 516 { 517 boot_dev = &boot_info->dev_icu; 518 519 boot_dev->type = device->type; 520 boot_dev->base = device->base; 521 boot_dev->channels = device->channels; 522 boot_dev->param0 = device->arg0; 523 boot_dev->param1 = device->arg1; 524 boot_dev->param2 = device->arg2; 525 boot_dev->param3 = device->arg3; 526 boot_dev->irqs = device->irqs; 525 } 526 else // ICU / MMC / DMA 527 { 528 if( device_id >= CONFIG_MAX_INT_DEV ) 529 { 530 boot_printf("\n[ERROR] in %s : too much internal devices in cluster %x\n", 531 __FUNCTION__ , cxy ); 532 boot_exit(); 533 } 534 535 boot_dev = &boot_info->int_dev[device_id]; 536 537 boot_dev->type = device->type; 538 boot_dev->base = device->base; 539 boot_dev->channels = device->channels; 540 boot_dev->param0 = device->arg0; 541 boot_dev->param1 = device->arg1; 542 boot_dev->param2 = device->arg2; 543 boot_dev->param3 = device->arg3; 544 boot_dev->irqs = device->irqs; 545 546 device_id++; 527 547 528 548 #if DEBUG_BOOT_INFO 529 boot_printf(" - XCU : base = %l / size = %l / channels = %d / irqs = %d\n", 530 device->base , device->size , device->channels , device->irqs ); 531 #endif 532 533 for (irq_id = 0; irq_id < CONFIG_MAX_HWIS_PER_ICU; irq_id++) 534 { 535 boot_dev->irq[irq_id].valid = 0; 536 } 537 538 for (irq = &irq_base[device->irq_offset]; 539 irq < &irq_base[device->irq_offset + device->irqs]; 540 irq++) 541 { 542 boot_dev->irq[irq->port].valid = 1; 543 boot_dev->irq[irq->port].dev_type = irq->dev_type; 544 boot_dev->irq[irq->port].channel = irq->channel; 545 boot_dev->irq[irq->port].is_rx = irq->is_rx; 549 boot_printf(" - %s : base = %l / size = %l / channels = %d / irqs = %d\n", 550 device_type_str( device->type ) , device->base , device->size , 551 device->channels , device->irqs ); 552 #endif 553 554 // handle IRQs for ICU 555 if (device->type == DEV_TYPE_ICU_XCU) 556 { 557 for (irq_id = 0; irq_id < CONFIG_MAX_INTERNAL_IRQS ; irq_id++) 558 { 559 boot_dev->irq[irq_id].valid = 0; 560 } 561 562 for (irq = &irq_base[device->irq_offset]; 563 irq < &irq_base[device->irq_offset + device->irqs] ; irq++) 564 { 565 boot_dev->irq[irq->port].valid = 1; 566 boot_dev->irq[irq->port].dev_type = irq->dev_type; 567 boot_dev->irq[irq->port].channel = irq->channel; 568 boot_dev->irq[irq->port].is_rx = irq->is_rx; 546 569 547 570 #if DEBUG_BOOT_INFO … … 550 573 #endif 551 574 575 } 576 } 552 577 } 553 578 } 554 else if( device->type == DEV_TYPE_MMC_TSR )555 {556 boot_dev = &boot_info->dev_mmc;557 558 boot_dev->type = device->type;559 boot_dev->base = device->base;560 boot_dev->channels = device->channels;561 boot_dev->irqs = 0;562 563 #if DEBUG_BOOT_INFO564 boot_printf(" - MMC : base = %l / size = %l / channels = %d / irqs = %d\n",565 device->base , device->size , device->channels , device->irqs );566 #endif567 }568 else if( device->type == DEV_TYPE_DMA_SCL )569 {570 boot_dev = &boot_info->dev_dma;571 572 boot_dev->type = device->type;573 boot_dev->base = device->base;574 boot_dev->channels = device->channels;575 boot_dev->irqs = 0;576 577 #if DEBUG_BOOT_INFO578 boot_printf(" - DMA : base = %l / size = %l / channels = %d / irqs = %d\n",579 device->base , device->size , device->channels , device->irqs );580 #endif581 }582 579 } // end loop on local peripherals 583 580 584 // Get the top address of the kernel segments 581 // initialize number of external peripherals 582 boot_info->int_dev_nr = device_id; 583 584 // Get the top address of the kernel segments 585 585 end = (boot_info->kernel_code_end > boot_info->kernel_data_end ) ? 586 586 boot_info->kernel_code_end : boot_info->kernel_data_end; … … 592 592 // No "reserved zones" for the TSAR architecture 593 593 boot_info->rsvd_nr = 0; 594 595 #if DEBUG_BOOT_INFO596 boot_printf("\n[BOOT INFO] %s : Kernel Reserved Zone / base = 0 / npages = %d at cycle %d\n",597 __FUNCTION__ , rsvd_pages ,boot_get_proctime() );598 #endif599 594 600 595 // set boot_info signature … … 690 685 691 686 /********************************************************************************* 692 * This function is called by all CP0 to activate all local CPi cores. 693 * @ boot_info : pointer to local 'boot_info_t' structure, used to find 694 * the XICU device associated with local CPi base addresses. 687 * This function is called by all CP0 to activate the other CPi cores. 688 * @ boot_info : pointer to local 'boot_info_t' structure. 695 689 *********************************************************************************/ 696 690 static void boot_wake_local_cores(boot_info_t * boot_info) 697 691 { 698 boot_device_t * device; // Iterator on devices699 unsigned int core_id; // Iterator on cores 700 701 device = &boot_info->dev_icu;692 unsigned int core_id; 693 694 // get pointer on XCU device descriptor in boot_info 695 boot_device_t * xcu = &boot_info->int_dev[0]; 702 696 703 697 // loop on cores … … 709 703 boot_info->cxy , core_id , boot_get_proctime() ); 710 704 #endif 711 boot_remote_sw( (xptr_t)(device->base + (core_id << 2)) , (uint32_t)boot_entry ); 705 // send an IPI 706 boot_remote_sw( (xptr_t)(xcu->base + (core_id << 2)) , (uint32_t)boot_entry ); 712 707 } 713 708 } // boot_wake_local_cores()
Note: See TracChangeset
for help on using the changeset viewer.