summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarty Gloff <mgloff@us.ibm.com>2017-05-08 11:25:11 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-06-08 10:41:38 -0400
commit4edfbd997e46ab635821558047b80ba38a2d7f15 (patch)
treed25ae8b4fbb3fd16dedfde1d5f37d63cb63e6a4a /src
parentbb0796065c4a8035b0f0a9bddee61edc8f221c38 (diff)
downloadtalos-hostboot-4edfbd997e46ab635821558047b80ba38a2d7f15.tar.gz
talos-hostboot-4edfbd997e46ab635821558047b80ba38a2d7f15.zip
Use effective fabric position for LPC operations in the bootloader
When the LPC BAR value is supplied in the SBE to BL structure, use it as the base LPC address, otherwise, still use the LPC constant. Save the value being used in the Bootloader data (which is reorganized to align data blocks on boundaries). Also add hb-bldata to parse out the Bootloader data. Change-Id: I1db19467464b90e0190c4df5f7404624c9423eb5 RTC: 173525 Depends-on: I2b0d1959c303df8c9c28c8f0a5b5be1e77aa154f Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40217 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Matt Derksen <mderkse1@us.ibm.com> Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/bootloader/bl_pnorAccess.C4
-rw-r--r--src/bootloader/bootloader.C53
-rw-r--r--src/build/debug/Hostboot/BlData.pm168
-rwxr-xr-xsrc/build/simics/hb-simdebug.py22
-rw-r--r--src/include/bootloader/bootloader_data.H16
-rw-r--r--src/include/bootloader/bootloaderif.H9
6 files changed, 228 insertions, 44 deletions
diff --git a/src/bootloader/bl_pnorAccess.C b/src/bootloader/bl_pnorAccess.C
index 3ea60eaaf..b0d0c8ae6 100644
--- a/src/bootloader/bl_pnorAccess.C
+++ b/src/bootloader/bl_pnorAccess.C
@@ -201,6 +201,7 @@ void bl_pnorAccess::findTOC(uint64_t i_pnorEnd, PNOR::SectionData_t * o_TOC,
{
//@TODO RTC:138268 Set up multiple side of PNOR for bootloader
o_errCode = 0;
+
//Copy Table of Contents from PNOR flash to a local buffer
Bootloader::handleMMIO(l_mmioAddr,
reinterpret_cast<uint64_t>(l_tocBuffer),
@@ -232,7 +233,8 @@ void bl_pnorAccess::findTOC(uint64_t i_pnorEnd, PNOR::SectionData_t * o_TOC,
}
// Check that address is still in FW space
- if(l_mmioAddr < (LPC::LPC_PHYS_BASE + LPC::LPCHC_FW_SPACE))
+ if(l_mmioAddr <
+ (Bootloader::g_blData->blToHbData.lpcBAR + LPC::LPCHC_FW_SPACE))
{
BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_PA_FINDTOC_READTOC_ERR);
diff --git a/src/bootloader/bootloader.C b/src/bootloader/bootloader.C
index 69d06e5ed..772279bc9 100644
--- a/src/bootloader/bootloader.C
+++ b/src/bootloader/bootloader.C
@@ -34,6 +34,7 @@
#include <lpc_const.H>
#include <pnor_utils.H>
+#include <arch/memorymap.H>
#include <ecc.H>
@@ -112,36 +113,22 @@ namespace Bootloader{
const auto l_pSecRomInfo = reinterpret_cast<const SecureRomInfo*>(
l_pRomStart);
- // Set the MMIO BAR information as is appropriate
- if (l_blConfigData->version >= MMIO_BARS_ADDED)
+ // Translate SBE to BL version into BL to HB version
+ switch(l_blConfigData->version)
{
- // Translate SBE to BL version into BL to HB version
- switch(l_blConfigData->version)
- {
- // Add cases as additional versions are created
- default:
- g_blData->blToHbData.version = BLTOHB_MMIOBARS;
- break;
- }
-
- // Copy values for MMIO BARs
- g_blData->blToHbData.xscomBAR = l_blConfigData->xscomBAR;
- g_blData->blToHbData.lpcBAR = l_blConfigData->lpcBAR;
- }
- else
- {
- // Use MMIO BARs version since default values are being set
- g_blData->blToHbData.version = BLTOHB_MMIOBARS;
-
- // Set default values for MMIO BARs
- // @TODO RTC: 173526 or RTC: 173525
- // Use constants MMIO_GROUP0_CHIP0_XSCOM_BASE_ADDR and
- // MMIO_GROUP0_CHIP0_LPC_BASE_ADDR from
- // src/include/arch/memorymap.H for setting values
- g_blData->blToHbData.xscomBAR = 0x000603FC00000000;
- g_blData->blToHbData.lpcBAR = 0x0006030000000000;
+ // Add cases as additional versions are created
+ default:
+ g_blData->blToHbData.version = BLTOHB_MMIOBARS;
+ break;
}
+ // Copy values for MMIO BARs
+ g_blData->blToHbData.xscomBAR
+ = (l_blConfigData->version >= MMIO_BARS_ADDED)
+ ? l_blConfigData->xscomBAR
+ : MMIO_GROUP0_CHIP0_XSCOM_BASE_ADDR;
+ /* lpcBAR already copied in main() */
+
// Only set rest of BlToHbData if SecureROM is valid
if ( secureRomInfoValid(l_pSecRomInfo) )
{
@@ -302,10 +289,18 @@ namespace Bootloader{
// @TODO RTC:138268 Support multiple sides of PNOR in bootloader
+ // Copy SBE BL shared data into BL HB shared data
+ const auto l_blConfigData = reinterpret_cast<BootloaderConfigData_t *>(
+ SBE_HB_COMM_ADDR);
+ g_blData->blToHbData.lpcBAR
+ = (l_blConfigData->version >= MMIO_BARS_ADDED)
+ ? l_blConfigData->lpcBAR
+ : MMIO_GROUP0_CHIP0_LPC_BASE_ADDR;
+
//pnorEnd is the end of flash, which is base of lpc, plus
//the offset of the FW space, plus the TOP memory address in FW space
- uint64_t l_pnorEnd = LPC::LPC_PHYS_BASE + LPC::LPCHC_FW_SPACE
- + PNOR::LPC_TOP_OF_FLASH_OFFSET;
+ uint64_t l_pnorEnd = g_blData->blToHbData.lpcBAR + LPC::LPCHC_FW_SPACE
+ + PNOR::LPC_TOP_OF_FLASH_OFFSET;
//We dont know what the start of pnor is because we dont know the size
uint64_t l_pnorStart = 0;
diff --git a/src/build/debug/Hostboot/BlData.pm b/src/build/debug/Hostboot/BlData.pm
new file mode 100644
index 000000000..91d2f89d3
--- /dev/null
+++ b/src/build/debug/Hostboot/BlData.pm
@@ -0,0 +1,168 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/debug/Hostboot/BlData.pm $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2017
+# [+] International Business Machines Corp.
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+# IBM_PROLOG_END_TAG
+
+use strict;
+
+package Hostboot::BlData;
+use Exporter;
+our @EXPORT_OK = ('main');
+
+sub formatData
+{
+ my $data = shift;
+ my $dataRaw = "";
+
+ for (my $i = 0; $i < length($data); $i++)
+ {
+ my $dataHexStr = sprintf("%02X", ord(substr($data, $i, 1)));
+ $dataRaw .= $dataHexStr;
+
+ if ($i % 16 == 15)
+ {
+ $dataRaw .= "\n";
+ }
+ elsif ($i % 4 == 3)
+ {
+ $dataRaw .= " ";
+ }
+ }
+
+ return $dataRaw."\n";
+}
+
+sub main
+{
+ ::setBootloader();
+
+ my $btLdrHrmor = 0x0000000008200000;
+
+ my ($dataSym, $dataSize) = ::findSymbolAddress("Bootloader::g_blData");
+ if (not defined $dataSym) { ::userDisplay "Cannot find symbol.\n"; die; }
+ my $dataSymStr = sprintf("0x%08X", $dataSym);
+
+ ::userDisplay "------------Bootloader Data------------";
+ ::userDisplay "\nData Symbol Address: ";
+ ::userDisplay $dataSymStr;
+
+ my ($scratchSym, $scratchSize) =
+ ::findSymbolAddress("Bootloader::g_blScratchSpace");
+ if (not defined $scratchSym) { ::userDisplay "Cannot find symbol.\n"; die; }
+ my $scratchSymStr = sprintf("0x%08X", $scratchSym);
+
+ ::userDisplay "\nScratch Space Symbol Address: ";
+ ::userDisplay $scratchSymStr;
+ ::userDisplay "\n--------------------------------------------\n";
+
+ my $dataAddr = 0x0000000008208000;
+
+ my $traceAddr = $dataAddr;
+ my $traceAddrStr = sprintf("0x%08X", $traceAddr);
+ ::sendIPCMsg("read-data", "$traceAddr,64"); # Trace buffer is 64 bytes
+ my ($type1, $trace) = ::recvIPCMsg();
+ my $traceData = formatData($trace);
+
+ ::userDisplay "\nTrace Buffer Address: ";
+ ::userDisplay $traceAddrStr;
+ ::userDisplay "\n\nTrace Data:\n";
+ ::userDisplay $traceData;
+ ::userDisplay "\n--------------------------------------------\n";
+
+
+ my $indexAddr = $dataAddr + 64;
+ my $indexAddrStr = sprintf("0x%08X", $indexAddr);
+ ::sendIPCMsg("read-data", "$indexAddr,1"); # Trace index is 1 byte
+ my ($type2, $index) = ::recvIPCMsg();
+ $index =~ s/\0+//g; #strip off nulls
+ my $indexStr = sprintf("0x%02X", ord($index));
+
+ ::userDisplay "\nTrace Index Address: ";
+ ::userDisplay $indexAddrStr;
+ ::userDisplay "\n\nTrace Index (Next Entry): ";
+ ::userDisplay $indexStr;
+ ::userDisplay "\n\n--------------------------------------------\n";
+
+
+ my $tiDataAreaAddr = $dataAddr + 80;
+ my $tiDataAreaAddrStr = sprintf("0x%08X", $tiDataAreaAddr);
+ ::sendIPCMsg("read-data", "$tiDataAreaAddr,48"); # TI Data Area is 48 bytes
+ my ($type6, $tiDataArea) = ::recvIPCMsg();
+ my $tiDataAreaData = formatData($tiDataArea);
+
+ ::userDisplay "\nTI Data Area Address: ";
+ ::userDisplay $tiDataAreaAddrStr;
+ ::userDisplay "\n\nTI Data Area:\n";
+ ::userDisplay $tiDataAreaData;
+ ::userDisplay "\n--------------------------------------------\n";
+
+
+ my $hbbPnorSecAddr = $dataAddr + 128;
+ my $hbbPnorSecAddrStr = sprintf("0x%08X", $hbbPnorSecAddr);
+ ::sendIPCMsg("read-data", "$hbbPnorSecAddr,32"); # Section data is 32 bytes
+ my ($type5, $hbbPnorSec) = ::recvIPCMsg();
+ my $hbbPnorSecData = formatData($hbbPnorSec);
+
+ ::userDisplay "\nHBB PNOR Section Data Address: ";
+ ::userDisplay $hbbPnorSecAddrStr;
+ ::userDisplay "\n\nHBB PNOR Section Data:\n";
+ ::userDisplay $hbbPnorSecData;
+ ::userDisplay "\n--------------------------------------------\n";
+
+
+ my $secRomValAddr = $dataAddr + 160;
+ my $secRomValAddrStr = sprintf("0x%08X", $secRomValAddr);
+ ::sendIPCMsg("read-data", "$secRomValAddr,1"); # Secure ROM Valid is 1 byte
+ my ($type4, $secRomVal) = ::recvIPCMsg();
+ $secRomVal =~ s/\0+//g; #strip off nulls
+ my $secRomValStr = sprintf("0x%02X", ord($secRomVal));
+
+ ::userDisplay "\nSecure ROM Valid Address: ";
+ ::userDisplay $secRomValAddrStr;
+ ::userDisplay "\n\nSecure ROM Valid: ";
+ ::userDisplay $secRomValStr;
+ ::userDisplay "\n\n--------------------------------------------\n";
+
+
+ my $blToHbAddr = $dataAddr + 176;
+ my $blToHbAddrStr = sprintf("0x%08X", $blToHbAddr);
+ ::sendIPCMsg("read-data", "$blToHbAddr,89"); # BL to HB data is 89 bytes
+ my ($type3, $blToHb) = ::recvIPCMsg();
+ my $blToHbData = formatData($blToHb);
+
+ ::userDisplay "\nBL to HB Data Address: ";
+ ::userDisplay $blToHbAddrStr;
+ ::userDisplay "\n\nBootloader to Hostboot Data:\n";
+ ::userDisplay $blToHbData;
+ ::userDisplay "\n--------------------------------------------\n";
+
+ ::clearBootloader();
+}
+
+sub helpInfo
+{
+ my %info = (
+ name => "BlData",
+ intro => ["Displays Bootloader data."],
+ );
+}
diff --git a/src/build/simics/hb-simdebug.py b/src/build/simics/hb-simdebug.py
index d9f7be5aa..f43877807 100755
--- a/src/build/simics/hb-simdebug.py
+++ b/src/build/simics/hb-simdebug.py
@@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2011,2016
+# Contributors Listed Below - COPYRIGHT 2011,2017
# [+] International Business Machines Corp.
#
#
@@ -87,6 +87,26 @@ Examples: \n
#------------------------------------------------
#------------------------------------------------
+new_command("hb-bldata",
+ lambda: run_hb_debug_framework("BlData", outputFile = "hb-bldata.output"),
+ #alias = "hbt",
+ type = ["hostboot-commands"],
+ #see_also = ["hb-trace"],
+ see_also = [ ],
+ short = "Display Bootloader data",
+ doc = """
+Parameters: \n
+
+Defaults: \n
+ 'syms' = './hbibl.syms' \n\n
+
+Examples: \n
+ hb-bldata \n\n
+ NOTE: Results are unpredictable after control is passed to Hostboot Base.\n
+ """)
+
+#------------------------------------------------
+#------------------------------------------------
new_command("hb-printk",
lambda: run_hb_debug_framework("Printk", outputFile = "hb-printk.output"),
#alias = "hbt",
diff --git a/src/include/bootloader/bootloader_data.H b/src/include/bootloader/bootloader_data.H
index a28ea74cd..a97120ca0 100644
--- a/src/include/bootloader/bootloader_data.H
+++ b/src/include/bootloader/bootloader_data.H
@@ -53,18 +53,20 @@ namespace Bootloader{
// @brief Index for Bootloader Trace entries
// One-byte index for next entry to use in bootloader_trace.
uint8_t bl_trace_index;
+ uint8_t bl_reserved1[15];
- // Object that will be stored where the SBE HB structure indicates
- BlToHbData blToHbData;
-
- // Bool indicating if the secureROM is valid. Toggles verification.
- bool secureRomValid;
+ // Instance of the TI Data Area
+ HB_TI_DataArea bl_TIDataArea;
// Buffer to save HBB PNOR section data
PNOR::SectionData_t bl_hbbSection;
- // Instance of the TI Data Area
- HB_TI_DataArea bl_TIDataArea;
+ // Bool indicating if the secureROM is valid. Toggles verification.
+ bool secureRomValid;
+ uint8_t bl_reserved2[15];
+
+ // Object that will be stored where the SBE HB structure indicates
+ BlToHbData blToHbData;
} blData_t;
/**
diff --git a/src/include/bootloader/bootloaderif.H b/src/include/bootloader/bootloaderif.H
index 6fbbd4fd8..e54688f81 100644
--- a/src/include/bootloader/bootloaderif.H
+++ b/src/include/bootloader/bootloaderif.H
@@ -27,7 +27,7 @@
#include <arch/ppc.H>
#include <securerom/ROM.H>
-#include <usr/lpc/lpc_const.H>
+#include <arch/memorymap.H>
namespace Bootloader{
// Max size of HBBL without ECC. Must match PNOR layout for eyeCatch HBBL
@@ -76,11 +76,8 @@ struct BlToHbData
secureRomSize(0), hwKeysHash(nullptr),
hwKeysHashSize(0), hbbHeader(nullptr),
hbbHeaderSize(0), secureAccessBit(false),
- // @TODO RTC: 173526 or RTC: 173525
- // Use constants MMIO_GROUP0_CHIP0_XSCOM_BASE_ADDR and
- // MMIO_GROUP0_CHIP0_LPC_BASE_ADDR from
- // src/include/arch/memorymap.H for setting values
- xscomBAR(0x000603FC00000000), lpcBAR(LPC::LPC_PHYS_BASE) {}
+ xscomBAR(MMIO_GROUP0_CHIP0_XSCOM_BASE_ADDR),
+ lpcBAR(MMIO_GROUP0_CHIP0_LPC_BASE_ADDR) {}
// Simple way to tell if data is valid
uint64_t eyeCatch;
OpenPOWER on IntegriCloud