diff options
author | Andres Lugo <aalugore@us.ibm.com> | 2015-02-04 13:08:33 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-02-20 07:30:42 -0600 |
commit | 840f51601c3a261b838d4bc1f83f4fbb3379bff8 (patch) | |
tree | 3735ade1cba2bafcfcd3e02bf2e808c783e0b0ea /src/usr/hwpf/hwp/pstates | |
parent | 27809d56544caa11f43b21321a519c5bd9014054 (diff) | |
download | talos-hostboot-840f51601c3a261b838d4bc1f83f4fbb3379bff8.tar.gz talos-hostboot-840f51601c3a261b838d4bc1f83f4fbb3379bff8.zip |
OpenPOWER support to set PROC_BOOT_VOLTAGE_VID
Change-Id: I18c31e0580ca7044e999326b1c994edbfb305c11
RTC:121693
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/15645
Tested-by: Jenkins Server
Reviewed-by: WILLIAM G. HOFFA <wghoffa@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/hwp/pstates')
-rw-r--r-- | src/usr/hwpf/hwp/pstates/makefile | 10 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/pstates/pstates/freqVoltageSvc.C | 42 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/pstates/pstates/freqVoltageSvc.H | 25 |
3 files changed, 52 insertions, 25 deletions
diff --git a/src/usr/hwpf/hwp/pstates/makefile b/src/usr/hwpf/hwp/pstates/makefile index 21a98b899..dbfe05529 100644 --- a/src/usr/hwpf/hwp/pstates/makefile +++ b/src/usr/hwpf/hwp/pstates/makefile @@ -5,9 +5,9 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2013,2014 -# [+] International Business Machines Corp. +# Contributors Listed Below - COPYRIGHT 2013,2015 # [+] Google Inc. +# [+] International Business Machines Corp. # # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,6 +32,7 @@ EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/initservice ## pointer to common HWP files EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/include @@ -39,7 +40,7 @@ EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/include ## NOTE: add the base istep dir here. ##@ EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/@istepname EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/pstates - +EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/slave_sbe ## Include sub dirs ## NOTE: add a new EXTRAINCDIR when you add a new HWP ##@ EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/??? @@ -54,8 +55,7 @@ OBJS += p8_build_pstate_datablock.o OBJS += proc_get_voltage.o OBJS += pstates.o OBJS += pstate_tables.o -OBJS += $(if $(CONFIG_SET_NOMINAL_PSTATE)$(CONFIG_HTMGT),freqVoltageSvc.o) - +OBJS += freqVoltageSvc.o OBJS += proc_set_max_pstate.o ## NOTE: add a new directory onto the vpaths when you add a new HWP diff --git a/src/usr/hwpf/hwp/pstates/pstates/freqVoltageSvc.C b/src/usr/hwpf/hwp/pstates/pstates/freqVoltageSvc.C index cfda8a083..c690d1568 100644 --- a/src/usr/hwpf/hwp/pstates/pstates/freqVoltageSvc.C +++ b/src/usr/hwpf/hwp/pstates/pstates/freqVoltageSvc.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014 */ +/* Contributors Listed Below - COPYRIGHT 2014,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -43,12 +43,14 @@ #include <fapiPlatHwpInvoker.H> #include <hwpf/fapi/fapiMvpdAccess.H> #include <hwpf/hwpf_reasoncodes.H> +#include <slave_sbe.H> #include <p8_build_pstate_datablock.H> #include <proc_get_voltage.H> #include <pstates.h> #include <targeting/common/commontargeting.H> #include <targeting/common/utilFilter.H> #include <vpd/mvpdenums.H> +#include <initserviceif.H> extern trace_desc_t* g_fapiTd; @@ -362,35 +364,55 @@ namespace FREQVOLTSVC // FREQVOLTSVC::runProcGetVoltage //************************************************************************** errlHndl_t runProcGetVoltage( - const TARGETING::Target * i_procChip, - const uint32_t i_bootFreqMhz, - uint8_t & o_vdd_vid, - uint8_t & o_vcs_vid) + TARGETING::Target * io_procChip, + const uint32_t i_bootFreqMhz) { + TRACDCOMP(g_fapiTd,INFO_MRK"Enter runProcGetVoltage"); + + uint8_t l_vdd_vid = 0; + uint8_t l_vcs_vid = 0; + errlHndl_t l_err = NULL; + TARGETING::ATTR_BOOT_VOLTAGE_type l_boot_voltage_info = + PROC_BOOT_VOLT_PORT0_ENABLE; - TRACFCOMP(g_fapiTd,INFO_MRK"i_bootFreqMhz: 0x%08X",i_bootFreqMhz); + TRACDCOMP(g_fapiTd,INFO_MRK"i_bootFreqMhz: 0x%08X",i_bootFreqMhz); // Assert on NULL input target - assert(i_procChip != NULL); + // If the target is NULL, we have NO functional PROCS. + // Terminate IPL + assert(io_procChip != NULL); // convert to fapi target fapi::Target l_fapiProcChip(fapi::TARGET_TYPE_PROC_CHIP, reinterpret_cast<void *> - (const_cast<TARGETING::Target*>(i_procChip))); + (const_cast<TARGETING::Target*>(io_procChip))); // Invoke HW procedure FAPI_INVOKE_HWP(l_err, proc_get_voltage,l_fapiProcChip,i_bootFreqMhz, - o_vdd_vid,o_vcs_vid); + l_vdd_vid,l_vcs_vid); if( l_err != NULL) { TRACFCOMP( g_fapiTd,ERR_MRK"Error from HWP: proc_get_voltage: " "i_bootFreq: 0x%08X, " "HUID: 0x%08X", i_bootFreqMhz, - i_procChip->getAttr<TARGETING::ATTR_HUID>()); + io_procChip->getAttr<TARGETING::ATTR_HUID>()); } + TRACDCOMP("Vdd: 0x%02x, vcs: 0x%02x", l_vdd_vid, l_vcs_vid); + + // create boot voltage value + l_boot_voltage_info |= ( ( static_cast<uint32_t>(l_vdd_vid) << + PROC_BOOT_VOLT_VDD_SHIFT) & ( PROC_BOOT_VOLT_VDD_MASK ) ); + l_boot_voltage_info |= ( ( static_cast<uint32_t>(l_vcs_vid) << + PROC_BOOT_VOLT_VCS_SHIFT) & ( PROC_BOOT_VOLT_VDD_MASK ) ); + + // set ATTR_PROC_BOOT_VOLTAGE_VID + io_procChip->setAttr< + TARGETING::ATTR_PROC_BOOT_VOLTAGE_VID>( l_boot_voltage_info ); + + return l_err; } diff --git a/src/usr/hwpf/hwp/pstates/pstates/freqVoltageSvc.H b/src/usr/hwpf/hwp/pstates/pstates/freqVoltageSvc.H index 183f7be9e..b8f047b29 100644 --- a/src/usr/hwpf/hwp/pstates/pstates/freqVoltageSvc.H +++ b/src/usr/hwpf/hwp/pstates/pstates/freqVoltageSvc.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014 */ +/* Contributors Listed Below - COPYRIGHT 2014,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -40,6 +40,17 @@ namespace FREQVOLTSVC { + +/** + * @brief - Constants used to calculate boot voltage value and set + * ATTR_PROC_BOOT_VOLTAGE_VID attribute. + */ +static const uint32_t PROC_BOOT_VOLT_PORT0_ENABLE = 0x80000000; +static const uint8_t PROC_BOOT_VOLT_VDD_SHIFT = 16; +static const uint8_t PROC_BOOT_VOLT_VCS_SHIFT = 8; +static const uint32_t PROC_BOOT_VOLT_VDD_MASK = 0x00ff0000; +static const uint32_t PROC_BOOT_VOLT_VCS_MASK = 0x0000ff00; + /** * @brief Set system frequency attribute * @@ -81,24 +92,18 @@ namespace FREQVOLTSVC * This function is wrapper for executing proc_get_voltage * HW procedure. * - * @param[in] i_procChip + * @param[in] io_procChip * Valid functional Processor Chip target pointer * @param[in] i_bootFreqMhz * Boot Frequency in MHZ - * @param[out] o_vdd_vid - * On success, holds VDD value - * @param[out] o_vcs_vid - * On success, holds VCS value * * @return Error log handle indicating the status of the request * * @retval NULL Successfully retrieved boot voltage data * @retval !NULL Failed to get boot voltage, ignore output */ - errlHndl_t runProcGetVoltage(const TARGETING::Target * i_procChip, - const uint32_t i_bootFreqMhz, - uint8_t & o_vdd_vid, - uint8_t & o_vcs_vid); + errlHndl_t runProcGetVoltage(TARGETING::Target * io_procChip, + const uint32_t i_bootFreqMhz); /** * @brief Get system frequency |