Skip to content

Commit f423a9c

Browse files
committed
Fixes to solve customer ELF loading
1 parent 6c313a9 commit f423a9c

1 file changed

Lines changed: 35 additions & 3 deletions

File tree

hal/nxp_t2080.c

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,27 @@ void hal_ddr_init(void)
413413

414414
/* Map LAW for DDR -- use full DDR size.
415415
* For 4GB boards, a single 4GB LAW at PA 0x0 covers all DDR.
416-
* CW U-Boot ostype2 uses: set_ddr_laws(0, ddr_size, DDR_1). */
416+
* CW U-Boot ostype2 uses: set_ddr_laws(0, ddr_size, DDR_1).
417+
*
418+
* Slot choice: INTEGRITY-178 tuMP's BSP (BSP_Initialize) reprograms LAW
419+
* slots 0-9 for its CW peripheral map and creates NO DDR LAW of its own
420+
* -- it relies on the bootloader leaving DDR coverage in a HIGHER slot it
421+
* does not touch (CW U-Boot's set_next_law allocates the DDR LAW above the
422+
* static peripheral LAWs). With the DDR LAW in slot 4 (inside tuMP's 0-9
423+
* range) tuMP overwrites it, DDR loses LAW coverage, and the next
424+
* instruction fetch -- including tuMP's own entMCHK handler -- bus-errors
425+
* into a recursive machine-check checkstop (silent hang). Park the DDR LAW
426+
* in a high slot tuMP leaves alone (T2080 has 32 LAWs; wolfBoot uses 0-16;
427+
* VxWorks rebuilds its own LAWs so the slot is immaterial to it). */
428+
#ifdef BOARD_CW_VPX3152
429+
#define DDR_LAW_SLOT 17
430+
#else
431+
#define DDR_LAW_SLOT 4
432+
#endif
417433
#if DDR_SIZE >= (4096ULL * 1024ULL * 1024ULL)
418-
set_law(4, 0, DDR_ADDRESS, LAW_TRGT_DDR_1, LAW_SIZE_4GB, 0);
434+
set_law(DDR_LAW_SLOT, 0, DDR_ADDRESS, LAW_TRGT_DDR_1, LAW_SIZE_4GB, 0);
419435
#else
420-
set_law(4, 0, DDR_ADDRESS, LAW_TRGT_DDR_1, LAW_SIZE_2GB, 0);
436+
set_law(DDR_LAW_SLOT, 0, DDR_ADDRESS, LAW_TRGT_DDR_1, LAW_SIZE_2GB, 0);
421437
#endif
422438

423439
/* If DDR is already enabled then just return */
@@ -1494,7 +1510,23 @@ static void hal_mp_init(void)
14941510
/* Second half boot page (spin loop + spin table) goes just below.
14951511
* For XIP flash builds, .bootmp is in flash — secondary cores can't
14961512
* write to flash, so the spin table MUST be in DDR. */
1513+
#if defined(ENABLE_OS64BIT) && defined(BOARD_CW_VPX3152)
1514+
/* INTEGRITY-178 tuMP (cw152 BSP) hardcodes its ePAPR spin-table base at
1515+
* physical 0x7FEE41C0 (where production CW U-Boot's relocated __spin_table
1516+
* lands) and does NOT take cpu-release-addr from the DTB. wolfBoot's
1517+
* default spin table doesn't match, so tuMP's secondaries are never
1518+
* released and it hangs in BSP_StartUp before console init. Relocate the
1519+
* second-half boot page so the spin table lands exactly at 0x7FEE41C0.
1520+
* The spin CODE and TABLE stay adjacent in one 4 KB page (0x7FEE4000) so
1521+
* the secondary cores' single spin-table TLB entry (boot_ppc_mp.S) maps
1522+
* both the rfi target (_bootpg_addr) and the table; bootpg stays
1523+
* page-aligned below the hole for the boot-release. VxWorks 7 follows via
1524+
* the cpu-release-addr DTB fixup (g_spin_table_ddr). */
1525+
second_half_ddr = 0x7FEE41C0UL -
1526+
((uint32_t)_spin_table - (uint32_t)&_second_half_boot_page);
1527+
#else
14971528
second_half_ddr = bootpg - BOOT_ROM_SIZE;
1529+
#endif
14981530

14991531
/* DDR addresses for second half symbols */
15001532
spin_table_ddr = second_half_ddr +

0 commit comments

Comments
 (0)