From 74ca835c212ecf6df1b671d18e92887f76817a48 Mon Sep 17 00:00:00 2001 From: Marty Gloff Date: Mon, 5 Jun 2017 11:48:27 -0500 Subject: Fix tracing for Bootloader hangs if it can't find first TOC Limit how many traces are done by recovery loop that walks back through PNOR to find a valid TOC. Use page aligned MMIO addresses. Change-Id: Icdd41fe36fc597769af57d54049c3e457b790594 RTC: 175243 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/41398 Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Tested-by: Jenkins OP Build CI Reviewed-by: Matt Derksen Reviewed-by: Corey V. Swenson Reviewed-by: Daniel M. Crowell --- src/bootloader/bl_pnorAccess.C | 27 +++++++++++++++++++++++++++ src/bootloader/bootloader.C | 1 + 2 files changed, 28 insertions(+) (limited to 'src/bootloader') diff --git a/src/bootloader/bl_pnorAccess.C b/src/bootloader/bl_pnorAccess.C index b0d0c8ae6..2d924e1a6 100644 --- a/src/bootloader/bl_pnorAccess.C +++ b/src/bootloader/bl_pnorAccess.C @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #ifdef PNORUTILSTEST_H @@ -196,6 +197,7 @@ void bl_pnorAccess::findTOC(uint64_t i_pnorEnd, PNOR::SectionData_t * o_TOC, //The first TOC is 1 TOC size + 1 page back from the end of the flash (+ 1) uint64_t l_mmioAddr = i_pnorEnd - PNOR::TOC_OFFSET_FROM_TOP_OF_FLASH; + l_mmioAddr = ALIGN_PAGE_DOWN(l_mmioAddr); do { @@ -224,12 +226,37 @@ void bl_pnorAccess::findTOC(uint64_t i_pnorEnd, PNOR::SectionData_t * o_TOC, // Use PNOR start address for next MMIO BOOTLOADER_TRACE(BTLDR_TRC_PA_FINDTOC_USE_PNOR_START); l_mmioAddr = o_pnorStart; + + // Reset saved trace index + Bootloader::g_blData->bl_trace_index_saved = + BOOTLOADER_TRACE_SIZE; } else { + // Check if a trace index is not saved + if(Bootloader::g_blData->bl_trace_index_saved >= + BOOTLOADER_TRACE_SIZE) + { + // Save trace index for future passes through loop + Bootloader::g_blData->bl_trace_index_saved = + Bootloader::g_blData->bl_trace_index; + + // Save this PNOR MMIO address + Bootloader::g_blData->bl_first_pnor_mmio = l_mmioAddr; + } + else // A trace index was saved + { + // Replace trace index, reuse trace entries for this loop + Bootloader::g_blData->bl_trace_index = + Bootloader::g_blData->bl_trace_index_saved; + } + // Adjust to new location in PNOR flash for next MMIO BOOTLOADER_TRACE(BTLDR_TRC_PA_FINDTOC_ADJUST_PNOR_ADDR); l_mmioAddr -= PAGESIZE; + + // Increment loop counter + Bootloader::g_blData->bl_pnor_loop_count++; } // Check that address is still in FW space diff --git a/src/bootloader/bootloader.C b/src/bootloader/bootloader.C index bf8ca180a..cb13f0da4 100644 --- a/src/bootloader/bootloader.C +++ b/src/bootloader/bootloader.C @@ -280,6 +280,7 @@ namespace Bootloader{ // Initialization g_blData = reinterpret_cast(HBBL_DATA_ADDR); g_blData->bl_trace_index = 0; + g_blData->bl_trace_index_saved = BOOTLOADER_TRACE_SIZE; BOOTLOADER_TRACE(BTLDR_TRC_MAIN_START); //Set core scratch 3 to say bootloader is active -- cgit v1.2.1