Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
p9_stop_api's are used to set SPR state on a core wakeup form a deeper low power state. p9_stop_api uses low level platform formware and self-restore microcode to restore the sprs to requested values. Code is taken from : https://github.com/open-power/hostboot/tree/master/src/import/chips/p9/procedures/utils/stopreg Signed-off-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com> Reviewed-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
- Loading branch information
1 parent
eeb4d32
commit d7631e5
Showing
10 changed files
with
2,585 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
/* IBM_PROLOG_BEGIN_TAG */ | ||
/* This is an automatically generated prolog. */ | ||
/* */ | ||
/* $Source: src/import/chips/p9/procedures/utils/stopreg/p9_stop_api.H $ */ | ||
/* */ | ||
/* OpenPOWER HostBoot Project */ | ||
/* */ | ||
/* Contributors Listed Below - COPYRIGHT 2015,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 __P9_STOP_IMAGE_API_ | ||
#define __P9_STOP_IMAGE_API_ | ||
|
||
#include <stdint.h> | ||
|
||
#ifdef __SKIBOOT__ | ||
#include <skiboot.h> | ||
#endif | ||
|
||
/// | ||
/// @file p9_stop_api.H | ||
/// @brief describes STOP API which create/manipulate STOP image. | ||
/// | ||
// *HWP HW Owner : Greg Still <stillgs@us.ibm.com> | ||
// *HWP FW Owner : Prem Shanker Jha <premjha2@in.ibm.com> | ||
// *HWP Team : PM | ||
// *HWP Level : 2 | ||
// *HWP Consumed by : HB:HYP | ||
|
||
#ifdef __cplusplus | ||
namespace stopImageSection | ||
{ | ||
#endif | ||
|
||
/** | ||
* @brief all SPRs and MSR for which register restore is to be supported. | ||
* @note STOP API design has built in support to accomodate 8 register of | ||
* scope core and thread each. | ||
*/ | ||
typedef enum | ||
{ | ||
P9_STOP_SPR_DAWR = 180, // thread register | ||
P9_STOP_SPR_HSPRG0 = 304, // thread register | ||
P9_STOP_SPR_HRMOR = 313, // core register | ||
P9_STOP_SPR_LPCR = 318, // thread register | ||
P9_STOP_SPR_HMEER = 337, // core register | ||
P9_STOP_SPR_LDBAR = 850, // thread register | ||
P9_STOP_SPR_PSSCR = 855, // thread register | ||
P9_STOP_SPR_PMCR = 884, // core register | ||
P9_STOP_SPR_HID = 1008, // core register | ||
P9_STOP_SPR_MSR = 2000, // thread register | ||
} CpuReg_t; | ||
|
||
/** | ||
* @brief lists all the bad error codes. | ||
*/ | ||
typedef enum | ||
{ | ||
STOP_SAVE_SUCCESS = 0, | ||
STOP_SAVE_ARG_INVALID_IMG = 1, | ||
STOP_SAVE_ARG_INVALID_REG = 2, | ||
STOP_SAVE_ARG_INVALID_THREAD = 3, | ||
STOP_SAVE_ARG_INVALID_MODE = 4, | ||
STOP_SAVE_ARG_INVALID_CORE = 5, | ||
STOP_SAVE_SPR_ENTRY_NOT_FOUND = 6, | ||
STOP_SAVE_SPR_ENTRY_UPDATE_FAILED = 7, | ||
STOP_SAVE_SCOM_INVALID_OPERATION = 8, | ||
STOP_SAVE_SCOM_INVALID_SECTION = 9, | ||
STOP_SAVE_SCOM_INVALID_ADDRESS = 10, | ||
STOP_SAVE_SCOM_INVALID_CHIPLET = 11, | ||
STOP_SAVE_SCOM_ENTRY_UPDATE_FAILED = 12, | ||
STOP_SAVE_INVALID_FUSED_CORE_STATUS = 13, | ||
STOP_SAVE_FAIL = 14, // for internal failure within firmware. | ||
} StopReturnCode_t; | ||
|
||
/** | ||
* @brief summarizes all operations supported on scom entries of STOP image. | ||
*/ | ||
typedef enum | ||
{ | ||
P9_STOP_SCOM_OP_MIN = 0, | ||
P9_STOP_SCOM_APPEND = 1, | ||
P9_STOP_SCOM_REPLACE = 2, | ||
P9_STOP_SCOM_OR = 3, | ||
P9_STOP_SCOM_AND = 4, | ||
P9_STOP_SCOM_NOOP = 5, | ||
P9_STOP_SCOM_RESET = 6, | ||
P9_STOP_SCOM_OR_APPEND = 7, | ||
P9_STOP_SCOM_AND_APPEND = 8, | ||
P9_STOP_SCOM_OP_MAX = 9 | ||
} ScomOperation_t; | ||
|
||
/** | ||
* @brief All subsections that contain scom entries in a STOP image. | ||
*/ | ||
typedef enum | ||
{ | ||
P9_STOP_SECTION_MIN = 0, | ||
P9_STOP_SECTION_CORE_SCOM = 1, | ||
P9_STOP_SECTION_EQ_SCOM = 2, | ||
P9_STOP_SECTION_L2 = 3, | ||
P9_STOP_SECTION_L3 = 4, | ||
P9_STOP_SECTION_MAX = 5 | ||
} ScomSection_t; | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
/** | ||
* @brief Updates STOP image entry associated with CPU register. | ||
* @param[in] i_pImage start address of homer image associated with processor. | ||
* @param[in] i_regId id of SPR for which STOP image needs to be updated. | ||
* @param[in] i_regData data to be restored in SPR register. | ||
* @param[in] i_pir value of processor identification register (PIR) | ||
* @return STOP_SAVE_SUCCESS SUCCESS if image is updated successfully, error | ||
* code otherwise. | ||
*/ | ||
|
||
StopReturnCode_t p9_stop_save_cpureg( void* const i_pImage, | ||
const CpuReg_t i_regId, | ||
const uint64_t i_regData, | ||
const uint64_t i_pir ); | ||
|
||
/** | ||
* @brief Updates scom image entry associated with given core or cache in | ||
* STOP section of homer image. | ||
* @param[in] i_pImage start address of homer image of P9 chip. | ||
* @param[in] i_scomAddress fully qualified address of SCOM register. | ||
* @param[in] i_scomData data associated with SCOM register. | ||
* @param[in] i_operation operation to be done on SCOM image entry. | ||
* @param[in] i_section area to which given SCOM entry belongs. | ||
* @return STOP_SAVE_SUCCESS if image is updated successfully, error code | ||
* otherwise. | ||
* @note API is intended to update SCOM image entry associated with given | ||
* core or given part of a cache section. API doesn't validate if | ||
* a given SCOM address really belongs to given section. | ||
*/ | ||
StopReturnCode_t p9_stop_save_scom( void* const i_pImage, | ||
const uint32_t i_scomAddress, | ||
const uint64_t i_scomData, | ||
const ScomOperation_t i_operation, | ||
const ScomSection_t i_section ); | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
}; // namespace stopImageSection ends | ||
#endif //__cplusplus | ||
|
||
#endif //__P9_STOP_IMAGE_API_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* IBM_PROLOG_BEGIN_TAG */ | ||
/* This is an automatically generated prolog. */ | ||
/* */ | ||
/* $Source: src/import/chips/p9/procedures/utils/stopreg/p9_cpu_reg_restore_instruction.H $ */ | ||
/* */ | ||
/* OpenPOWER HostBoot Project */ | ||
/* */ | ||
/* Contributors Listed Below - COPYRIGHT 2015,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 */ | ||
|
||
/// | ||
/// @file p9_cpu_reg_restore_instruction.H | ||
/// @brief enumerates all the opcodes used for SPR restoration. | ||
/// | ||
// *HWP HW Owner : Greg Still <stillgs@us.ibm.com> | ||
// *HWP FW Owner : Prem Shanker Jha <premjha2@in.ibm.com> | ||
// *HWP Team : PM | ||
// *HWP Level : 2 | ||
// *HWP Consumed by : HB:HYP | ||
|
||
#ifndef __REG_RESTORE_INSTRUCTION_H | ||
#define __REG_RESTORE_INSTRUCTION_H | ||
|
||
#include <stdint.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
|
||
namespace stopImageSection | ||
{ | ||
#endif | ||
|
||
/** | ||
* @brief enumerates opcodes for few instructions. | ||
*/ | ||
enum | ||
{ | ||
ORI_OPCODE = 24, | ||
RFI_OPCODE = 19, | ||
RFI_CONST = 50, | ||
ORIS_OPCODE = 25, | ||
OPCODE_31 = 31, | ||
XOR_CONST = 316, | ||
RLDICR_OPCODE = 30, | ||
RLDICR_CONST = 1, | ||
MTSPR_CONST1 = 467, | ||
MTMSRD_CONST1 = 178, | ||
MR_R0_TO_R10 = 0x7c0a0378, //mr r10, r0 | ||
MR_R0_TO_R21 = 0x7c150378, //mr r21, r0 | ||
BLR_INST = 0x4e800020, | ||
MTSPR_BASE_OPCODE = 0x7c0003a6, | ||
ATTN_OPCODE = 0x00000200, | ||
}; | ||
|
||
#ifdef __cplusplus | ||
} // namespace stopImageSection ends | ||
|
||
} // extern "C" | ||
#endif //__cplusplus | ||
|
||
#endif //__REG_RESTORE_INSTRUCTION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
/* IBM_PROLOG_BEGIN_TAG */ | ||
/* This is an automatically generated prolog. */ | ||
/* */ | ||
/* $Source: src/import/chips/p9/procedures/hwp/lib/p9_hcd_header_defs.H $ */ | ||
/* */ | ||
/* OpenPOWER HostBoot Project */ | ||
/* */ | ||
/* Contributors Listed Below - COPYRIGHT 2016,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 */ | ||
/// | ||
/// @file p9_hcd_header_defs.H | ||
/// @brief defines header constants based on file types | ||
/// | ||
/// This header contains those cpp manifest constants required for processing | ||
/// the linker scripts used to generate OCC code images. As these are used | ||
/// by linker scripts as well as by C++ code, these cannot be solely be put | ||
/// into a namespace. Prefixing these with the region name is the attempt | ||
/// to make these globally unique when this header is included in C++ code. | ||
/// | ||
// *HWP HWP Owner: David Du <daviddu@us.ibm.com> | ||
// *HWP Backup HWP Owner: Greg Still <stillgs@us.ibm.com> | ||
// *HWP FW Owner: Prem Jha <premjha2@in.ibm.com> | ||
// *HWP Team: PM | ||
// *HWP Level: 2 | ||
// *HWP Consumed by: PM | ||
// | ||
|
||
#ifndef __HCD_HEADER_DEFS_H__ | ||
#define __HCD_HEADER_DEFS_H__ | ||
|
||
/// Macros for generating an Hcode header section | ||
/// | ||
/// The CPP macros HCD_HDR_UINTxx generate equivalent code depending on | ||
/// whether they are being called from assembler (where they actually | ||
/// create the header section data) or from C (where they specifiy a | ||
/// C-structure form of the contents of the header section. | ||
/// | ||
/// In assembler each invocation also creates space in the header section | ||
|
||
#ifdef __ASSEMBLER__ | ||
|
||
// *INDENT-OFF* | ||
.macro hcd_header_uint64, symbol:req, value = 0 | ||
.global \symbol | ||
\symbol\(): | ||
.quad (\value) | ||
.endm | ||
|
||
.macro hcd_header_uint32, symbol:req, value = 0 | ||
.global \symbol | ||
\symbol\(): | ||
.long (\value) | ||
.endm | ||
|
||
.macro hcd_header_uint16, symbol:req, value = 0 | ||
.global \symbol | ||
\symbol\(): | ||
.short (\value) | ||
.endm | ||
|
||
.macro hcd_header_uint8, symbol:req, value = 0 | ||
.global \symbol | ||
\symbol\(): | ||
.byte (\value) | ||
.endm | ||
|
||
.macro hcd_header_uint8_vec, symbol:req, number:req, value = 0 | ||
.global \symbol | ||
\symbol\(): | ||
.rept (\number) | ||
.byte (\value) | ||
.endr | ||
.endm | ||
|
||
.macro hcd_header_attn, symbol:req, number = 1 | ||
.global \symbol | ||
\symbol\(): | ||
.rept (\number) | ||
.long 0x00000200 | ||
.endr | ||
.endm | ||
|
||
.macro hcd_header_attn_pad, align:req | ||
.balignl (\align), 0x00000200 | ||
.endm | ||
|
||
.macro hcd_header_pad, align:req | ||
.balignl (\align), 0 | ||
.endm | ||
// *INDENT-ON* | ||
|
||
#define ULL(x) x | ||
#define HCD_CONST(name, expr) .set name, expr; | ||
#define HCD_CONST64(name, expr) .set name, expr; | ||
|
||
#define HCD_HDR_UINT64(symbol, value) hcd_header_uint64 symbol value | ||
#define HCD_HDR_UINT32(symbol, value) hcd_header_uint32 symbol value | ||
#define HCD_HDR_UINT16(symbol, value) hcd_header_uint16 symbol value | ||
#define HCD_HDR_UINT8(symbol, value) hcd_header_uint8 symbol value | ||
#define HCD_HDR_UINT8_VEC(symbol, number, value) hcd_header_uint8_vec symbol number value | ||
#define HCD_HDR_ATTN(symbol, number) hcd_header_attn symbol number | ||
#define HCD_HDR_ATTN_PAD(align) hcd_header_attn_pad align | ||
#define HCD_HDR_PAD(align) hcd_header_pad align | ||
|
||
#else // NOT __ASSEMBLER__ | ||
|
||
#ifdef __LINKERSCRIPT__ | ||
|
||
#define ULL(x) x | ||
#define POUND_DEFINE #define | ||
#define HCD_CONST(name, expr) POUND_DEFINE name expr | ||
#define HCD_CONST64(name, expr) POUND_DEFINE name expr | ||
|
||
#else | ||
|
||
#define ULL(x) x##ull | ||
#define HCD_CONST(name, expr) enum { name = expr }; | ||
#define HCD_CONST64(name, expr) enum { name = expr }; | ||
|
||
#define HCD_HDR_UINT64(symbol, value) uint64_t symbol | ||
#define HCD_HDR_UINT32(symbol, value) uint32_t symbol | ||
#define HCD_HDR_UINT16(symbol, value) uint16_t symbol | ||
#define HCD_HDR_UINT8(symbol, value) uint8_t symbol | ||
#define HCD_HDR_UINT8_VEC(symbol, number, value) uint8_t symbol[number] | ||
#define HCD_HDR_ATTN(symbol, number) uint32_t symbol[number] | ||
#define HCD_HDR_ATTN_PAD(align) | ||
#define HCD_HDR_PAD(align) | ||
|
||
#endif // __LINKERSCRIPT__ | ||
#endif // __ASSEMBLER__ | ||
|
||
// Stringification | ||
|
||
#define STR_HELPER(x) #x | ||
#define STR(x) STR_HELPER(x) | ||
|
||
#endif // __HCD_HEADER_DEFS_H__ |
Oops, something went wrong.