summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBill Schwartz <whs@us.ibm.com>2015-07-14 09:58:35 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-08-06 16:14:19 -0500
commit77fb3e2cb457a1fdd2ea08abf495b54278070af0 (patch)
tree36548e642894040444a06bc42882d996122cd549 /src
parent5a39b44b4148f1a8740074dc0937b56ed162e24d (diff)
downloadtalos-hostboot-77fb3e2cb457a1fdd2ea08abf495b54278070af0.tar.gz
talos-hostboot-77fb3e2cb457a1fdd2ea08abf495b54278070af0.zip
Support multiple instances for reserved memory
Update HBRT interface to add an instance to get_resvered_mem and update devtree entries with instance. Change-Id: Ie0c5a76ce5ff347354bc91898e1c4dc032430e13 RTC: 131056 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/19281 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Reviewed-by: MATTHEW A. PLOETZ <maploetz@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/include/runtime/interface.h3
-rw-r--r--src/usr/devtree/bld_devtree.C113
-rw-r--r--src/usr/hwpf/hwp/occ/occ.C11
-rw-r--r--src/usr/hwpf/hwp/occ/occ_common.C4
-rw-r--r--src/usr/hwpf/hwp/occ/runtime/rt_occ.C14
-rw-r--r--src/usr/targeting/common/xmltohb/attribute_types_hb.xml14
-rw-r--r--src/usr/targeting/common/xmltohb/target_types_hb.xml1
-rw-r--r--src/usr/targeting/runtime/attrrp_rt.C4
-rw-r--r--src/usr/testcore/rtloader/loader.H3
-rw-r--r--src/usr/vpd/runtime/rt_vpd.C2
10 files changed, 123 insertions, 46 deletions
diff --git a/src/include/runtime/interface.h b/src/include/runtime/interface.h
index 19c673c16..a7177a000 100644
--- a/src/include/runtime/interface.h
+++ b/src/include/runtime/interface.h
@@ -153,9 +153,10 @@ typedef struct hostInterfaces
/** Get the address of a reserved memory region by its devtree name.
*
* @param[in] Devtree name (ex. "ibm,hbrt-vpd-image")
+ * @param[in] Devtree instance
* @return physical address of region (or NULL).
**/
- uint64_t (*get_reserved_mem)(const char*);
+ uint64_t (*get_reserved_mem)(const char *name, uint32_t instance);
/**
* @brief Force a core to be awake, or clear the force
diff --git a/src/usr/devtree/bld_devtree.C b/src/usr/devtree/bld_devtree.C
index 60f8b32fa..ff5fce0f3 100644
--- a/src/usr/devtree/bld_devtree.C
+++ b/src/usr/devtree/bld_devtree.C
@@ -60,6 +60,8 @@ namespace DEVTREE
{
using namespace TARGETING;
+typedef std::pair<uint64_t,uint64_t> homerAddr_t;
+
#define CHIPID_EXTRACT_NODE(i_chipid) (i_chipid >> CHIPID_NODE_SHIFT)
#define CHIPID_EXTRACT_PROC(i_chipid) (i_chipid & CHIPID_PROC_MASK)
@@ -185,27 +187,24 @@ uint32_t getMembChipId(const TARGETING::Target * i_pMemb)
return l_membId;
}
-
-uint64_t getHomerPhysAddr(const TARGETING::Target * i_pProc)
+uint64_t getOccCommonAddr()
{
- //If running Sapphire need to place this at the top of memory
- uint64_t homerPhysAddrBase = VMM_HOMER_REGION_START_ADDR;
- if(TARGETING::is_sapphire_load())
- {
- homerPhysAddrBase = TARGETING::get_top_mem_addr();
- assert (homerPhysAddrBase != 0,
- "bld_devtree: Top of memory was 0!");
- homerPhysAddrBase -= VMM_ALL_HOMER_OCC_MEMORY_SIZE;
- }
+ TARGETING::Target* sys = NULL;
+ TARGETING::targetService().getTopLevelTarget(sys);
+ uint64_t l_physAddr = sys->getAttr<ATTR_OCC_COMMON_AREA_PHYS_ADDR>();
+ return l_physAddr;
+}
- uint8_t tmpPos = i_pProc->getAttr<ATTR_POSITION>();
- uint64_t tmpOffset = tmpPos*VMM_HOMER_INSTANCE_SIZE;
- uint64_t targHomer = homerPhysAddrBase + tmpOffset;
+homerAddr_t getHomerPhysAddr(const TARGETING::Target * i_pProc)
+{
+ uint64_t l_homerPhysAddrBase = i_pProc->getAttr<ATTR_HOMER_PHYS_ADDR>();
+ uint8_t l_Pos = i_pProc->getAttr<ATTR_POSITION>();
- TRACFCOMP( g_trac_devtree, "proc ChipID [%X] HOMER is at %.16X",
- getProcChipId(i_pProc), targHomer );
+ TRACFCOMP( g_trac_devtree, "proc ChipID [%X] HOMER is at %.16X"
+ " instance %d",
+ getProcChipId(i_pProc), l_homerPhysAddrBase, l_Pos );
- return targHomer;
+ return homerAddr_t(l_homerPhysAddrBase, l_Pos);
}
void add_i2c_info( const TARGETING::Target* i_targ,
@@ -946,14 +945,18 @@ uint32_t bld_intr_node(devTree * i_dt, dtOffset_t & i_parentNode,
void add_reserved_mem(devTree * i_dt,
- std::vector<uint64_t>& i_homerAddr,
+ std::vector<homerAddr_t>& i_homerAddr,
uint64_t i_extraAddr[],
uint64_t i_extraSize[],
const char* i_extraStr[],
uint64_t i_extraCnt)
{
/*
- * The reserved-names and reserve-names properties work hand in hand.
+ * TODO RTC: 131056 remove non-node reserved memory entries
+ * - reserved-names and reserved-ranges
+ * - reserved map ??
+ * hints are provided for the scope of code to remove
+ * The reserved-names and reserve-ranges properties work hand in hand.
* The first one is a list of strings providing a "name" for each entry
* in the second one using the traditional "vendor,name" format.
*
@@ -966,6 +969,10 @@ void add_reserved_mem(devTree * i_dt,
* Corresponding entries must also be created in the "reserved map" part
* of the flat device-tree (which is a binary list in the header of the
* fdt).
+ * **** remove to here
+ *
+ * Reserved memory is passed in a node-based format. An instance
+ * number distinquishes homer regions.
*
* Unless a component (skiboot or Linux) specifically knows about a region
* (usually based on its name) and decides to change or remove it, all
@@ -977,6 +984,7 @@ void add_reserved_mem(devTree * i_dt,
size_t l_num = i_homerAddr.size();
+ // 131056: Won't need these
const char* homerStr = "ibm,slw-occ-image";
const char* reserve_strs[l_num+i_extraCnt+1];
uint64_t ranges[l_num+i_extraCnt][2];
@@ -984,13 +992,42 @@ void add_reserved_mem(devTree * i_dt,
uint64_t res_mem_addrs[l_num+i_extraCnt];
uint64_t res_mem_sizes[l_num+i_extraCnt];
+ // create the nodes for the node based format
+ dtOffset_t rootMemNode = i_dt->addNode(rootNode, "ibm,hostboot");
+ i_dt->addPropertyCell32(rootMemNode, "#address-cells", 2);
+ i_dt->addPropertyCell32(rootMemNode, "#size-cells", 2);
+ dtOffset_t reservedMemNode = i_dt->addNode(rootMemNode, "reserved-memory");
+ i_dt->addPropertyCell32(reservedMemNode, "#address-cells", 2);
+ i_dt->addPropertyCell32(reservedMemNode, "#size-cells", 2);
+ i_dt->addProperty(reservedMemNode, "ranges");
+
for(size_t i = 0; i<l_num; i++)
{
+ uint64_t l_homerAddr = i_homerAddr[i].first;
+ uint64_t l_homerInstance = i_homerAddr[i].second;
+ TRACFCOMP( g_trac_devtree, "Reserved Region %s @ %lx, %lx instance %d",
+ homerStr,
+ l_homerAddr,
+ VMM_HOMER_INSTANCE_SIZE,
+ l_homerInstance);
+
+ // 131056: Won't need these
reserve_strs[i] = homerStr;
- ranges[i][0] = i_homerAddr[i];
+ ranges[i][0] = l_homerAddr;
ranges[i][1] = VMM_HOMER_INSTANCE_SIZE;
- res_mem_addrs[i] = i_homerAddr[i];
+ res_mem_addrs[i] = l_homerAddr;
res_mem_sizes[i] = VMM_HOMER_INSTANCE_SIZE;
+
+ // add node style inclulding homer instance.
+ dtOffset_t homerNode = i_dt->addNode(reservedMemNode,
+ "ibm,homer-image",
+ l_homerAddr);
+ uint64_t propertyCells[2]={l_homerAddr, VMM_HOMER_INSTANCE_SIZE};
+ i_dt->addPropertyCells64(homerNode, "reg", propertyCells, 2);
+ const char* propertyStrs[] = {"ibm,homer-image", NULL};
+ i_dt->addPropertyStrings(homerNode, "ibm,prd-label",propertyStrs);
+ i_dt->addPropertyCell32(homerNode, "ibm,prd-instance",
+ l_homerInstance);
}
for(size_t i = 0; i < i_extraCnt; i++)
@@ -1000,22 +1037,44 @@ void add_reserved_mem(devTree * i_dt,
TRACFCOMP( g_trac_devtree, "Reserved Region %s @ %lx, %lx",
i_extraStr[i], i_extraAddr[i], i_extraSize[i]);
+ // 131056: Won't need these
reserve_strs[l_num] = i_extraStr[i];
ranges[l_num][0] = i_extraAddr[i];
ranges[l_num][1] = i_extraSize[i];
-
res_mem_addrs[l_num] = i_extraAddr[i];
res_mem_sizes[l_num] = i_extraSize[i];
-
l_num++;
+
+ // add node style entry
+ dtOffset_t extraNode = i_dt->addNode(reservedMemNode,
+ i_extraStr[i],
+ i_extraAddr[i]);
+ uint64_t propertyCells[2]={i_extraAddr[i],i_extraSize[i]};
+ i_dt->addPropertyCells64(extraNode, "reg", propertyCells, 2);
+ const char* propertyStrs[] = {i_extraStr[i], NULL};
+ i_dt->addPropertyStrings(extraNode, "ibm,prd-label",propertyStrs);
}
else
{
cell_count -= sizeof(ranges[0]);
}
}
+ // add node style occ common node
+ const char* occStr = "ibm,occ-common-area";
+ uint64_t l_occCommonPhysAddr = getOccCommonAddr();
+ uint64_t l_occCommonPhysSize = VMM_OCC_COMMON_SIZE;
+ TRACFCOMP( g_trac_devtree, "Reserved Region %s @ %lx, %lx",
+ occStr, l_occCommonPhysAddr, l_occCommonPhysSize);
+ dtOffset_t occNode = i_dt->addNode(reservedMemNode,
+ occStr,
+ l_occCommonPhysAddr);
+ uint64_t propertyCells[2]={l_occCommonPhysAddr, l_occCommonPhysSize};
+ i_dt->addPropertyCells64(occNode, "reg", propertyCells, 2);
+ const char* propertyStrs[] = {occStr, NULL};
+ i_dt->addPropertyStrings(occNode, "ibm,prd-label",propertyStrs);
+
+ // 131056: Won't need the rest
reserve_strs[l_num] = NULL;
-
i_dt->addPropertyStrings(rootNode, "reserved-names", reserve_strs);
i_dt->addPropertyCells64(rootNode, "reserved-ranges",
reinterpret_cast<uint64_t*>(ranges),
@@ -1283,7 +1342,7 @@ errlHndl_t bld_fdt_system(devTree * i_dt, bool i_smallTree)
errlHndl_t bld_fdt_cpu(devTree * i_dt,
- std::vector<uint64_t>& o_homerRegions,
+ std::vector<homerAddr_t>& o_homerRegions,
bool i_smallTree)
{
// Nothing to do for small trees currently.
@@ -1356,7 +1415,7 @@ errlHndl_t bld_fdt_cpu(devTree * i_dt,
}
errlHndl_t bld_fdt_reserved_mem(devTree * i_dt,
- std::vector<uint64_t>& i_homerRegions,
+ std::vector<homerAddr_t>& i_homerRegions,
bool i_smallTree)
{
errlHndl_t errhdl = NULL;
@@ -1982,7 +2041,7 @@ errlHndl_t build_flatdevtree( uint64_t i_dtAddr, size_t i_dtSize,
break;
}
- std::vector<uint64_t> l_homerRegions;
+ std::vector<homerAddr_t> l_homerRegions;
TRACFCOMP( g_trac_devtree, "---devtree cpu ---" );
errhdl = bld_fdt_cpu(dt, l_homerRegions, i_smallTree);
diff --git a/src/usr/hwpf/hwp/occ/occ.C b/src/usr/hwpf/hwp/occ/occ.C
index b5168896a..fa1a54752 100644
--- a/src/usr/hwpf/hwp/occ/occ.C
+++ b/src/usr/hwpf/hwp/occ/occ.C
@@ -102,10 +102,10 @@ namespace HBOCC
//==============================
//Setup Addresses
//==============================
- uint8_t procPos = i_target->getAttr<ATTR_POSITION>();
- uint64_t procOffset = (procPos * VMM_HOMER_INSTANCE_SIZE);
#ifndef __HOSTBOOT_RUNTIME
+ uint8_t procPos = i_target->getAttr<ATTR_POSITION>();
+ uint64_t procOffset = (procPos * VMM_HOMER_INSTANCE_SIZE);
uint64_t occImgPaddr =
i_homerPhysAddrBase + procOffset + HOMER_OFFSET_TO_OCC_IMG;
@@ -125,15 +125,16 @@ namespace HBOCC
uint64_t occImgPaddr = homerPaddr + HOMER_OFFSET_TO_OCC_IMG;
uint64_t occImgVaddr = homerVaddr + HOMER_OFFSET_TO_OCC_IMG;
- uint64_t commonPhysAddr = // After homer region
- (homerPaddr - procOffset) + VMM_HOMER_REGION_SIZE;
+ TARGETING::Target* sys = NULL;
+ TARGETING::targetService().getTopLevelTarget(sys);
+ uint64_t commonPhysAddr =
+ sys->getAttr<ATTR_OCC_COMMON_AREA_PHYS_ADDR>();
uint64_t homerHostVirtAddr =
homerVaddr + HOMER_OFFSET_TO_OCC_HOST_DATA;
#endif
-
//==============================
// Load OCC
//==============================
diff --git a/src/usr/hwpf/hwp/occ/occ_common.C b/src/usr/hwpf/hwp/occ/occ_common.C
index 13f1c06e5..983d84ea3 100644
--- a/src/usr/hwpf/hwp/occ/occ_common.C
+++ b/src/usr/hwpf/hwp/occ/occ_common.C
@@ -270,6 +270,10 @@ namespace HBOCC
// BAR3 is the OCC Common Area
// Bar size is in MB, obtained value of 8MB from Tim Hallett
+ TARGETING::Target* sys = NULL;
+ TARGETING::targetService().getTopLevelTarget(sys);
+ sys->setAttr<ATTR_OCC_COMMON_AREA_PHYS_ADDR>(i_commonPhysAddr);
+
TRACUCOMP( g_fapiImpTd,
INFO_MRK"loadOCC: OCC Common Addr: 0x%.8X,size=0x%.8X",
i_commonPhysAddr,VMM_OCC_COMMON_SIZE_IN_MB);
diff --git a/src/usr/hwpf/hwp/occ/runtime/rt_occ.C b/src/usr/hwpf/hwp/occ/runtime/rt_occ.C
index 1bc02a83f..6d3407677 100644
--- a/src/usr/hwpf/hwp/occ/runtime/rt_occ.C
+++ b/src/usr/hwpf/hwp/occ/runtime/rt_occ.C
@@ -431,11 +431,6 @@ namespace RT_OCC
// If we already loaded OCC during the IPL we need to fix up
// the virtual address because we're now not using virtual
// memory
- // Note: We called our memory "ibm,slw-occ-image" but OPAL
- // created their own range that subsumed ours
- //@todo-RTC:124392-solve this naming issue...
- uint64_t l_base_homer =
- g_hostInterfaces->get_reserved_mem("ibm,homer-image");
TargetHandleList procChips;
getAllChips(procChips, TYPE_PROC, true);
@@ -443,10 +438,11 @@ namespace RT_OCC
itr != procChips.end();
++itr)
{
- uint64_t l_offset = (*itr)->getAttr<ATTR_POSITION>()
- * VMM_HOMER_INSTANCE_SIZE;
- (*itr)->setAttr<ATTR_HOMER_VIRT_ADDR>
- (l_base_homer+l_offset);
+ uint64_t l_instance = (*itr)->getAttr<ATTR_POSITION>();
+ uint64_t l_homerAddr =
+ g_hostInterfaces->get_reserved_mem("ibm,homer-image",
+ l_instance);
+ (*itr)->setAttr<ATTR_HOMER_VIRT_ADDR>(l_homerAddr);
}
}
};
diff --git a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
index 8d38f69bc..361d4d3c6 100644
--- a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
+++ b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
@@ -379,6 +379,20 @@
</attribute>
<attribute>
+ <id>OCC_COMMON_AREA_PHYS_ADDR</id>
+ <description>
+ Physical address where OCC Common Area is placed in mainstore.
+ </description>
+ <simpleType>
+ <uint64_t></uint64_t>
+ </simpleType>
+ <persistency>volatile-zeroed</persistency>
+ <readable/>
+ <writeable/>
+ <hbOnly/>
+</attribute>
+
+<attribute>
<id>HOMER_PHYS_ADDR</id>
<description>
Physical address where HOMER image is placed in mainstore.
diff --git a/src/usr/targeting/common/xmltohb/target_types_hb.xml b/src/usr/targeting/common/xmltohb/target_types_hb.xml
index 8115572d6..e26a257ce 100644
--- a/src/usr/targeting/common/xmltohb/target_types_hb.xml
+++ b/src/usr/targeting/common/xmltohb/target_types_hb.xml
@@ -75,6 +75,7 @@
<attribute><id>HTMGT_SAFEMODE</id></attribute>
<attribute><id>IPMI_SENSORS</id></attribute>
<attribute><id>IPMI_MAX_BUFFER_SIZE</id></attribute>
+ <attribute><id>OCC_COMMON_AREA_PHYS_ADDR</id> </attribute>
</targetTypeExtension>
<targetTypeExtension>
diff --git a/src/usr/targeting/runtime/attrrp_rt.C b/src/usr/targeting/runtime/attrrp_rt.C
index 8c49837ac..dde880cc0 100644
--- a/src/usr/targeting/runtime/attrrp_rt.C
+++ b/src/usr/targeting/runtime/attrrp_rt.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2014 */
+/* Contributors Listed Below - COPYRIGHT 2013,2015 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -43,7 +43,7 @@ namespace TARGETING
do
{
TargetingHeader* l_header = reinterpret_cast<TargetingHeader*>(
- g_hostInterfaces->get_reserved_mem("ibm,hbrt-target-image"));
+ g_hostInterfaces->get_reserved_mem("ibm,hbrt-target-image",0));
if ((NULL == l_header) ||
(l_header->eyeCatcher != PNOR_TARG_EYE_CATCHER))
diff --git a/src/usr/testcore/rtloader/loader.H b/src/usr/testcore/rtloader/loader.H
index acc215912..aec064494 100644
--- a/src/usr/testcore/rtloader/loader.H
+++ b/src/usr/testcore/rtloader/loader.H
@@ -309,7 +309,8 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
}
//--------------------------------------------------------------------
- static uint64_t rt_get_reserved_mem(const char* i_region)
+ static uint64_t rt_get_reserved_mem(const char* i_region,
+ uint32_t i_instance)
{
if (0 == strcmp(i_region, "ibm,hbrt-vpd-image"))
return rt_get_vpd();
diff --git a/src/usr/vpd/runtime/rt_vpd.C b/src/usr/vpd/runtime/rt_vpd.C
index f6bc47139..ddf7650cb 100644
--- a/src/usr/vpd/runtime/rt_vpd.C
+++ b/src/usr/vpd/runtime/rt_vpd.C
@@ -94,7 +94,7 @@ errlHndl_t getPnorAddr( pnorInformation & i_pnorInfo,
g_hostInterfaces != NULL &&
g_hostInterfaces->get_reserved_mem)
{
- vpd_addr = g_hostInterfaces->get_reserved_mem("ibm,hbrt-vpd-image");
+ vpd_addr = g_hostInterfaces->get_reserved_mem("ibm,hbrt-vpd-image",0);
if(vpd_addr == 0)
{
TRACFCOMP(g_trac_vpd,ERR_MRK"rt_vpd: Failed to get VPD addr. "
OpenPOWER on IntegriCloud