From 920ab5c89a622cb21d31ca9fb27e39c2e1c90935 Mon Sep 17 00:00:00 2001 From: Thi Tran Date: Thu, 24 Jul 2014 08:48:20 -0500 Subject: SW268884: INITPROC: FSP&Hostboot - New sleep attribute and associated CMVC-Prereq:931657 CQ:SW268884 Change-Id: Ie9ab8334c224ece3cb5e68a2c0a59a942208c4f7 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/12117 Reviewed-by: Thi N. Tran Tested-by: Thi N. Tran Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/12428 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III --- src/build/citest/etc/bbuild | 2 +- .../hwp/build_winkle_images/build_winkle_images.C | 10 +- .../p8_slw_build/p8_delta_scan_rw.h | 10 +- .../p8_slw_build/p8_slw_build_errors.xml | 31 ++++- .../p8_slw_build/p8_slw_build_fixed.C | 138 ++++++++++++++++++++- .../p8_slw_build/p8_xip_customize.C | 36 +++++- .../hwp/runtime_attributes/pm_plat_attributes.xml | 22 +++- src/usr/runtime/common/hsvc_sysdata.C | 5 +- .../targeting/common/xmltohb/attribute_types.xml | 22 ++++ src/usr/targeting/common/xmltohb/target_types.xml | 1 + 10 files changed, 263 insertions(+), 14 deletions(-) diff --git a/src/build/citest/etc/bbuild b/src/build/citest/etc/bbuild index e7e9f3ed5..e90835720 100644 --- a/src/build/citest/etc/bbuild +++ b/src/build/citest/etc/bbuild @@ -1 +1 @@ -/esw/fips820/Builds/built/ +/esw/fips820/Builds/b0728a_1430.820/ diff --git a/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C b/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C index 609cc7f08..6e4b18847 100644 --- a/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C +++ b/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* [+] 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. */ @@ -436,6 +438,12 @@ void* call_host_build_winkle( void *io_pArgs ) assert (l_memBase != 0, "host_build_winkle: Top of memory was 0!"); l_memBase -= VMM_ALL_HOMER_OCC_MEMORY_SIZE; + // Also, enable sleep mode + TARGETING::Target* l_sys = NULL; + TARGETING::targetService().getTopLevelTarget(l_sys); + assert( l_sys != NULL ); + uint8_t l_sleepEnable = 1; + l_sys->setAttr(l_sleepEnable); } TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "HOMER base = %x", l_memBase); diff --git a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_delta_scan_rw.h b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_delta_scan_rw.h index f76973185..29f5b4a4a 100644 --- a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_delta_scan_rw.h +++ b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_delta_scan_rw.h @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* [+] 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. */ @@ -20,7 +22,7 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: p8_delta_scan_rw.h,v 1.49 2014/05/13 13:31:51 jmcgill Exp $ +// $Id: p8_delta_scan_rw.h,v 1.51 2014/07/03 19:40:37 jmcgill Exp $ #define OVERRIDE_OFFSET 8 // Byte offset of forward pointer's addr relative // to base forward pointer's addr. #define SIZE_IMAGE_BUF_MAX 5000000 // Max ~5MB image buffer size. @@ -43,7 +45,10 @@ #define PERV_BNDY_PLL_RING_ALT_TOC_NAME "perv_bndy_pll_ring_alt" #define MAX_FUNC_L3_RING_LIST_ENTRIES 64 #define MAX_FUNC_L3_RING_SIZE 7000 // Bytes +#define MAX_FARY_L2_RING_LIST_ENTRIES 2 +#define MAX_FARY_L2_RING_SIZE 8400 // Bytes #define FUNC_L3_RING_TOC_NAME "ex_func_l3_ring" +#define FARY_L2_RING_TOC_NAME "ex_fary_l2_ring" #define MAX_CEN_PLL_RING_SIZE 80 // Bytes #define TP_PLL_BNDY_RING_ALT_TOC_NAME "tp_pll_bndy_ring_alt" #define STANDALONE_MBOX0_VALUE_TOC_NAME "standalone_mbox0_value" @@ -53,6 +58,7 @@ #define UNTRUSTED_BAR_TOC_NAME "fabric_config" #define UNTRUSTED_PBA_BAR_TOC_NAME "fabric_config_pba" #define REFCLOCK_TERM_TOC_NAME "refclock_term" +#define PM_SLEEP_ENABLE_TOC_NAME "pm_sleep_enable" /***** Scan setting *****/ #define OPCG_SCAN_RATIO 4 diff --git a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_slw_build_errors.xml b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_slw_build_errors.xml index a76559e00..8dff7aa56 100644 --- a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_slw_build_errors.xml +++ b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_slw_build_errors.xml @@ -5,7 +5,9 @@ - + + + @@ -20,7 +22,7 @@ - + @@ -207,7 +209,30 @@ CODE HIGH - + + + + RC_PROC_SLWB_L2_FARY_OVERLAY_ERROR + Existing ring has 1-bits in overlay locations. + DATA_FAIL_BYTE_NO + DATA_EXISTING_RING_BYTE + DATA_OVERLAY_RING_BYTE + + CODE + HIGH + + + + + RC_PROC_SLWB_SLEEP_PROCESSING_ERROR + Unsupported chip type/EC combination found in sleep procesing code. + CT + EC + + CODE + HIGH + + RC_PROC_SLWB_WF_CREATION_ERROR diff --git a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_slw_build_fixed.C b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_slw_build_fixed.C index fc266b0c6..18d5a5e76 100644 --- a/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_slw_build_fixed.C +++ b/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_slw_build_fixed.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ +/* Contributors Listed Below - COPYRIGHT 2013,2014 */ +/* [+] 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. */ @@ -20,7 +22,7 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: p8_slw_build_fixed.C,v 1.19 2014/05/28 02:32:41 cmolsen Exp $ +// $Id: p8_slw_build_fixed.C,v 1.20 2014/07/25 19:42:24 jmcgill Exp $ /*------------------------------------------------------------------------------*/ /* *! TITLE : p8_slw_build_fixed */ /* *! DESCRIPTION : Extracts and decompresses delta ring states from EPROM */ @@ -296,11 +298,16 @@ ReturnCode p8_slw_build_fixed( const fapi::Target &i_target, // Get various FAPI attributes and variables needed for ring unraveling. // ========================================================================== uint8_t attrAsyncSafeMode=0, bAsyncSafeMode; + uint8_t attrSleepEnable=1, bSleepEnable; uint32_t attrFuncL3RingList[MAX_FUNC_L3_RING_LIST_ENTRIES]={0}; uint8_t attrFuncL3RingData[MAX_FUNC_L3_RING_SIZE]={0}; + uint32_t attrFaryL2RingList[MAX_FARY_L2_RING_LIST_ENTRIES]={0}; + uint8_t attrFaryL2RingData[MAX_FARY_L2_RING_SIZE]={0}; uint32_t attrFuncL3RingLength=0; + uint32_t attrFaryL2RingLength=0; SbeXipItem xipTocItem; uint64_t xipFuncL3RingVector=0; + uint64_t xipFaryL2RingVector=0; uint32_t iEntry; // Safe mode status. @@ -349,6 +356,80 @@ ReturnCode p8_slw_build_fixed( const fapi::Target &i_target, } xipFuncL3RingVector = xipTocItem.iv_address; } + + // sleep enable/disable + rc = FAPI_ATTR_GET(ATTR_PM_SLEEP_ENABLE, NULL, attrSleepEnable); + FAPI_DBG("--> attrSleepEnable = 0x%x ", attrSleepEnable); + if (rc) { + FAPI_ERR("FAPI_ATTR_GET(ATTR_PROC_SLEEP_ENABLE) returned error."); + return rc; + } + bSleepEnable = attrSleepEnable; + FAPI_DBG("--> bSleepEnable = 0x%x ",bSleepEnable); + // Obtain ring name and ring's vector location from image. + if (bSleepEnable) { + uint8_t chipType; + rc = FAPI_ATTR_GET_PRIVILEGED(ATTR_NAME, &i_target, chipType); + if (rc) { + FAPI_ERR("FAPI_ATTR_GET_PRIVILEGED() failed w/rc=%i and chipType=0x%02x",(uint32_t)rc,chipType); + return rc; + } + // configure overlay ring/ring length based on CT/EC + if ((chipType == fapi::ENUM_ATTR_NAME_MURANO) && (ddLevel < 0x20)) + { + attrFaryL2RingList[0] = 0x1E2100C0; + attrFaryL2RingList[1] = 0xFFFF0000; + attrFaryL2RingLength = 82649; + } + else if ((chipType == fapi::ENUM_ATTR_NAME_MURANO) && (ddLevel >= 0x20)) + { + attrFaryL2RingList[0] = 0x1DC4000C; + attrFaryL2RingList[1] = 0xFFFF0000; + attrFaryL2RingLength = 83294; + } + else if ((chipType == fapi::ENUM_ATTR_NAME_VENICE) && (ddLevel < 0x20)) + { + attrFaryL2RingList[0] = 0x1DA600C0; + attrFaryL2RingList[1] = 0xFFFF0000; + attrFaryL2RingLength = 83050; + } + else if (((chipType == fapi::ENUM_ATTR_NAME_VENICE) && (ddLevel >= 0x20)) || + (chipType == fapi::ENUM_ATTR_NAME_NAPLES)) + { + attrFaryL2RingList[0] = 0x1DC50003; + attrFaryL2RingList[1] = 0xFFFF0000; + attrFaryL2RingLength = 83304; + } + else + { + FAPI_ERR("Unsupported CT/EC combination in sleep processing code!"); + const uint8_t CT = chipType; + const uint8_t EC = ddLevel; + FAPI_SET_HWP_ERROR(rc, RC_PROC_SLWB_SLEEP_PROCESSING_ERROR); + return rc; + } + + for (iEntry=0; iEntry>16] = (uint8_t)((attrFaryL2RingList[iEntry]<<24)>>24); + } + else + break; + } + FAPI_DBG("Overlay [raw] ring created for func L3 ring."); + + // Get ring name from xip image. + rcLoc = sbe_xip_find((void*)i_imageIn, FARY_L2_RING_TOC_NAME, &xipTocItem); + if (rcLoc) { + FAPI_ERR("sbe_xip_find() failed w/rc=%i", rcLoc); + FAPI_ERR("Probable cause:"); + FAPI_ERR("\tThe keyword (=%s) was not found.", FARY_L2_RING_TOC_NAME); + uint32_t & RC_LOCAL = rcLoc; + FAPI_SET_HWP_ERROR(rc, RC_PROC_SLWB_KEYWORD_NOT_FOUND_ERROR); + return rc; + } + xipFaryL2RingVector = xipTocItem.iv_address; + } #endif @@ -493,6 +574,59 @@ ReturnCode p8_slw_build_fixed( const fapi::Target &i_target, } #endif + +#ifndef IMGBUILD_PPD_IGNORE_XIPC + // ========================================================================== + // CUSTOMIZE item: Overlay ex_fary_l2_ring + // Note: Check if ex_fary_l2_ring's vector address matches current backPtr. + // If so, perform OR operation with new attribute data for this ring. + // Assumptions: + // - Base ring only. + // - Correct DD level rings only. + // ========================================================================== + byteExisting=0, byteOverlay=0, bGoodByte=1; + if (bSleepEnable) { + // Find ring match by comparing backItemPtr and ring lengths. Note that + // we can't use fwdPtr for finding a match since we don't know which DD + // level ring it ended up pointing at. + if (xipFaryL2RingVector==myRev64(rs4RingLayout.backItemPtr) && + attrFaryL2RingLength==myRev32(deltaRingRS4->iv_length)) { + // Perform OR between the existing ring and attribute ring. + sizeRingInBytes = (attrFaryL2RingLength-1)/8 + 1; + bGoodByte = 1; + FAPI_DBG("Byte[ # ]: ER OR =ER? "); + FAPI_DBG("-----------------------"); + for (iByte=0; (iByte - + + + @@ -20,7 +22,7 @@ - + + + ATTR_PM_SLEEP_ENABLE + TARGET_TYPE_SYSTEM + Control HW response to execution of PPC sleep instruction + if OFF, treat sleep as nap + if ON, treat sleep as sleep + + Producer: Hostboot + + Consumer: p8_slw_build.C + + uint8 + OFF=0, ON=1 + + + ATTR_PM_SLEEP_ENTRY TARGET_TYPE_PROC_CHIP diff --git a/src/usr/runtime/common/hsvc_sysdata.C b/src/usr/runtime/common/hsvc_sysdata.C index 1c195c7f6..827c165dc 100644 --- a/src/usr/runtime/common/hsvc_sysdata.C +++ b/src/usr/runtime/common/hsvc_sysdata.C @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* [+] 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. */ @@ -78,6 +80,7 @@ HSVC_LOAD_ATTR( ATTR_PROC_R_LOADLINE_VCS ); HSVC_LOAD_ATTR( ATTR_PROC_R_LOADLINE_VDD ); HSVC_LOAD_ATTR( ATTR_PROC_VRM_VOFFSET_VCS ); HSVC_LOAD_ATTR( ATTR_PROC_VRM_VOFFSET_VDD ); +HSVC_LOAD_ATTR( ATTR_PM_SLEEP_ENABLE ); // -- Input: ../../xml/attribute_info/poreve_memory_attributes.xml -- // No attributes found // -- Input: ../../xml/attribute_info/proc_chip_ec_feature.xml -- diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml index ab55fbd9d..17643aaef 100644 --- a/src/usr/targeting/common/xmltohb/attribute_types.xml +++ b/src/usr/targeting/common/xmltohb/attribute_types.xml @@ -14208,4 +14208,26 @@ firmware notes: Platforms should initialize this attribute to AUTO (0) + + PM_SLEEP_ENABLE + Control HW response to execution of PPC sleep instruction + if OFF, treat sleep as nap + if ON, treat sleep as sleep + Producer: Hostboot + Consumer: p8_slw_build.C + + + + 0x0 + + + volatile-zeroed + + + + ATTR_PM_SLEEP_ENABLE + DIRECT + + + diff --git a/src/usr/targeting/common/xmltohb/target_types.xml b/src/usr/targeting/common/xmltohb/target_types.xml index f7186f0c5..575905118 100644 --- a/src/usr/targeting/common/xmltohb/target_types.xml +++ b/src/usr/targeting/common/xmltohb/target_types.xml @@ -273,6 +273,7 @@ MSS_VOLT_DDR4_VDDR_INTERCEPT MSS_VDDR_OVERIDE_SPD PM_PFET_WORKAROUND_RUN_FLAG + PM_SLEEP_ENABLE -- cgit v1.2.1