Skip to content

Commit

Permalink
Enable HDAT HB reserved memory when supported by FSP
Browse files Browse the repository at this point in the history
Change-Id: Id0b156282e0197c6a8ed32d2e60066cb5c149edd
RTC: 169478
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/42077
Reviewed-by: Martin Gloff <mgloff@us.ibm.com>
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>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
mderkse1 authored and dcrowell77 committed Jul 11, 2017
1 parent 06b6c5e commit 61f38bd
Show file tree
Hide file tree
Showing 18 changed files with 345 additions and 451 deletions.
3 changes: 0 additions & 3 deletions src/include/runtime/interface.h
Expand Up @@ -120,9 +120,6 @@ enum MemoryError_t
* Reserved memory labels - used by get_reserved_mem
*/
#define HBRT_RSVD_MEM__CODE "ibm,hbrt-code-image"
#define HBRT_RSVD_MEM__ATTRIBUTES "ibm,hbrt-target-image"
#define HBRT_RSVD_MEM__VPD_CACHE "ibm,hbrt-vpd-image"
#define HBRT_RSVD_MEM__OVERRIDES "ibm,hbrt-targetoverride-image"
#define HBRT_RSVD_MEM__PRIMARY "ibm,hb-rsv-mem"
#define HBRT_RSVD_MEM__HOMER "ibm,homer-image"
#define HBRT_RSVD_MEM__OCC_COMMON "ibm,occ-common-area"
Expand Down
8 changes: 0 additions & 8 deletions src/include/usr/runtime/runtime.H
Expand Up @@ -99,14 +99,6 @@ errlHndl_t populate_hbTpmInfo( void );
*/
errlHndl_t populate_TpmInfoByNode();

/**
* @brief Fills in HBRT for given NODE
*
* @param[in] iNodeId : Node number from 0 to 7 ..etc...
*
* @return errlHndl_t NULL on Success
*/
errlHndl_t populate_RtDataByNode(uint64_t iNodeId);

// How many pointers/sections there are in HB runtime data
#define HBRT_NUM_PTRS 2
Expand Down
1 change: 1 addition & 0 deletions src/include/usr/targeting/common/targreasoncodes.H
Expand Up @@ -72,6 +72,7 @@ enum TargetingReasonCode
TARG_RC_WRITE_ATTR_OVER_NO_TANK_LAYER = TARG_COMP_ID | 0x12,
TARG_RC_MM_BLOCK_MAP_FAIL = TARG_COMP_ID | 0x13,
TARG_RC_APPLY_ATTR_OVER_NOT_ALLOWED = TARG_COMP_ID | 0x14,
TARG_RC_MM_BLOCK_UNMAP_FAIL = TARG_COMP_ID | 0x15,
};

}; // End TARGETING namespace
Expand Down
51 changes: 4 additions & 47 deletions src/include/usr/util/runtime/util_rt.H
Expand Up @@ -23,52 +23,7 @@
/* */
/* IBM_PROLOG_END_TAG */

#include <limits.h> // for KILOBYTE definition


/**
* 8-byte ascii entry labels for hbrt TOC
*/
typedef uint64_t hbrt_mem_label_t;

// Ascii label "VPD " in hex
constexpr hbrt_mem_label_t HBRT_MEM_LABEL_VPD = 0x5650442020202020;

// Ascii label "ATTR " in hex
constexpr hbrt_mem_label_t HBRT_MEM_LABEL_ATTR = 0x4154545220202020;

// Ascii label "ATTROVER" in hex
constexpr hbrt_mem_label_t HBRT_MEM_LABEL_ATTROVER = 0x415454524F564552;

// Ascii label "PADDING " in hex
constexpr hbrt_mem_label_t HBRT_MEM_LABEL_PADDING = 0x50414444494E4720;

/** @brief A 32 byte table of contents entry */
struct hbrtTableOfContentsEntry_t
{
uint64_t label; // ASCII HBRT_LABEL_x constants
uint64_t size; // data entry size in bytes
uint64_t offset; // offset into section
uint64_t reserved; // incase of future change
} __attribute__ ((packed));

// MAX ENTRIES = (4 KB - 64 byte header) / 32 bytes per entry = 126
#define HBRT_TOC_MAX_ENTRIES \
(((4*KILOBYTE) - 64) / sizeof(hbrtTableOfContentsEntry_t))

/** @brief A 4KB Table of Contents */
struct hbrtTableOfContents_t
{
char toc_header[32]; // "Hostboot Table of Contents"
uint8_t toc_version; // version
uint16_t total_entries; // Total entries in TOC
uint64_t total_size; // Total data section size (64k aligned)
uint8_t rsvd[21]; // reserved
hbrtTableOfContentsEntry_t entry[HBRT_TOC_MAX_ENTRIES];
} __attribute__ ((packed));

// Versions of table of contents
const uint8_t HBRT_TOC_VERSION_1 = 0x01;
#include <util/utilrsvdmem.H>

/**
* @brief Get the address of a reserved hostboot memory region by its label
Expand All @@ -78,7 +33,9 @@ const uint8_t HBRT_TOC_VERSION_1 = 0x01;
* @return virtual address of region or 0
* @platform FSP, OpenPOWER
**/
uint64_t hb_get_rt_rsvd_mem( hbrt_mem_label_t i_label,
uint64_t hb_get_rt_rsvd_mem( Util::hbrt_mem_label_t i_label,
uint32_t i_instance,
uint64_t & o_size );



90 changes: 90 additions & 0 deletions src/include/usr/util/utilrsvdmem.H
@@ -0,0 +1,90 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/include/usr/util/utilrsvdmem.H $ */
/* */
/* 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 */
#ifndef UTILRSVDMEM_H
#define UTILRSVDMEM_H

#include <limits.h> // for KILOBYTE definition

namespace Util
{
/**
* 8-byte ascii entry labels for hbrt TOC
*/
typedef uint64_t hbrt_mem_label_t;

// Ascii label "VPD " in hex
constexpr hbrt_mem_label_t HBRT_MEM_LABEL_VPD = 0x5650442020202020;

// Ascii label "ATTR " in hex
constexpr hbrt_mem_label_t HBRT_MEM_LABEL_ATTR = 0x4154545220202020;

// Ascii label "ATTROVER" in hex
constexpr hbrt_mem_label_t HBRT_MEM_LABEL_ATTROVER = 0x415454524F564552;

// Ascii label "PADDING " in hex
constexpr hbrt_mem_label_t HBRT_MEM_LABEL_PADDING = 0x50414444494E4720;

/** @brief A 32 byte table of contents entry */
struct hbrtTableOfContentsEntry_t
{
uint64_t label; // ASCII HBRT_LABEL_x constants
uint64_t size; // data entry size in bytes
uint64_t offset; // offset into section
uint64_t reserved; // incase of future change
} __attribute__ ((packed));

// MAX ENTRIES = (4 KB - 64 byte header) / 32 bytes per entry = 126
#define HBRT_TOC_MAX_ENTRIES \
(((4*KILOBYTE) - 64) / sizeof(hbrtTableOfContentsEntry_t))

/** @brief A 4KB Table of Contents */
struct hbrtTableOfContents_t
{
char toc_header[32]; // "Hostboot Table of Contents"
uint8_t toc_version; // version
uint16_t total_entries; // Total entries in TOC
uint64_t total_size; // Total data section size (64k aligned)
uint8_t rsvd[21]; // reserved
hbrtTableOfContentsEntry_t entry[HBRT_TOC_MAX_ENTRIES];
} __attribute__ ((packed));

// Versions of table of contents
const uint8_t HBRT_TOC_VERSION_1 = 0x01;

/**
* @brief Get the address of a label's section based on TOC
* @param[in] i_label - HBRT_MEM_LABEL_... constant
* @param[in] i_hb_data_toc_addr - pointer to the table of contents
* @param[out] o_size - size of returned region in bytes
* @return virtual address of region or 0
* @platform FSP, OpenPOWER
**/
uint64_t hb_find_rsvd_mem_label(hbrt_mem_label_t i_label,
hbrtTableOfContents_t * i_hb_data_toc_addr,
uint64_t & o_size);

};

#endif // UTILRSVDMEM_H
38 changes: 14 additions & 24 deletions src/include/usr/vmmconst.h
Expand Up @@ -168,40 +168,30 @@ enum BlockPriority
#define VMM_ALL_HOMER_OCC_MEMORY_SIZE \
(VMM_OCC_COMMON_SIZE + VMM_HOMER_REGION_SIZE)

/** Memory offset for runtime VPD image */
// Given value is number of bytes BELOW the top of memory to store
// the runtime image(s) Currently below the OCC HOMER IMAGE
#define VMM_RT_VPD_OFFSET (VMM_RT_VPD_SIZE + \
VMM_ALL_HOMER_OCC_MEMORY_SIZE)

/** Memory for VPD */
#define VMM_VPD_START_OFFSET VMM_OCC_COMMON_END_OFFSET
#define VMM_MODULE_VPD_SIZE (512*KILOBYTE) /* must be 64KB aligned */
#define VMM_CENTAUR_VPD_SIZE (256*KILOBYTE) /* must be 64KB aligned */
#define VMM_DIMM_JEDEC_VPD_SIZE (256*KILOBYTE) /* must be 64KB aligned */
#define VMM_RT_VPD_SIZE (VMM_MODULE_VPD_SIZE + \
VMM_CENTAUR_VPD_SIZE + \
VMM_DIMM_JEDEC_VPD_SIZE)
/** End of VPD Area = 201MB */

/** Memory for attribute data */
#define VMM_ATTR_DATA_START_OFFSET \
(VMM_VPD_START_OFFSET + VMM_RT_VPD_SIZE)
#define VMM_ATTR_DATA_START_OFFSET VMM_OCC_COMMON_END_OFFSET
#define VMM_ATTR_DATA_SIZE (1*MEGABYTE)
/** End of Attr Area = 202MB */
/** End of Attr Area = 201MB */

/** Chunk of physical memory used for Dump Source Table */
#define DUMP_TEST_MEMORY_ADDR \
(VMM_ATTR_DATA_START_OFFSET + VMM_ATTR_DATA_SIZE) /* currently 202MB */
(VMM_ATTR_DATA_START_OFFSET + VMM_ATTR_DATA_SIZE) /* currently 201MB */
#define DUMP_TEST_MEMORY_SIZE (4*MEGABYTE)
/** End of Dump Source Table = 206MB */
/** End of Dump Source Table = 205MB */

/** Memory for hostboot data Table of Contents */
#define VMM_HB_DATA_TOC_START_OFFSET \
(DUMP_TEST_MEMORY_ADDR + DUMP_TEST_MEMORY_SIZE) /* currently 206MB */
#define VMM_HB_DATA_TOC_END_OFFSET (VMM_HB_DATA_TOC_START_OFFSET + (4*KILOBYTE))
/** End of HB DATA TOC Area = 206MB + 4KB */
(DUMP_TEST_MEMORY_ADDR + DUMP_TEST_MEMORY_SIZE) /* currently 205MB */

/** Variable Attribute overrides and Attributes memory here **/

/** Memory for VPD (1 MB total) */
#define VMM_MODULE_VPD_SIZE (512*KILOBYTE) /* must be 64KB aligned */
#define VMM_CENTAUR_VPD_SIZE (256*KILOBYTE) /* must be 64KB aligned */
#define VMM_DIMM_JEDEC_VPD_SIZE (256*KILOBYTE) /* must be 64KB aligned */
#define VMM_RT_VPD_SIZE ( VMM_MODULE_VPD_SIZE + \
VMM_CENTAUR_VPD_SIZE + \
VMM_DIMM_JEDEC_VPD_SIZE )


/** Internode communication area outside of the HB image.
Expand Down
6 changes: 2 additions & 4 deletions src/include/usr/vpd/vpd_if.H
Expand Up @@ -49,12 +49,10 @@ namespace VPD

/**
* @brief Load the runtime VPD image into memory
* @param[in/out] The physical or virtual address of the VPD image
* @param[in] Is the address virtual?
* @param[in] The virtual address of the VPD image
* @return error handle if there was an error
*/
errlHndl_t vpd_load_rt_image(uint64_t & io_vpd_addr,
bool i_virtualAddr = false);
errlHndl_t vpd_load_rt_image(uint64_t & i_vpd_addr);

/**
* @brief This function checks to see if the given mvpd target
Expand Down

0 comments on commit 61f38bd

Please sign in to comment.