blob: 7abf536bc9f53c0ce4561873dc29973dc683f80d [file] [log] [blame]
From 2dd8eb6b90b7dfe63587292e163e27075f652b40 Mon Sep 17 00:00:00 2001
From: Bill Schwartz <whs@us.ibm.com>
Date: Wed, 11 Feb 2015 05:17:23 -0600
Subject: [PATCH 4/5] Report pnor side booted up on A/B to OPAL
This story will use the getPnorInfo and getSideInfo interfaces
to fill in devtree entries informing Opal about the existence,
location, and state of PNOR sides that we know about. We will pass up a list
of TOCs associated with the active side and the inactive side.
RTC: 109703
Change-Id: I740b086a9e22a0bc167141e3565bf813e50d9a00
(cherry picked from commit b42f65df9fddb3938c096c23ccdcb2568a727120)
---
src/include/usr/pnor/pnorif.H | 5 ++
src/usr/devtree/bld_devtree.C | 110 +++++++++++++++++++++++++++++++++++++++++
src/usr/pnor/pnor_common.H | 1 -
src/usr/pnor/pnordd.C | 3 +-
4 files changed, 117 insertions(+), 2 deletions(-)
diff --git a/src/include/usr/pnor/pnorif.H b/src/include/usr/pnor/pnorif.H
index e12ccf1..0fc5a83 100644
--- a/src/include/usr/pnor/pnorif.H
+++ b/src/include/usr/pnor/pnorif.H
@@ -120,6 +120,11 @@ struct SideInfo_t
uint64_t hbbMmioOffset; /**< HBB MMIO Offset associated with hbbAddress*/
};
+enum
+{
+ INVALID_OFFSET = 0xFFFFFFF, // Invalid primary or alternate TOC
+};
+
/**
* @brief Returns information about a given side of pnor
*
diff --git a/src/usr/devtree/bld_devtree.C b/src/usr/devtree/bld_devtree.C
index f4647a3..d90c1fd 100644
--- a/src/usr/devtree/bld_devtree.C
+++ b/src/usr/devtree/bld_devtree.C
@@ -405,6 +405,113 @@ void add_i2c_info( const TARGETING::Target* i_targ,
}
+void bld_getSideInfo(PNOR::SideId i_side,
+ uint32_t o_TOCaddress[2],
+ uint8_t & o_count,
+ bool & o_isGolden)
+{
+ errlHndl_t errhdl = NULL;
+ PNOR::SideInfo_t l_info;
+
+ o_count = 0;
+ o_isGolden = false;
+
+ errhdl = getSideInfo (i_side, l_info);
+ if (!errhdl)
+ {
+ // return the valid TOC offsets & count of valid TOCs
+ if (PNOR::INVALID_OFFSET != l_info.primaryTOC)
+ {
+ o_TOCaddress[o_count++] = l_info.primaryTOC;
+ }
+ if (PNOR::INVALID_OFFSET != l_info.backupTOC)
+ {
+ o_TOCaddress[o_count++] = l_info.backupTOC;
+ }
+ o_isGolden = l_info.isGolden;
+ }
+ else
+ {
+ // commit error and return 0 TOC offsets
+ errlCommit(errhdl, DEVTREE_COMP_ID);
+ }
+
+ return;
+}
+
+void bld_fdt_pnor(devTree * i_dt,
+ dtOffset_t i_parentNode)
+{
+ do
+ {
+ uint32_t l_active[2] = {PNOR::INVALID_OFFSET,PNOR::INVALID_OFFSET};
+ uint32_t l_golden[2] = {PNOR::INVALID_OFFSET,PNOR::INVALID_OFFSET};
+ uint8_t l_count = 0;
+ bool l_isGolden = false;
+ bool l_goldenFound = false;
+ uint8_t l_goldenCount = 0;
+ PNOR::PnorInfo_t l_pnorInfo;
+
+ //Get pnor address and size
+ getPnorInfo (l_pnorInfo);
+
+ dtOffset_t l_pnorNode = i_dt->addNode(i_parentNode,
+ "pnor",
+ l_pnorInfo.mmioOffset);
+
+ const uint8_t l_isaLinkage = 0; // 0==Mem
+ uint32_t pnor_prop[3] = {l_isaLinkage,
+ l_pnorInfo.mmioOffset,
+ l_pnorInfo.flashSize};
+ i_dt->addPropertyCells32(l_pnorNode, "reg", pnor_prop, 3);
+
+ //Add Working/Active parition
+ bld_getSideInfo(PNOR::WORKING,l_active,l_count,l_isGolden);
+ if (l_count) // valid TOCs present
+ {
+ i_dt->addPropertyCells32(l_pnorNode,
+ "active-image-tocs", l_active, l_count);
+ // capture golden
+ if (l_isGolden)
+ {
+ l_golden[0] = l_active[0];
+ l_golden[1] = l_active[1];
+ l_goldenCount = l_count;
+ l_goldenFound = true;
+ }
+ }
+
+#if CONFIG_PNOR_TWO_SIDE_SUPPORT
+ //Add Alternate parition
+ uint32_t l_alternate[2] = {PNOR::INVALID_OFFSET,PNOR::INVALID_OFFSET};
+
+ bld_getSideInfo(PNOR::ALTERNATE,l_alternate,l_count,l_isGolden);
+ if (l_count) // valid TOCs present
+ {
+ i_dt->addPropertyCells32(l_pnorNode,
+ "alternate-image-tocs",l_alternate,l_count);
+ // capture golden
+ if (l_isGolden)
+ {
+ l_golden[0] = l_alternate[0];
+ l_golden[1] = l_alternate[1];
+ l_goldenCount = l_count;
+ l_goldenFound = true;
+ }
+ }
+#endif
+
+ //Include golden if there is one
+ if (l_goldenFound)
+ {
+ i_dt->addPropertyCells32(l_pnorNode,
+ "golden-image-tocs",l_golden,l_goldenCount);
+ }
+
+ } while (0);
+
+ return;
+}
void bld_xscom_node(devTree * i_dt, dtOffset_t & i_parentNode,
const TARGETING::Target * i_pProc, uint32_t i_chipid)
@@ -488,6 +595,8 @@ void bld_xscom_node(devTree * i_dt, dtOffset_t & i_parentNode,
i_dt->addPropertyCell32(lpcNode, "#address-cells", 2);
i_dt->addPropertyCell32(lpcNode, "#size-cells", 1);
+ bld_fdt_pnor (i_dt, lpcNode);
+
}
/*NX*/
@@ -908,6 +1017,7 @@ void load_hbrt_image(uint64_t& io_address)
}
}
+
errlHndl_t bld_fdt_system(devTree * i_dt, bool i_smallTree)
{
errlHndl_t errhdl = NULL;
diff --git a/src/usr/pnor/pnor_common.H b/src/usr/pnor/pnor_common.H
index dd7ab2e..7213add 100644
--- a/src/usr/pnor/pnor_common.H
+++ b/src/usr/pnor/pnor_common.H
@@ -61,7 +61,6 @@ namespace PNOR {
SUPPORTED_FFS_VERSION = 0x1, /**< Supported FFS Version */
FFS_TABLE_BASE_ADDR = 0x0, /**< Currently only have FFS table */
TOC_SIZE = 0x8000,
- INVALID_OFFSET = 0xFFFFFFF,
};
/**
diff --git a/src/usr/pnor/pnordd.C b/src/usr/pnor/pnordd.C
index 13667ce..c0c7b0e 100644
--- a/src/usr/pnor/pnordd.C
+++ b/src/usr/pnor/pnordd.C
@@ -46,6 +46,7 @@
#include <errl/errludstring.H>
#include <targeting/common/targetservice.H>
#include "pnordd.H"
+#include "pnor_common.H"
#include <pnor/pnorif.H>
#include <pnor/pnor_reasoncodes.H>
#include <sys/time.h>
@@ -196,7 +197,7 @@ bool usingL3Cache()
*/
void getPnorInfo( PnorInfo_t& o_pnorInfo )
{
- o_pnorInfo.mmioOffset = 0; //LPC_SFC_MMIO_OFFSET;//@fixme-need Prachi's code for this
+ o_pnorInfo.mmioOffset = LPC_SFC_MMIO_OFFSET|LPC_FW_SPACE;
o_pnorInfo.norWorkarounds =
Singleton<PnorDD>::instance().getNorWorkarounds();
o_pnorInfo.flashSize =
--
1.7.4.1