summaryrefslogtreecommitdiffstats
path: root/src/sbefw
diff options
context:
space:
mode:
authorspashabk-in <shakeebbk@in.ibm.com>2018-03-06 03:15:50 -0600
committerSachin Gupta <sgupta2m@in.ibm.com>2018-03-16 02:49:53 -0400
commit9355a3505c0a49e1f830d12299b67dc8e13d87a6 (patch)
tree4df6258ddf2b7671908ac387bd0b557ac5cddb90 /src/sbefw
parent321de657b9798ad1ed743a9351d32f61898c5090 (diff)
downloadtalos-sbe-9355a3505c0a49e1f830d12299b67dc8e13d87a6.tar.gz
talos-sbe-9355a3505c0a49e1f830d12299b67dc8e13d87a6.zip
Cleanup generic chipop files
Cleanup unnecessary defines in generic chipop files Change-Id: Ib569b292c3c933ec0295c235e53b61302a3a5fcd Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/55092 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'src/sbefw')
-rw-r--r--src/sbefw/app/common/sbecmdgeneric.C83
-rw-r--r--src/sbefw/app/common/sbecmdgeneric.H15
-rw-r--r--src/sbefw/app/power/chipop_table.C1
-rw-r--r--src/sbefw/app/power/sbecmdgeneric.C81
-rw-r--r--src/sbefw/app/power/sbecmdgeneric.H166
-rw-r--r--src/sbefw/core/sbe_host_intf.H3
6 files changed, 97 insertions, 252 deletions
diff --git a/src/sbefw/app/common/sbecmdgeneric.C b/src/sbefw/app/common/sbecmdgeneric.C
index 269c513e..1d78705c 100644
--- a/src/sbefw/app/common/sbecmdgeneric.C
+++ b/src/sbefw/app/common/sbecmdgeneric.C
@@ -387,5 +387,88 @@ uint32_t sbePsuQuiesce( uint8_t *i_pArg )
return rc;
#undef SBE_FUNC
}
+//----------------------------------------------------------------------------
+uint32_t sbeReadMem( uint8_t *i_pArg )
+{
+ #define SBE_FUNC "sbeReadMem"
+ SBE_ENTER(SBE_FUNC);
+#if HOST_INTERFACE_AVAILABLE
+ uint32_t rc = SBE_SEC_OPERATION_SUCCESSFUL;
+ uint32_t fapiRc = FAPI2_RC_SUCCESS;
+ sbeReadMemReq_t req = {};
+
+ do
+ {
+ // Extract the request
+ // and send Ack to Host via SBE_SBE2PSU_DOORBELL_SET_BIT1
+ rc = sbeReadPsu2SbeMbxReg(SBE_HOST_PSU_MBOX_REG1,
+ (sizeof(req)/sizeof(uint64_t)),
+ (uint64_t*)&req,
+ true);
+ if(SBE_SEC_OPERATION_SUCCESSFUL != rc)
+ {
+ SBE_ERROR(SBE_FUNC "Failed to extract SBE_HOST_PSU_MBOX_REG1 and "
+ "SBE_HOST_PSU_MBOX_REG2");
+ break;
+ }
+
+ if(!( req.validateReq()) )
+ {
+ SBE_ERROR(SBE_FUNC"Invalid data. offset:0x%08X size:0x%08X",
+ req.offset, req.size );
+ SBE_GLOBAL->sbeSbe2PsuRespHdr.setStatus(SBE_PRI_USER_ERROR,
+ SBE_SEC_INVALID_PARAMS);
+ break;
+ }
+
+ // Default EX Target Init. As its not LCO mode, ex does not matter.
+ fapi2::Target<fapi2::TARGET_TYPE_EX> l_ex(
+ fapi2::plat_getTargetHandleByChipletNumber<fapi2::TARGET_TYPE_EX>(
+ sbeMemAccessInterface::PBA_DEFAULT_EX_CHIPLET_ID));
+ p9_PBA_oper_flag l_myPbaFlag;
+ l_myPbaFlag.setOperationType(p9_PBA_oper_flag::INJ);
+
+ sbeMemAccessInterface pbaInterface(
+ SBE_MEM_ACCESS_PBA,
+ req.responseAddr,
+ &l_myPbaFlag,
+ SBE_MEM_ACCESS_WRITE,
+ sbeMemAccessInterface::PBA_GRAN_SIZE_BYTES,
+ l_ex);
+ uint32_t len = req.size;
+ uint64_t *seepromAddr = req.getEffectiveAddr();
+ while( len > 0)
+ {
+ uint64_t *dataBuffer = static_cast<uint64_t*>
+ (pbaInterface.getBuffer());
+ for(size_t idx=0;
+ idx < (sbeMemAccessInterface::PBA_GRAN_SIZE_BYTES/
+ sizeof(uint64_t));
+ idx++)
+ {
+ *dataBuffer = *seepromAddr;
+ dataBuffer++;
+ seepromAddr++;
+ }
+
+ fapi2::ReturnCode fapiRc = pbaInterface.accessGranule(
+ len == sbeMemAccessInterface::PBA_GRAN_SIZE_BYTES);
+ if( fapiRc != fapi2::FAPI2_RC_SUCCESS)
+ {
+ break;
+ }
+ len = len - sbeMemAccessInterface::PBA_GRAN_SIZE_BYTES;
+ }
+ } while(false);
+
+ // Send the response
+ sbePSUSendResponse(SBE_GLOBAL->sbeSbe2PsuRespHdr, fapiRc, rc);
+#else //HOST_INTERFACE_AVAILABLE
+ uint32_t rc = SBE_SEC_COMMAND_NOT_SUPPORTED;
+#endif
+ SBE_EXIT(SBE_FUNC);
+ return rc;
+ #undef SBE_FUNC
+}
#endif //not __SBEFW_SEEPROM__
diff --git a/src/sbefw/app/common/sbecmdgeneric.H b/src/sbefw/app/common/sbecmdgeneric.H
index 9ff350a5..c387d654 100644
--- a/src/sbefw/app/common/sbecmdgeneric.H
+++ b/src/sbefw/app/common/sbecmdgeneric.H
@@ -6,6 +6,7 @@
/* OpenPOWER sbe Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016,2018 */
+/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
@@ -27,9 +28,7 @@
* @brief This file contains the SBE Generic command details
*
*/
-
-#ifndef __SBEFW_SBECMDGENERIC_H
-#define __SBEFW_SBECMDGENERIC_H
+#pragma once
#include <stdint.h>
#include <p9_sbe_hb_structures.H>
@@ -154,5 +153,11 @@ uint32_t sbeSetSystemFabricMap(uint8_t *i_pArg);
* @return Rc from the Psu access utility
*/
uint32_t sbeStashKeyAddrPair(uint8_t *i_pArg);
-
-#endif // __SBEFW_SBECMDGENERIC_H
+/**
+ * @brief Read the data from SBE memory (0xD703)
+ *
+ * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
+ *
+ * @return Rc from the Psu access utility
+ */
+uint32_t sbeReadMem(uint8_t *i_pArg);
diff --git a/src/sbefw/app/power/chipop_table.C b/src/sbefw/app/power/chipop_table.C
index 07089221..e74c6c9a 100644
--- a/src/sbefw/app/power/chipop_table.C
+++ b/src/sbefw/app/power/chipop_table.C
@@ -44,6 +44,7 @@
#include "sbecmdfastarray.H"
#include "core/chipop_handler.H"
+#include "app/common/sbecmdgeneric.H"
#include "power/istep.H"
diff --git a/src/sbefw/app/power/sbecmdgeneric.C b/src/sbefw/app/power/sbecmdgeneric.C
index d0031da3..3f4294d0 100644
--- a/src/sbefw/app/power/sbecmdgeneric.C
+++ b/src/sbefw/app/power/sbecmdgeneric.C
@@ -6,6 +6,7 @@
/* OpenPOWER sbe Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2018 */
+/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
@@ -104,85 +105,5 @@ sbeCapabilityRespMsg::sbeCapabilityRespMsg()
#endif //__SBEFW_SEEPROM__
#ifndef __SBEFW_SEEPROM__
-//----------------------------------------------------------------------------
-uint32_t sbeReadMem( uint8_t *i_pArg )
-{
- #define SBE_FUNC "sbeReadMem"
- SBE_ENTER(SBE_FUNC);
- uint32_t rc = SBE_SEC_OPERATION_SUCCESSFUL;
- uint32_t fapiRc = FAPI2_RC_SUCCESS;
- sbeReadMemReq_t req = {};
-
- do
- {
- // Extract the request
- // and send Ack to Host via SBE_SBE2PSU_DOORBELL_SET_BIT1
- rc = sbeReadPsu2SbeMbxReg(SBE_HOST_PSU_MBOX_REG1,
- (sizeof(req)/sizeof(uint64_t)),
- (uint64_t*)&req,
- true);
- if(SBE_SEC_OPERATION_SUCCESSFUL != rc)
- {
- SBE_ERROR(SBE_FUNC "Failed to extract SBE_HOST_PSU_MBOX_REG1 and "
- "SBE_HOST_PSU_MBOX_REG2");
- break;
- }
-
- if(!( req.validateReq()) )
- {
- SBE_ERROR(SBE_FUNC"Invalid data. offset:0x%08X size:0x%08X",
- req.offset, req.size );
- SBE_GLOBAL->sbeSbe2PsuRespHdr.setStatus(SBE_PRI_USER_ERROR,
- SBE_SEC_INVALID_PARAMS);
- break;
- }
-
- // Default EX Target Init. As its not LCO mode, ex does not matter.
- fapi2::Target<fapi2::TARGET_TYPE_EX> l_ex(
- fapi2::plat_getTargetHandleByChipletNumber<fapi2::TARGET_TYPE_EX>(
- sbeMemAccessInterface::PBA_DEFAULT_EX_CHIPLET_ID));
- p9_PBA_oper_flag l_myPbaFlag;
- l_myPbaFlag.setOperationType(p9_PBA_oper_flag::INJ);
-
- sbeMemAccessInterface pbaInterface(
- SBE_MEM_ACCESS_PBA,
- req.responseAddr,
- &l_myPbaFlag,
- SBE_MEM_ACCESS_WRITE,
- sbeMemAccessInterface::PBA_GRAN_SIZE_BYTES,
- l_ex);
- uint32_t len = req.size;
- uint64_t *seepromAddr = req.getEffectiveAddr();
- while( len > 0)
- {
- uint64_t *dataBuffer = static_cast<uint64_t*>
- (pbaInterface.getBuffer());
- for(size_t idx=0;
- idx < (sbeMemAccessInterface::PBA_GRAN_SIZE_BYTES/
- sizeof(uint64_t));
- idx++)
- {
- *dataBuffer = *seepromAddr;
- dataBuffer++;
- seepromAddr++;
- }
-
- fapi2::ReturnCode fapiRc = pbaInterface.accessGranule(
- len == sbeMemAccessInterface::PBA_GRAN_SIZE_BYTES);
- if( fapiRc != fapi2::FAPI2_RC_SUCCESS)
- {
- break;
- }
- len = len - sbeMemAccessInterface::PBA_GRAN_SIZE_BYTES;
- }
- } while(false);
-
- // Send the response
- sbePSUSendResponse(SBE_GLOBAL->sbeSbe2PsuRespHdr, fapiRc, rc);
-
- SBE_EXIT(SBE_FUNC);
- return rc;
- #undef SBE_FUNC
-}
#endif //not __SBEFW_SEEPROM__
diff --git a/src/sbefw/app/power/sbecmdgeneric.H b/src/sbefw/app/power/sbecmdgeneric.H
deleted file mode 100644
index d2d4014a..00000000
--- a/src/sbefw/app/power/sbecmdgeneric.H
+++ /dev/null
@@ -1,166 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/sbefw/app/power/sbecmdgeneric.H $ */
-/* */
-/* OpenPOWER sbe Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2016,2018 */
-/* */
-/* */
-/* 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: ppe/sbe/sbefw/sbecmdgeneric.H
- *
- * @brief This file contains the SBE Generic command details
- *
- */
-
-#ifndef __SBEFW_SBECMDGENERIC_H
-#define __SBEFW_SBECMDGENERIC_H
-
-#include <stdint.h>
-#include <p9_sbe_hb_structures.H>
-
-typedef struct sbeStashMemoryPair
-{
- // This is coming from p9_sbe_hb_structures.H
- keyAddrPair_t keyValuePairfromHost;
-
- // Default Constructor to initialize addr/key to 0xFF
- sbeStashMemoryPair()
- {
- for(uint8_t cnt=0; cnt<MAX_ROW_COUNT; cnt++)
- {
- keyValuePairfromHost.addr[cnt] = 0xFFFFFFFFFFFFFFFFULL;
- keyValuePairfromHost.key[cnt] = 0xFF;
- }
- }
-
- bool updatePair(uint8_t key, uint64_t addr)
- {
- bool l_return = false;
- // Check if Key already exist, if yes update addr there
- for(uint8_t cnt=0; cnt<MAX_ROW_COUNT; cnt++)
- {
- if(keyValuePairfromHost.key[cnt] == key)
- {
- keyValuePairfromHost.addr[cnt] = addr;
- l_return = true;
- break;
- }
- }
- if(false == l_return) // Insert the new key into a free pair
- {
- for(uint8_t cnt=0; cnt<MAX_ROW_COUNT; cnt++)
- {
- if(keyValuePairfromHost.key[cnt] == 0xFF)
- {
- keyValuePairfromHost.key[cnt] = key;
- keyValuePairfromHost.addr[cnt] = addr;
- l_return = true;
- break;
- }
- }
- }
- return l_return;
- }
-
- uint64_t fetchStashAddrAttribute()
- {
- return (uint64_t)((uint8_t*)(&keyValuePairfromHost));
- }
-}sbeStashMemoryPair_t;
-
-// Message struct to receive the key/addr pair from host
-typedef struct stashMsg
-{
- uint64_t reserve:56;
- uint64_t key:8;
- uint64_t addr;
-}stashMsg_t;
-
-/**
- * @brief retrieve SBE FFDC on request from FSP. (0xA801)
- *
- * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
- *
- * @return Rc from the FIFO access utility
- */
-uint32_t sbeGetFfdc(uint8_t *i_pArg);
-
-/**
- * @brief SBE Generic capabilities (0xA802)
- *
- * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
- *
- * @return Rc from the FIFO access utility
- */
-uint32_t sbeGetCapabilities(uint8_t *i_pArg);
-
-/**
- * @brief SBE Fifo Quiesce (0xA806)
- *
- * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
- *
- * @return Rc from the FIFO access utility
- */
-uint32_t sbeFifoQuiesce(uint8_t *i_pArg);
-
-/**
- * @brief SBE Psu Set FFDC Address(0xD704)
- *
- * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
- *
- * @return Rc from the Psu access utility
- */
-uint32_t sbeSetFFDCAddr(uint8_t *i_pArg);
-
-/**
- * @brief SBE Psu Quiesce (0xD705)
- *
- * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
- *
- * @return Rc from the Psu access utility
- */
-uint32_t sbePsuQuiesce(uint8_t *i_pArg);
-
-/**
- * @brief SBE Psu Set System Fabric Map (0xD706)
- *
- * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
- *
- * @return Rc from the Psu access utility
- */
-uint32_t sbeSetSystemFabricMap(uint8_t *i_pArg);
-
-/**
- * @brief SBE stash the key addr pair into sbe memory (0xD707)
- *
- * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
- *
- * @return Rc from the Psu access utility
- */
-uint32_t sbeStashKeyAddrPair(uint8_t *i_pArg);
-
-/**
- * @brief Read the data from SBE memory (0xD703)
- *
- * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
- *
- * @return Rc from the Psu access utility
- */
-uint32_t sbeReadMem(uint8_t *i_pArg);
-#endif // __SBEFW_SBECMDGENERIC_H
diff --git a/src/sbefw/core/sbe_host_intf.H b/src/sbefw/core/sbe_host_intf.H
index f392851c..6bb11cd8 100644
--- a/src/sbefw/core/sbe_host_intf.H
+++ b/src/sbefw/core/sbe_host_intf.H
@@ -5,7 +5,8 @@
/* */
/* OpenPOWER sbe Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016,2017 */
+/* Contributors Listed Below - COPYRIGHT 2016,2018 */
+/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
OpenPOWER on IntegriCloud