Skip to content

Commit

Permalink
Cleanup generic chipop files
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shakeebbk authored and sgupta2m committed Mar 16, 2018
1 parent 321de65 commit 9355a35
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 253 deletions.
83 changes: 83 additions & 0 deletions src/sbefw/app/common/sbecmdgeneric.C
Original file line number Diff line number Diff line change
Expand Up @@ -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__

15 changes: 10 additions & 5 deletions src/sbefw/app/common/sbecmdgeneric.H
Original file line number Diff line number Diff line change
Expand Up @@ -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"); */
Expand All @@ -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>
Expand Down Expand Up @@ -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);
1 change: 1 addition & 0 deletions src/sbefw/app/power/chipop_table.C
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "sbecmdfastarray.H"

#include "core/chipop_handler.H"
#include "app/common/sbecmdgeneric.H"

#include "power/istep.H"

Expand Down
81 changes: 1 addition & 80 deletions src/sbefw/app/power/sbecmdgeneric.C
Original file line number Diff line number Diff line change
Expand Up @@ -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"); */
Expand Down Expand Up @@ -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__

166 changes: 0 additions & 166 deletions src/sbefw/app/power/sbecmdgeneric.H

This file was deleted.

0 comments on commit 9355a35

Please sign in to comment.