diff options
Diffstat (limited to 'src/usr/hwpf/hwp/mvpd_accessors')
33 files changed, 0 insertions, 7330 deletions
diff --git a/src/usr/hwpf/hwp/mvpd_accessors/accessMBvpdL4BankDelete.C b/src/usr/hwpf/hwp/mvpd_accessors/accessMBvpdL4BankDelete.C deleted file mode 100644 index d7aee6a7f..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/accessMBvpdL4BankDelete.C +++ /dev/null @@ -1,128 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/accessMBvpdL4BankDelete.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2013,2015 */ -/* [+] 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 */ -// $Id: accessMBvpdL4BankDelete.C,v 1.5 2015/02/24 19:23:31 whs Exp $ -/** - * @file accessMBvpdL4BankDelete.C - * - * @brief get the L4 Bank Delete data from MBvpd record VSPD keyword MX - * - */ - -#include <stdint.h> - -// fapi support -#include <fapi.H> -#include <fapiUtil.H> -#include <accessMBvpdL4BankDelete.H> - -extern "C" -{ -using namespace fapi; - -fapi::ReturnCode accessMBvpdL4BankDelete( - const fapi::Target &i_mbTarget, - uint32_t & io_val, - const fapi::MBvpdL4BankDeleteMode i_mode ) -{ - fapi::ReturnCode l_fapirc; - uint16_t l_l4BankDelete = 0; - uint32_t l_bufSize = sizeof(l_l4BankDelete); - - FAPI_DBG("accessMBvpdL4BankDelete: entry "); - - do { - // check for get/set mode - if (GET_L4_BANK_DELETE_MODE == i_mode) // retrieve value from vpd - { - // get vpd version from record VSPD keyword MX - l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD, - fapi::MBVPD_KEYWORD_MX, - i_mbTarget, - reinterpret_cast<uint8_t *>(&l_l4BankDelete), - l_bufSize); - if (l_fapirc) - { - FAPI_ERR("accessMBvpdL4BankDelete: Read of MX keyword failed"); - break; // break out with fapirc - } - - // Check that sufficient size was returned. - if (l_bufSize < sizeof(l_l4BankDelete) ) - { - FAPI_ERR("accessMBvpdL4BankDelete:" - " less keyword data returned than expected %d < %zd", - l_bufSize, sizeof(l_l4BankDelete)); - const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_MX; - const uint32_t & RETURNED_SIZE = l_bufSize; - const fapi::Target & CHIP_TARGET = i_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc,RC_MBVPD_INSUFFICIENT_VPD_RETURNED); - break; // break out with fapirc - } - // return value - io_val = static_cast<uint32_t>(FAPI_BE16TOH(l_l4BankDelete)); - - FAPI_DBG("accessMBvpdL4BankDelete: get L4 Bank Delete = 0x%08x", - io_val); - } - else if (SET_L4_BANK_DELETE_MODE == i_mode) // update vpd value - { - - uint16_t l_val = static_cast<uint16_t>(io_val); - l_l4BankDelete = FAPI_HTOBE16(l_val); - - // update vpd record VSPD keyword MX - l_fapirc = fapiSetMBvpdField(fapi::MBVPD_RECORD_VSPD, - fapi::MBVPD_KEYWORD_MX, - i_mbTarget, - reinterpret_cast<uint8_t *>(&l_l4BankDelete), - l_bufSize); - if (l_fapirc) - { - FAPI_ERR("accessMBvpdL4BankDelete: Set of MX keyword failed"); - break; // break out with fapirc - } - - FAPI_DBG("accessMBvpdL4BankDelete: set L4 Bank Delete = 0x%04x", - l_l4BankDelete); - - } - else // unlikely invalid mode - { - FAPI_ERR("accessMBvpdL4BankDelete:" - " invalid mode = 0x%02x", i_mode); - const uint32_t & MODE = i_mode; - FAPI_SET_HWP_ERROR(l_fapirc,RC_MBVPD_INVALID_MODE_PARAMETER); - break; // break out with fapirc - } - - } while (0); - - FAPI_DBG("accessMBvpdL4BankDelete: exit rc=0x%08x)", - static_cast<uint32_t>(l_fapirc)); - - return l_fapirc; -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/mvpd_accessors/compressionTool/DQCompressionConsts.H b/src/usr/hwpf/hwp/mvpd_accessors/compressionTool/DQCompressionConsts.H deleted file mode 100644 index 6eafef167..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/compressionTool/DQCompressionConsts.H +++ /dev/null @@ -1,48 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/hwpf/working/hwp/mvpd_accessors/compressionTool/DQCompressionConsts.H,v $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 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. */ -/* 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 */ -// $Id: DQCompressionConsts.H,v 1.1 2014/11/12 19:55:07 pragupta Exp $ -#ifndef _DQCOMPRESSIONCONSTS_H_ -#define _DQCOMPRESSIONCONSTS_H_ - -namespace DQCompression -{ -/* Constants to be used by compression and decompression */ - const uint32_t DQarray_size = 80; - const uint32_t DQSarray_size = 20; - const uint32_t BYTE_LENGTH = 8; - const uint32_t BYTE_CODE_LENGTH = 3; //bytes - const uint32_t NIBBLE_SWAP_LENGTH = 2; //bytes - const uint32_t NIBBLE_PERM_LENGTH = 5; //bits - const uint32_t DQ_CODE_LENGTH = 17;//bytes - const uint32_t DQS_CODE_LENGTH = 2; //bytes - const uint32_t SIX_BIT_ZERO_PADDING = 6; - - const uint32_t DQ_GROUP_SIZE = 8; - const uint32_t DQS_GROUP_SIZE = 2; - //DQ and DQS Flag - to determine the input type - const uint8_t DQ = 1; - const uint8_t DQS= 2; -} -#endif diff --git a/src/usr/hwpf/hwp/mvpd_accessors/compressionTool/DQCompressionLib.C b/src/usr/hwpf/hwp/mvpd_accessors/compressionTool/DQCompressionLib.C deleted file mode 100644 index e4f7f81e0..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/compressionTool/DQCompressionLib.C +++ /dev/null @@ -1,392 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/hwpf/working/hwp/mvpd_accessors/compressionTool/DQCompressionLib.C,v $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 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. */ -/* 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 */ -//$Id: DQCompressionLib.C,v 1.6 2014/11/12 19:53:08 pragupta Exp $ -/** - * @file DQCompressionLib.C - * @brief Defines utility functions which calculates the encoding for DQ - * or DQS arrays - * - * Wiring Rules: - * - On a port any byte may be wired to any byte on the DIMM connector - * i.e. bytes must remain whole and undivided - * - * - In a Byte the Upper and Lower Nibble my be swapped. - * This includes the DQ and the DQS - * - * - In a Nibble any connection of the DQ is allowed. - * i.e. Nibbles must remain whole and undivided - * - * - The DQS may be swapped from the upper and lower nibbles - * in a byte without swapping the DQ. - */ -#include <DQCompressionLib.H> -#include "DQCompressionConsts.H" - -using namespace DQCompression; -/** - * @brief Checks whether the input follows the wiring rules or not - * @param i_data DQ or DQS array as a vector - * @param i_arrayType DQ = 1 and DQS = 2 - */ -int validateInputData (const std::vector<uint8_t>& i_data, - uint32_t i_arrayType) -{ - int l_rc = NO_ERR; - do - { - l_rc = ((i_data.size() == 80) || (i_data.size() == 20)) ? - NO_ERR : INVALID_INPUT; - if (l_rc != NO_ERR) - { - DQ_TRAC("Input data size is: %d. Size should be 80 or 20\n", - (int)i_data.size()); - break; - } - uint32_t l_grpSize = (i_arrayType == DQS) ? 2: BYTE_LENGTH; - - //Check that the bytes are whole and undivided - //Check that the nibbles are whole and undivided - std::vector<uint8_t> l_data (i_data); - - std::vector<uint8_t>::iterator l_itBegin = l_data.begin(); - std::vector<uint8_t>::iterator l_itMiddle = l_itBegin + (l_grpSize/2); - std::vector<uint8_t>::iterator l_itEnd = l_itBegin + l_grpSize; - - uint32_t l_loopCnts = l_data.size()-l_grpSize; - for(uint32_t i = 0; (i < l_loopCnts); i += l_grpSize) - { - //Sort nibbles at a time - std::sort(l_itBegin, l_itMiddle); - std::sort(l_itMiddle,l_itEnd); - - //Check the first nibble - for (std::vector<uint8_t>::iterator j = l_itBegin; - j < l_itMiddle-1; j++) - { - if (*(j+1) != (*j)+1) - { - l_rc = INVALID_INPUT; - DQ_TRAC("First nibble of byte %d is not together\n",i); - break; - } - } - if (l_rc) - { - break; - } - - //Check the second nibble - for (std::vector<uint8_t>::iterator j = l_itMiddle; - (j < l_itEnd-1); j++) - { - if (*(j+1) != (*j)+1) - { - l_rc = INVALID_INPUT; - DQ_TRAC("Second nibble of byte %d is not together\n",i); - break; - } - } - if (l_rc) - { - break; - } - - //Check that first and second nibble are part of the same byte - uint8_t l_inc = l_grpSize/2; - if (((*l_itBegin+l_inc) != *l_itMiddle) && - ((*l_itBegin-l_inc) != *l_itMiddle)) - { - l_rc = INVALID_INPUT; - DQ_TRAC("Byte %d is not together\n", i); - break; - } - - l_itBegin += l_grpSize; - l_itMiddle+= l_grpSize; - l_itEnd += l_grpSize; - } //end for loop - } while (0); - return l_rc; -} - - -/** - * @brief Calculates the byte-to-byte mapping for ISDIMM to Centaur - * @param i_data DQ or DQS array as a vector - * @param o_byteMap: vector that will hold the byte-to-byte mapping - */ -void byte_mapping (std::vector<uint8_t>& i_data, - std::vector<uint8_t>& o_byteMap) -{ - uint32_t l_size = i_data.size() - BYTE_LENGTH; - - for(uint32_t i = 0; i < l_size; i += BYTE_LENGTH) - { - o_byteMap.push_back(i_data[i]/BYTE_LENGTH); - } -} - -/** - * @brief Calculates the permutation of a sequence between two iterators - * @param i_itBegin iterator to the beginning of the sequence - * @param i_itEnd iterator to the end of the sequence - * @retval uint32_t code: 24 bits of code for byte permuatation - * and 5 bits of code for nibble permutation - */ -uint32_t permutation (const std::vector<uint8_t>::iterator i_itBegin, - const std::vector<uint8_t>::iterator i_itEnd) -{ - std::vector<uint8_t> l_sequence (i_itBegin, i_itEnd); - std::vector<uint8_t> l_permutation; - std::vector<uint8_t> l_index (l_sequence); - size_t l_seqSize = l_sequence.size(); - - //We want the sorted list of sequence to determine - //the index for lehmer's code - std::sort(l_index.begin(), l_index.end()); - - for(uint32_t i = 0; i < l_seqSize; i++) - { - //find the index of the value in sequence in the index array - std::vector<uint8_t> ::iterator it = std::find (l_index.begin(), - l_index.end(), l_sequence.at(i)); - - //Add that index to another array - uint8_t l_idx = it-l_index.begin(); - l_permutation.push_back(l_idx); - - //Delete that value from the array and shift - //This will change the indices for the rest of - //the values each iteration - l_index.erase(l_index.begin() + l_idx); - } - - //Skip the last element as it is always zero - l_permutation.pop_back(); - - uint32_t l_code = 0; - uint32_t l_factorial = 1; - - //Generate the variable base code - //Since, the last element will always be zero. - //we start multiplying by 1! - for (uint32_t i = 1; i < l_seqSize; i++) - { - l_factorial *= i; - l_code += l_factorial * l_permutation.back(); - l_permutation.pop_back(); - } - return l_code; -} - -/** - * @brief Figures out if the nibbles within a byte are swapped or not - * @param i_data DQ or DQS array as a vector - * @param l_grpSize: 8 for DQ and 2 for DQS - * @retval uint32_t which has 1 for the byte whose nibble is swapped - * or 0 if the nibbles are not swapped - */ -uint32_t nibble_swap (std::vector<uint8_t>& i_data, uint32_t l_grpSize) -{ - uint32_t o_swap = 0; - //Skip the last one as it is unused - for(uint32_t i = 0; i < i_data.size() - l_grpSize; i+= l_grpSize) - { - if (i_data.at(i) > i_data.at(i+(l_grpSize/2))) - { - o_swap |= 1; - } - o_swap <<= 1; - } - return (o_swap>>1); -} - -/** - * @brief Insert data in ecmdDataBuffer one byte at a time to preserve - * endianess - * @param o_encodedData: buffer to insert the data into - * @param i_data: value to be inserted in ecmdDataBuffer - * @param i_size: number of bytes to insert - * @param i_startBit: Bit to start inserting the data from - * @retval errl: NULL for no-err and BUFFER_OVERFLOW - * if error inserting in ecmdDataBuffer - */ -int insertEncodedData (ecmdDataBufferBase& o_encodedData, uint32_t i_data, - uint32_t i_size, uint32_t i_startBit) -{ - DQ_TRAC("Entering insertEncodedData i_data:%X, i_size:%d, i_startBit:%d\n", - i_data, i_size, i_startBit); - int l_rc = NO_ERR; - //Insert one byte at a time to take care of endianess - for(int i = i_size; i > 0; i--) - { - uint32_t l_datatobeinserted = (i_data>>((i-1)*BYTE_LENGTH))&0xFF; - l_rc = o_encodedData.insertFromRight(l_datatobeinserted, - i_startBit, BYTE_LENGTH); - if (l_rc) - { - l_rc = ECMD_OPER_ERROR; - DQ_TRAC("ECMD errored while writing %d data ;startbit=%d\n", - l_datatobeinserted, i_startBit); - break; - } - i_startBit += BYTE_LENGTH; - } - return l_rc; -} - -/** - * @brief Calculates the encoding for ISDIMM to C4DQ or C4DQS - * @param i_data DQ or DQS array as a vector - * @param i_arrayType DQ = 1 and DQS = 2 - * @param o_encodedData buffer to insert the encoded data into - * @retval error codes - */ -int DQCompression::encodeDQ (std::vector<uint8_t>& i_data, - uint32_t i_arrayType, ecmdDataBufferBase& o_encodedData) -{ - int l_rc = NO_ERR; - uint8_t l_grpSize; - - DQ_TRAC("Entering encodeDQ\n"); - do - { - l_rc = validateInputData (i_data, i_arrayType); - if(l_rc) - { - DQ_TRAC ("validateInputData errored\n"); - break; - } - if (i_arrayType == DQ) - { - l_grpSize = DQ_GROUP_SIZE; - //allocate the buffers with right length - o_encodedData.setByteLength(DQ_CODE_LENGTH); - - //Determine the byte-to-byte mapping - std::vector<uint8_t> l_byteMap; - byte_mapping(i_data, l_byteMap); - - //Determine the permutation for byte mapping - uint32_t l_byteCode = permutation(l_byteMap.begin(), - l_byteMap.end()); - - //Check if the nibbles are swapped within a byte - uint32_t l_nibbleSwap = nibble_swap(i_data, l_grpSize); - - //Copy everything into the o_encodedData buffer - //Copy encoded data for byte-to-byte mapping - uint32_t l_startBit = 0; - DQ_TRAC("Writing byte-to-byte mapping to ecmdBuffer\n"); - l_rc = insertEncodedData (o_encodedData, l_byteCode, - BYTE_CODE_LENGTH,l_startBit); - if (l_rc) - { - DQ_TRAC("Error writing byte-to-byte mapping to ecmdBuffer\n"); - break; - } - - //Copy the data for nibbleSwap - DQ_TRAC("Writing nibbleSwap data to ecmdBuffer\n"); - l_startBit += (BYTE_CODE_LENGTH * BYTE_LENGTH); - l_rc = insertEncodedData (o_encodedData, l_nibbleSwap, - NIBBLE_SWAP_LENGTH,l_startBit); - if (l_rc) - { - DQ_TRAC("Error writing nibbleSwap data to ecmdBuffer\n"); - break; - } - - //Nibble Permutations - setup - std::vector<uint8_t>::iterator l_itBegin = i_data.begin(); - std::vector<uint8_t>::iterator l_itEnd = l_itBegin + - (l_grpSize/2); - - int l_numNibbles = ((i_data.size()/l_grpSize) - 1)*2; - l_startBit += NIBBLE_SWAP_LENGTH*BYTE_LENGTH; - - //Add 0 padding - to round up the nibble perms to next byte - DQ_TRAC("Writing the 0 padding\n"); - uint32_t l_temp = 0; - l_rc = o_encodedData.insertFromRight(l_temp,l_startBit, - SIX_BIT_ZERO_PADDING); - if (l_rc) - { - DQ_TRAC("Error writing 6-bit 0 padding to ecmdDataBuffer\n"); - break; - } - l_startBit += SIX_BIT_ZERO_PADDING; - - DQ_TRAC("Starting nibble permutations\n"); - for(int i = 0; i < l_numNibbles; i++) - { - //Find the permutation of the nibble - uint32_t l_nibblePerm = permutation(l_itBegin, l_itEnd); - //Store it in the encode data buffer - l_rc = o_encodedData.insertFromRight(l_nibblePerm, - l_startBit,NIBBLE_PERM_LENGTH); - if (l_rc) - { - DQ_TRAC("Error writing nibblePerm data to ecmdBuffer\n", - i); - break; - } - l_startBit += NIBBLE_PERM_LENGTH; - - //Setup iterators for the next iteration - l_itBegin += (l_grpSize/2); - l_itEnd += (l_grpSize/2); - } - - if (l_rc) - { - break; - } - } - else if (i_arrayType == DQS) - { - l_grpSize = DQS_GROUP_SIZE; - - o_encodedData.setByteLength(DQS_CODE_LENGTH); - uint32_t l_nibbleSwap = nibble_swap(i_data, l_grpSize); - l_rc = insertEncodedData (o_encodedData, l_nibbleSwap, - NIBBLE_SWAP_LENGTH,0); - if (l_rc) - { - DQ_TRAC("Error writing DQS data to ecmdDataBuffer\n"); - break; - } - } - else - { - l_rc = INVALID_ARRAY_TYPE; - DQ_TRAC("Data type does not match DQ or DQS\n"); - break; - } - } while (0); - - DQ_TRAC("Exiting encodeDQ\n"); - return l_rc; -} diff --git a/src/usr/hwpf/hwp/mvpd_accessors/compressionTool/DQCompressionReasonCodes.H b/src/usr/hwpf/hwp/mvpd_accessors/compressionTool/DQCompressionReasonCodes.H deleted file mode 100644 index ce519624f..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/compressionTool/DQCompressionReasonCodes.H +++ /dev/null @@ -1,39 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/hwpf/working/hwp/mvpd_accessors/compressionTool/DQCompressionReasonCodes.H,v $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 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. */ -/* 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 */ -//$Id: DQCompressionReasonCodes.H,v 1.4 2014/11/12 19:53:08 pragupta Exp $ -/* @file DQCompressionReasonCodes.H - * - * @brief Reason Codes files for DQCompressionLib - */ -#ifndef __DQCOMPRESSIONREASONCODES_H -#define __DQCOMPRESSIONREASONCODES_H - const char* ReasonCodes [] = - { - "NO_ERR", - "ECMD_OPER_ERROR", - "INVALID_INPUT", - "INVALID_ARRAY_TYPE" - }; -#endif diff --git a/src/usr/hwpf/hwp/mvpd_accessors/compressionTool/EncodeDQMapping.C b/src/usr/hwpf/hwp/mvpd_accessors/compressionTool/EncodeDQMapping.C deleted file mode 100644 index d2d861308..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/compressionTool/EncodeDQMapping.C +++ /dev/null @@ -1,292 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/hwpf/working/hwp/mvpd_accessors/compressionTool/EncodeDQMapping.C,v $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 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. */ -/* 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 */ -//$Id: EncodeDQMapping.C,v 1.5 2014/11/12 19:53:08 pragupta Exp $ - -/* - * @file EncodeDQMapping.C - * @brief computes the encoding for ISDIMM to DQ or DQS mapping - * - * - * @param first input is a csv file that has the contents of DQ or DQS array - * It can have upto 4 ports. If there are less than 4 ports passed in, - * the algorithm will assume one-to-one mapping for the rest of the - * ports, meaning zeros for encoded data. - * - * - * @param second input is a file that will hold the encoded data - * (one byte of hex data separated with a space) - * - * - */ -#include <DQCompressionLib.H> -#include "DQCompressionReasonCodes.H" -#include "DQCompressionConsts.H" -#include <stdio.h> - -using namespace DQCompression; - -void parseInput (FILE* i_ptrFile, std::vector <std::vector<uint8_t> >& i_dqData, - std::vector<std::vector<uint8_t> >& i_dqsData) -{ - const uint32_t l_MAX_STR_LENGTH = 300; - char l_inputStr [l_MAX_STR_LENGTH]; - char* l_splitStr; - - int l_dqRowNum = 0; - int l_dqsRowNum = 0; - uint8_t l_arrayType = 0; - - //Read the file - while (fgets(l_inputStr,l_MAX_STR_LENGTH,i_ptrFile)) - { - //convert l_inputStr to a vector of uint8_t - l_splitStr = strtok (l_inputStr, ","); - //# means it is a comment: the comment can say whether it is DQ or DQS - if (*l_splitStr == '#') - { - //Look for DQ or DQS in the comment - char* l_dqPos = strstr(l_splitStr, "DQ"); - if (l_dqPos != NULL) - { - l_arrayType = (*(l_dqPos+2) == 'S') ? DQS : DQ; - } - } - //Skip empty lines - else if (*l_splitStr != '\n') - { - std::vector <uint8_t> l_col; - //Add DQ arrays to the i_dqData vector - if(l_arrayType == DQ) - { - i_dqData.push_back (l_col); - while (l_splitStr != NULL) - { - i_dqData.at(l_dqRowNum).push_back(atoi(l_splitStr)); - l_splitStr = strtok (NULL, ","); - } - l_dqRowNum += 1; - } - - else if(l_arrayType == DQS) - { - //Add DQS arrays to the i_dqsData vector - i_dqsData.push_back (l_col); - while (l_splitStr != NULL) - { - i_dqsData.at(l_dqsRowNum).push_back(atoi(l_splitStr)); - l_splitStr = strtok (NULL, ","); - } - l_dqsRowNum += 1; - } - else - { - fprintf(stderr,"Couldn't determixe DQ or DQS from comment\n"); - exit(1); - } - } // end outer else if - } //end while -} -int writeEncodedData (FILE* i_ptrFile, - std::vector <std::vector<uint8_t> >& i_data, uint8_t i_arrayType) -{ - size_t l_numPorts = i_data.size(); - uint32_t l_dataSize; - int l_rc = 0; - for (uint32_t i = 0; i < l_numPorts; i++) - { - DQ_TRAC ("Input Data: \n"); - for (uint32_t j = 0; j < i_data.at(i).size(); j++) - { - DQ_TRAC("%d ", i_data.at(i).at(j)); - } - DQ_TRAC ("\n"); - - - ecmdDataBufferBase l_encodedData; - l_rc = encodeDQ (i_data.at(i), i_arrayType, - l_encodedData); - if(l_rc) - { - //Check l_rc and print meaningful msgs - fprintf(stderr, "Error Encoding Data %s \n", ReasonCodes[l_rc]); - exit(1); - } - - l_dataSize = l_encodedData.getByteLength(); - char l_buffer [4]; - //Write the data to a text file - for (uint32_t j = 0; j < l_dataSize; j++) - { - if (j == 0) - { - sprintf(l_buffer,"%02X", l_encodedData.getByte(j)); - } - else - { - sprintf(l_buffer," %02X", l_encodedData.getByte(j)); - } - l_rc = fputs(l_buffer, i_ptrFile); - if (l_rc == EOF) - { - DQ_TRAC("Unable to write data to the output file.\n"); - break; - } - } - if (l_rc == EOF) - { - break; - } - l_rc = fputs("\n", i_ptrFile); - if (l_rc == EOF) - { - DQ_TRAC("Unable to write newline char to the output file\n"); - break; - } - } - - //If less than 4 ports are passed in as an input, we assume - //that the rest of the ports have one to one mapping, which - //leads to all zeros for the encoded data. - if (l_numPorts < 4) - { - for (uint32_t i = 0; i < (4 - l_numPorts); i++) - { - for (uint32_t j = 0; j < l_dataSize; j++) - { - if(j == 0) - { - l_rc = fputs("00", i_ptrFile); - if (l_rc == EOF) - { - DQ_TRAC("Unable to write data '00' to the output file"); - break; - } - } - else - { - l_rc = fputs(" 00", i_ptrFile); - if (l_rc == EOF) - { - DQ_TRAC("Unable to write data '00' to the output file"); - break; - } - } - } //end inner for loop - if (l_rc == EOF) - { - break; - } - l_rc = fputs("\n", i_ptrFile); - if (l_rc == EOF) - { - DQ_TRAC("Unable to write newline char to the output file"); - break; - } - } //end for loop - } // end if statement -} - - - -int main (int argc, char* argv []) -{ - int l_rc = 0; - do { - if (argc > 3) - { - fprintf(stderr, "There should only be two parameters\n"); - exit(1); - } - //Open the input file - FILE* l_prInFile = fopen (argv[1], "r"); - if (l_prInFile == NULL) - { - fprintf(stderr, "Can't open the input file for reading\n"); - exit(1); - } - - //parse the inputs - std::vector <std::vector<uint8_t> > l_dqData; - std::vector <std::vector<uint8_t> > l_dqsData; - parseInput(l_prInFile, l_dqData, l_dqsData); - fclose(l_prInFile); - - //Open the output file - FILE* l_prOutFile = fopen (argv[2], "w"); - if (l_prOutFile == NULL) - { - fprintf(stderr, "Can't open the output file for writing\n"); - exit(1); - } - - //process DQ arrays - if (!(l_dqData.empty())) - { - l_rc = fputs("DQ\n", l_prOutFile); - if (l_rc == EOF) - { - DQ_TRAC("Unable to write DQ to the file\n"); - break; - } - if(l_dqData.at(0).size() != DQarray_size) - { - fprintf(stderr, "DQ arrays must have 80 elements\n"); - exit(1); - } - l_rc = writeEncodedData (l_prOutFile, l_dqData, DQ); - if (l_rc == EOF) - { - DQ_TRAC ("writeEncodedData for DQ failed l_rc: %d\n", l_rc); - break; - } - } - - //process DQS arrays - if (!(l_dqsData.empty())) - { - l_rc = fputs("DQS\n", l_prOutFile); - if (l_rc == EOF) - { - DQ_TRAC("Unable to write DQS to the file\n"); - break; - } - if(l_dqsData.at(0).size() != DQSarray_size) - { - fprintf(stderr, "DQS arrays must have 20 elements\n"); - exit(1); - } - l_rc = writeEncodedData (l_prOutFile, l_dqsData, DQS); - if (l_rc == EOF) - { - DQ_TRAC("writeEncodedData for DQS failed\n"); - break; - } - } - - fclose(l_prOutFile); - } while (0); - - return ((l_rc == EOF) ? EOF : 0); -} diff --git a/src/usr/hwpf/hwp/mvpd_accessors/compressionTool/makefile b/src/usr/hwpf/hwp/mvpd_accessors/compressionTool/makefile deleted file mode 100644 index fa6b04766..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/compressionTool/makefile +++ /dev/null @@ -1,47 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/hwpf/hwp/mvpd_accessors/compressionTool/makefile $ -# -# OpenPOWER HostBoot Project -# -# Contributors Listed Below - COPYRIGHT 2014,2015 -# [+] 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 -ROOTPATH = ../../../../../.. - -OUT_FILE += $(GENDIR)/compression - -GEN_PASS_BODY += $(OUT_FILE) -CLEAN_TARGETS += $(OUT_FILE) compression.o - -INC_DIRS += $(ROOTPATH)/src/include/usr/ecmddatabuffer -INC_DIRS += $(ROOTPATH)/src/include/usr/hwpf/hwp/mvpd_accessors -INC_DIRS += $(ROOTPATH)/src/usr/hwpf/hwp/mvpd_accessors/compressionTool -vpath %.C $(ROOTPATH)/src/usr/ecmddatabuffer - -HCFLAGS += -DPRDF_COMPRESSBUFFER_COMPRESS_FUNCTIONS=1 -HCFLAGS += -DPRDF_COMPRESSBUFFER_UNCOMPRESS_FUNCTIONS=1 -HCFLAGS += -lz -HCFLAGS += -Di386=1 - -include $(ROOTPATH)/config.mk - -$(OUT_FILE): ecmdDataBufferBase.C DQCompressionLib.C EncodeDQMapping.C - $(C2) " CC $(notdir $@)" - $(C1)$(CCACHE) $(HOST_PREFIX)g++ -O3 -g $^ -o $(OUT_FILE)\ - $(foreach dir,$(INC_DIRS), -I $(dir)) $(HCFLAGS) diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getControlCapableData.C b/src/usr/hwpf/hwp/mvpd_accessors/getControlCapableData.C deleted file mode 100644 index 491e0c19c..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getControlCapableData.C +++ /dev/null @@ -1,77 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getControlCapableData.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ -/* [+] 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 */ -// $ID: getControlCapableData.C, v 1.1 2014/9/4 09:05:00 eliner Exp $ -/** - * @file getControlCapable.C - * - * @brief MBvpd accessor for the ATTR_VPD_POWER_CONTROL_CAPABLE attributes - */ - -#include <stdint.h> -#include <fapi.H> -#include <getControlCapableData.H> - -extern "C" -{ -using namespace fapi; -fapi::ReturnCode getControlCapableData( - const fapi::Target &i_mbTarget, - uint8_t & o_val) -{ - fapi::ReturnCode l_rc; - - FAPI_DBG("getControlCapableData: start"); - do { - // ATTR_VPD_POWER_CONTROL_CAPABLE is at the membuf level, but the - // getMBvpdAttr() function takes a mba, so need to do a - // conversion - std::vector<fapi::Target> l_mbas; - l_rc = fapiGetChildChiplets( i_mbTarget, - fapi::TARGET_TYPE_MBA_CHIPLET, - l_mbas ); - if( l_rc ) - { - FAPI_ERR("getControlCapableData: fapiGetChildChiplets failed"); - break; - } - - // If we don't have any functional MBAs then we will fail in - // the other function so just return a default value here - if( l_mbas.empty() ) - { - o_val = fapi::ENUM_ATTR_VPD_POWER_CONTROL_CAPABLE_NONE; - break; - } - - // Call a VPD Accessor HWP to get the data - FAPI_EXEC_HWP(l_rc, getMBvpdAttr, - l_mbas[0], ATTR_VPD_POWER_CONTROL_CAPABLE, - &o_val, sizeof(ATTR_VPD_POWER_CONTROL_CAPABLE_Type)); - } while(0); - FAPI_DBG("getControlCapableData: end"); - - return l_rc; -} -} diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getDQAttrISDIMM.C b/src/usr/hwpf/hwp/mvpd_accessors/getDQAttrISDIMM.C deleted file mode 100644 index 95062bb6f..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getDQAttrISDIMM.C +++ /dev/null @@ -1,128 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getDQAttrISDIMM.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2015 */ -/* [+] 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 */ -// $Id: getDQAttrISDIMM.C,v 1.1 2015/04/09 13:36:12 janssens Exp $ -/** - * @file getDQAttrISDIMM.C - * - * @brief MBvpd accessor for the ATTR_VPD_ISDIMMTOC4DQ attribute - */ - -#include <stdint.h> -#include <fapi.H> -#include <getISDIMMTOC4DAttrs.H> -#include <getDecompressedISDIMMAttrs.H> -#include <getDQAttrISDIMM.H> - -extern "C" -{ - -using namespace fapi; - -fapi::ReturnCode getDQAttrISDIMM( - const fapi::Target &i_mbTarget, - uint8_t (&o_val)[4][80]) -{ - - const uint32_t l_Q0_KEYWORD_SIZE = 32; - //Record:SPDX, Keyword Q1, offset:0, 96 bytes. - uint8_t l_q0_keyword[l_Q0_KEYWORD_SIZE]; - uint32_t l_Q0Bufsize = l_Q0_KEYWORD_SIZE; - uint8_t l_DQ_keyword[DQ_KEYWORD_SIZE]; - - fapi::ReturnCode l_fapirc; - do{ - - l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_SPDX, - fapi::MBVPD_KEYWORD_Q0, - i_mbTarget, - (uint8_t *) (&l_q0_keyword), - l_Q0Bufsize); - if(l_fapirc) - { - FAPI_ERR("getDQAttrISDIMM: Read of Q0 Keyword failed"); - break; - } - - uint8_t l_dimmPos = 0; - l_fapirc = FAPI_ATTR_GET(ATTR_ISDIMM_MBVPD_INDEX,&i_mbTarget,l_dimmPos); - if(l_fapirc) - { - FAPI_ERR("getDQAttrISDIMM: read of ATTR_POS failed"); - break; - } - - l_fapirc = getDQAttribute(i_mbTarget,l_q0_keyword[l_dimmPos], - l_DQ_keyword); - if(l_fapirc) - { - FAPI_ERR("getDQAttrISDIMM: read of DQ Keyword failed"); - break; - } - }while(0); - - //end actual data - - ecmdDataBufferBase l_data_buffer_DQ1(136); //17 bytes - ecmdDataBufferBase l_data_buffer_DQ2(136); - ecmdDataBufferBase l_data_buffer_DQ3(136); - ecmdDataBufferBase l_data_buffer_DQ4(136); - ecmdDataBufferBase l_data_buffer_DQS(16); //2 bytes - uint8_t l_finalDQ1Array[80]; - uint8_t l_finalDQ2Array[80]; - uint8_t l_finalDQ3Array[80]; - uint8_t l_finalDQ4Array[80]; - uint8_t l_finalDQSArray[20]; - - for(int l_dataIndex=0;l_dataIndex<17;l_dataIndex++) - { - l_data_buffer_DQ1.insertFromRight(l_DQ_keyword[l_dataIndex], - l_dataIndex*8,8); - l_data_buffer_DQ2.insertFromRight(l_DQ_keyword[l_dataIndex+17], - l_dataIndex*8,8); - l_data_buffer_DQ3.insertFromRight(l_DQ_keyword[l_dataIndex+34], - l_dataIndex*8,8); - l_data_buffer_DQ4.insertFromRight(l_DQ_keyword[l_dataIndex+51], - l_dataIndex*8,8); - } - decodeISDIMMAttrs(l_data_buffer_DQ1,l_data_buffer_DQS, - l_finalDQ1Array,l_finalDQSArray); - decodeISDIMMAttrs(l_data_buffer_DQ2,l_data_buffer_DQS, - l_finalDQ2Array,l_finalDQSArray); - decodeISDIMMAttrs(l_data_buffer_DQ3,l_data_buffer_DQS, - l_finalDQ3Array,l_finalDQSArray); - decodeISDIMMAttrs(l_data_buffer_DQ4,l_data_buffer_DQS, - l_finalDQ4Array,l_finalDQSArray); - - for(int l_finalIndex=0;l_finalIndex<80;l_finalIndex++) - { - o_val[0][l_finalIndex] = l_finalDQ1Array[l_finalIndex]; - o_val[1][l_finalIndex] = l_finalDQ2Array[l_finalIndex]; - o_val[2][l_finalIndex] = l_finalDQ3Array[l_finalIndex]; - o_val[3][l_finalIndex] = l_finalDQ4Array[l_finalIndex]; - } - return FAPI_RC_SUCCESS; -} - -} diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getDQSAttrISDIMM.C b/src/usr/hwpf/hwp/mvpd_accessors/getDQSAttrISDIMM.C deleted file mode 100644 index 408250931..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getDQSAttrISDIMM.C +++ /dev/null @@ -1,222 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getDQSAttrISDIMM.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2015 */ -/* [+] 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 */ -// $Id: getDQSAttrISDIMM.C,v 1.1 2015/04/09 13:36:16 janssens Exp $ -/** - * @file getDQSAttrISDIMM.C - * - * @brief MBvpd accessor for the ATTR_VPD_ISDIMMTOC4DQS attribute - */ - -#include <stdint.h> -#include <fapi.H> -#include <getISDIMMTOC4DAttrs.H> -#include <getDecompressedISDIMMAttrs.H> -#include <getDQSAttrISDIMM.H> - -extern "C" -{ - -using namespace fapi; - -fapi::ReturnCode getDQSAttrISDIMM( - const fapi::Target &i_mbTarget, - uint8_t (&o_val)[4][20]) -{ - //Record:SPDX, Keyword K1, offset:0,32 bytes - const uint32_t l_Q0_KEYWORD_SIZE = 32; - const uint32_t l_K0_KEYWORD_SIZE = 32; - const uint32_t l_DQS_KEYWORD_SIZE = 32; - uint8_t l_k0_keyword[l_K0_KEYWORD_SIZE]; - uint8_t l_q0_keyword[l_Q0_KEYWORD_SIZE]; - uint8_t l_DQS_keyword[l_DQS_KEYWORD_SIZE]; - uint8_t l_DQ_keyword[DQ_KEYWORD_SIZE]; - uint32_t l_K0Bufsize = l_K0_KEYWORD_SIZE; - uint32_t l_Q0Bufsize = l_Q0_KEYWORD_SIZE; - uint32_t l_DQSBufsize = l_DQS_KEYWORD_SIZE; - - - fapi::ReturnCode l_fapirc; - do{ - l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_SPDX, - fapi::MBVPD_KEYWORD_K0, - i_mbTarget, - (uint8_t *) (&l_k0_keyword), - l_K0Bufsize); - if(l_fapirc) - { - FAPI_ERR("getDQSAttrISDIMM: Read of K0 Keyword failed"); - break; - } - l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_SPDX, - fapi::MBVPD_KEYWORD_Q0, - i_mbTarget, - (uint8_t *) (&l_q0_keyword), - l_Q0Bufsize); - if(l_fapirc) - { - FAPI_ERR("getDQSAttrISDIMM: Read of Q0 Keyword failed"); - break; - } - - uint8_t l_dimmPos = 0; - l_fapirc = FAPI_ATTR_GET(ATTR_ISDIMM_MBVPD_INDEX,&i_mbTarget,l_dimmPos); - if(l_fapirc) - { - FAPI_ERR("getDQAttrISDIMM: read of ATTR_POS failed"); - break; - } - - fapi::MBvpdKeyword l_DQS_Keyword = fapi::MBVPD_KEYWORD_K1; - uint8_t l_actualK0Data = l_k0_keyword[l_dimmPos]; - switch(l_actualK0Data) - { - case 1: - l_DQS_Keyword = fapi::MBVPD_KEYWORD_K1; - break; - case 2: - l_DQS_Keyword = fapi::MBVPD_KEYWORD_K2; - break; - case 3: - l_DQS_Keyword = fapi::MBVPD_KEYWORD_K3; - break; - case 4: - l_DQS_Keyword = fapi::MBVPD_KEYWORD_K4; - break; - case 5: - l_DQS_Keyword = fapi::MBVPD_KEYWORD_K5; - break; - case 6: - l_DQS_Keyword = fapi::MBVPD_KEYWORD_K6; - break; - case 7: - l_DQS_Keyword = fapi::MBVPD_KEYWORD_K7; - break; - case 8: - l_DQS_Keyword = fapi::MBVPD_KEYWORD_K8; - break; - default: - FAPI_ERR("getISDIMMTOC4DAttrs: Incorrect Data to read DQS keyword, tried to read copy 0x%02x",l_actualK0Data); - const uint8_t & DQS_COPY = l_actualK0Data; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INVALID_DQS_DATA); - break; - } - l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_SPDX, - l_DQS_Keyword, - i_mbTarget, - (uint8_t *) (&l_DQS_keyword), - l_DQSBufsize); - if(l_fapirc) - { - FAPI_ERR("getISDIMMTOC4DAttrs: Read of DQS keyword failed"); - break; - } - - l_fapirc = getDQAttribute(i_mbTarget,l_q0_keyword[l_dimmPos], - l_DQ_keyword); - if(l_fapirc) - { - FAPI_ERR("getISDIMMTOC4DAttrs: Read of DQ keyword failed"); - break; - } - - uint32_t rc_num = 0; - - if(!l_fapirc) - { - ecmdDataBufferBase l_data_buffer_DQ1(136); //17 bytes - ecmdDataBufferBase l_data_buffer_DQ2(136); - ecmdDataBufferBase l_data_buffer_DQ3(136); - ecmdDataBufferBase l_data_buffer_DQ4(136); - ecmdDataBufferBase l_data_buffer_DQS1(16); //2 bytes - ecmdDataBufferBase l_data_buffer_DQS2(16); - ecmdDataBufferBase l_data_buffer_DQS3(16); - ecmdDataBufferBase l_data_buffer_DQS4(16); - - uint8_t l_finalDQArray[80]; - uint8_t l_finalDQS1Array[20]; - uint8_t l_finalDQS2Array[20]; - uint8_t l_finalDQS3Array[20]; - uint8_t l_finalDQS4Array[20]; - - for(int l_dqsDataIndex=0;l_dqsDataIndex<2;l_dqsDataIndex++) - { - rc_num |= l_data_buffer_DQS1. - insertFromRight(l_DQS_keyword[l_dqsDataIndex], - l_dqsDataIndex*8,8); - rc_num |= l_data_buffer_DQS2. - insertFromRight(l_DQS_keyword[l_dqsDataIndex+2], - l_dqsDataIndex*8,8); - rc_num |= l_data_buffer_DQS3. - insertFromRight(l_DQS_keyword[l_dqsDataIndex+4], - l_dqsDataIndex*8,8); - rc_num |= l_data_buffer_DQS4. - insertFromRight(l_DQS_keyword[l_dqsDataIndex+8], - l_dqsDataIndex*8,8); - } - for(int l_dqDataIndex=0;l_dqDataIndex<17;l_dqDataIndex++) - { - rc_num |= l_data_buffer_DQ1. - insertFromRight(l_DQ_keyword[l_dqDataIndex], - l_dqDataIndex*8,8); - rc_num |= l_data_buffer_DQ2. - insertFromRight(l_DQ_keyword[l_dqDataIndex+17], - l_dqDataIndex*8,8); - rc_num |= l_data_buffer_DQ3. - insertFromRight(l_DQ_keyword[l_dqDataIndex+34], - l_dqDataIndex*8,8); - rc_num |= l_data_buffer_DQ4. - insertFromRight(l_DQ_keyword[l_dqDataIndex+51], - l_dqDataIndex*8,8); - } - - l_fapirc.setEcmdError(rc_num); - if(l_fapirc) - { - FAPI_ERR("getISDIMMTOC4DAttrs.C: ecmdDataBufferBase inserted wrong"); - break; - } - - decodeISDIMMAttrs(l_data_buffer_DQ1,l_data_buffer_DQS1, - l_finalDQArray,l_finalDQS1Array); - decodeISDIMMAttrs(l_data_buffer_DQ2,l_data_buffer_DQS2, - l_finalDQArray,l_finalDQS2Array); - decodeISDIMMAttrs(l_data_buffer_DQ3,l_data_buffer_DQS3, - l_finalDQArray,l_finalDQS3Array); - decodeISDIMMAttrs(l_data_buffer_DQ4,l_data_buffer_DQS4, - l_finalDQArray,l_finalDQS4Array); - - for(int l_finalIndex=0;l_finalIndex<20;l_finalIndex++) - { - o_val[0][l_finalIndex] = l_finalDQS1Array[l_finalIndex]; - o_val[1][l_finalIndex] = l_finalDQS2Array[l_finalIndex]; - o_val[2][l_finalIndex] = l_finalDQS3Array[l_finalIndex]; - o_val[3][l_finalIndex] = l_finalDQS4Array[l_finalIndex]; - } - } - }while(0); - return l_fapirc; -} - -} diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getDecompressedISDIMMAttrs.C b/src/usr/hwpf/hwp/mvpd_accessors/getDecompressedISDIMMAttrs.C deleted file mode 100644 index a5dbd47b7..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getDecompressedISDIMMAttrs.C +++ /dev/null @@ -1,263 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getDecompressedISDIMMAttrs.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ -/* [+] 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 */ -// $ID: getDecompressedISDIMMAttrs.C, v 1.1 2014/9/26 09:22:00 eliner Exp $ - -/** - * @file getDecompressedISDIMMAttrs.C - * - * @brief Decompresses the ISDIMMToC4DQ and DQS Attributes for proper use - */ - -#include <stdio.h> -#include <stdlib.h> -#include <vector> -#include <ecmdDataBufferBase.H> -#include <getDecompressedISDIMMAttrs.H> - -void antiPermutation(int i_permNum, int* o_array,int i_finalSize) -{ - int l_factorialIndex = 1; - int l_factorialNum = 1; - int l_permNum = i_permNum; - int l_size; - - //find the largest factorial needed to represent this number - //(need to find whether we're antiPermuting an array with length 4 or 9) - - while(i_permNum > l_factorialNum) - { - l_factorialIndex = l_factorialIndex + 1; - l_factorialNum = l_factorialNum * l_factorialIndex; - } - - if(i_permNum != l_factorialNum && i_permNum != 0) - { - l_factorialNum = l_factorialNum/l_factorialIndex; - l_factorialIndex = l_factorialIndex - 1; - } - - //now make the array to match the size - l_size = i_finalSize -1; - - //fill the array - //first with 0's - for(int l_arrayIndex = 0; l_arrayIndex<i_finalSize;l_arrayIndex++) - { - o_array[l_arrayIndex] = 0; - } - - while(l_permNum >= l_factorialNum || l_factorialIndex > 0) - { - if(l_permNum < l_factorialNum){ - l_factorialNum = l_factorialNum/l_factorialIndex; - l_factorialIndex = l_factorialIndex - 1; - }else{ - o_array[l_size-l_factorialIndex] = - o_array[l_size-l_factorialIndex]+1; - l_permNum = l_permNum - l_factorialNum; - } - } -} - -void unPermeateToVector(int* i_array, int i_size,std::vector<int>& o_result) -{ - std::vector<int> l_allNumbers; - for(int l_allNumIndex=0;l_allNumIndex<i_size;l_allNumIndex++) - { - l_allNumbers.push_back(l_allNumIndex); - } - - o_result.clear(); - for(int l_arrayIndex = 0; l_arrayIndex<i_size;l_arrayIndex++) - { - o_result.push_back(l_allNumbers.at(i_array[l_arrayIndex])); - l_allNumbers.erase(l_allNumbers.begin()+i_array[l_arrayIndex]); - } -} - -int getSeparatedInformation(ecmdDataBufferBase& i_toSeparateDQ, - ecmdDataBufferBase& i_separateDQS, - int* o_nibSwap,int* o_nibToNib,int* o_nibSwapDQS) -{ - uint32_t o_byteToByte = 0; - - for(int l_nibSwapIndex=0;l_nibSwapIndex<9;l_nibSwapIndex++) - { - //the nibble bits are bits 31 to 39 - uint32_t l_DQ_index_bit = l_nibSwapIndex+31; - uint32_t l_DQS_index_bit = l_nibSwapIndex+7; - o_nibSwap[l_nibSwapIndex] = i_toSeparateDQ.getBit(l_DQ_index_bit); - o_nibSwapDQS[l_nibSwapIndex] = i_separateDQS.getBit(l_DQS_index_bit); - - } - uint32_t l_toAdd = 1; - //@todo-RTC:117985 - for(int l_byteIndex=23;l_byteIndex>=2;l_byteIndex--) - { - //byte to byte is bits 2-23 - uint32_t l_currentBit = i_toSeparateDQ.getBit(l_byteIndex); - if(l_currentBit == 1) - { - o_byteToByte = o_byteToByte + l_toAdd; - } - l_toAdd = l_toAdd * 2; - } - for(int l_nibbleIndex=0;l_nibbleIndex<18;l_nibbleIndex++) - { - uint32_t l_currentSum = 0; - uint32_t l_toAddNibble = 1; - //nibble to Nibble is 46-135 - for(int l_bitIndex=4;l_bitIndex>=0;l_bitIndex--) - { - uint32_t l_currentBit = i_toSeparateDQ.getBit((l_nibbleIndex*5)+ - 46+l_bitIndex); - if(l_currentBit == 1) - { - l_currentSum = l_currentSum + l_toAddNibble; - } - l_toAddNibble = l_toAddNibble * 2; - } - o_nibToNib[l_nibbleIndex] = l_currentSum; - } - return o_byteToByte; - -} - -void convertToFinal80Array(uint8_t* o_final80Array, - std::vector<int>& i_byteNums,int* i_nibbleSwap, - std::vector<std::vector<int> >& i_nibbleToNibNums) -{ - int l_byteIndex; - int l_zeroSeven; - - for(l_byteIndex = 0; l_byteIndex < 9; l_byteIndex++) - { - for(l_zeroSeven = 0; l_zeroSeven<8; l_zeroSeven++) - { - o_final80Array[(l_byteIndex*8)+l_zeroSeven] = - (i_byteNums.at(l_byteIndex)*8) + l_zeroSeven; - } - } - //nibble switch now. - for(int l_nibIndex = 0; l_nibIndex<9;l_nibIndex++) - { - if(i_nibbleSwap[l_nibIndex] == 1) - { - for(int l_bitIndex = 0; l_bitIndex<4;l_bitIndex++) - { - char l_placeHolder = o_final80Array[(l_nibIndex*8) + - l_bitIndex]; - o_final80Array[(l_nibIndex*8) + l_bitIndex] = - o_final80Array[(l_nibIndex*8) + l_bitIndex + 4]; - o_final80Array[(l_nibIndex*8) + l_bitIndex + 4] = - l_placeHolder; - } - } - } - //nibble order now. - for(int l_nibOrderIndex = 0; l_nibOrderIndex<18; l_nibOrderIndex++) - { - std::vector<int> l_currentNibSet = - i_nibbleToNibNums.at(l_nibOrderIndex); - o_final80Array[(l_nibOrderIndex*4)+1] = - o_final80Array[(l_nibOrderIndex*4)] + l_currentNibSet.at(1); - o_final80Array[(l_nibOrderIndex*4)+2] = - o_final80Array[(l_nibOrderIndex*4)] + l_currentNibSet.at(2); - o_final80Array[(l_nibOrderIndex*4)+3] = - o_final80Array[(l_nibOrderIndex*4)] + l_currentNibSet.at(3); - o_final80Array[(l_nibOrderIndex*4)] = - o_final80Array[(l_nibOrderIndex*4)] + l_currentNibSet.at(0); - } - for(int l_finalIndex = 72; l_finalIndex<80;l_finalIndex++) - { - o_final80Array[l_finalIndex] = 255; - } -} - -void convertToFinal20Array(uint8_t* o_final20Array, - std::vector<int>& i_byteNums,int* i_nibbleSwap) -{ - int l_byteIndex; - int l_zeroOne; - - for(l_byteIndex = 0; l_byteIndex < 9; l_byteIndex++) - { - for(l_zeroOne = 0; l_zeroOne < 2; l_zeroOne++) - { - o_final20Array[(l_byteIndex*2)+l_zeroOne] = - (i_byteNums.at(l_byteIndex)*2) + l_zeroOne; - } - } - //nibble switch now - for(int l_nibIndex = 0;l_nibIndex<9;l_nibIndex++) - { - if(i_nibbleSwap[l_nibIndex] == 1) - { - char l_placeHolder = o_final20Array[(l_nibIndex*2)]; - o_final20Array[(l_nibIndex*2)] = o_final20Array[(l_nibIndex*2)+1]; - o_final20Array[(l_nibIndex*2) + 1] = l_placeHolder; - } - } - - o_final20Array[18] = 255; - o_final20Array[19] = 255; -} - -void decodeISDIMMAttrs(ecmdDataBufferBase& i_dataDQ, - ecmdDataBufferBase& i_dataDQS,uint8_t* o_finalArray, - uint8_t* o_finalDQSArray) -{ - int l_byteArray[9]; - int l_nibbleSwap[9]; - int l_nibOrder[18]; - int l_nibbleSwapDQS[9]; - int l_byteOrder = getSeparatedInformation(i_dataDQ,i_dataDQS,l_nibbleSwap, - l_nibOrder,l_nibbleSwapDQS); - int l_sizeByte = 9; - int l_sizeNibble = 4; - - antiPermutation(l_byteOrder,l_byteArray,l_sizeByte); - std::vector<int> l_byteAllNumbers; - unPermeateToVector(l_byteArray,l_sizeByte,l_byteAllNumbers); - - int l_nibOrderArray[18][4]; - - std::vector<std::vector<int> > l_nibToNibAllNums; - for(int l_eachNibble=0;l_eachNibble<18;l_eachNibble++) - { - antiPermutation(l_nibOrder[l_eachNibble], - l_nibOrderArray[l_eachNibble],l_sizeNibble); - std::vector<int> l_currentNibToNib; - unPermeateToVector(l_nibOrderArray[l_eachNibble], - l_sizeNibble,l_currentNibToNib); - l_nibToNibAllNums.push_back(l_currentNibToNib); - } - - convertToFinal80Array(o_finalArray,l_byteAllNumbers, - l_nibbleSwap,l_nibToNibAllNums); - convertToFinal20Array(o_finalDQSArray,l_byteAllNumbers,l_nibbleSwapDQS); -} - - diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getISDIMMTOC4DAttrs.C b/src/usr/hwpf/hwp/mvpd_accessors/getISDIMMTOC4DAttrs.C deleted file mode 100644 index bc33d4578..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getISDIMMTOC4DAttrs.C +++ /dev/null @@ -1,98 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getISDIMMTOC4DAttrs.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ -/* [+] 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 */ -// $Id: getISDIMMTOC4DAttrs.C,v 1.4 2015/04/09 13:36:21 janssens Exp $ -/** - * @file getISDIMMTOC4DAttrs.C - * - * @brief MBvpd accessor for the ATTR_VPD_ISDIMMTOC4DQ and DQS attributes - */ - -#include <stdint.h> -#include <fapi.H> -#include <getISDIMMTOC4DAttrs.H> -#include <getDecompressedISDIMMAttrs.H> - -extern "C" -{ - -using namespace fapi; - -fapi::ReturnCode getDQAttribute(const fapi::Target &i_mbTarget, - uint32_t i_whichCopy, uint8_t (&o_DQKeyword)[DQ_KEYWORD_SIZE]) -{ - uint32_t l_DQBufsize = DQ_KEYWORD_SIZE; - - fapi::ReturnCode l_fapirc; - fapi::MBvpdKeyword l_DQKey = fapi::MBVPD_KEYWORD_Q1; - do{ - switch(i_whichCopy) - { - case 1: - l_DQKey = fapi::MBVPD_KEYWORD_Q1; - break; - case 2: - l_DQKey = fapi::MBVPD_KEYWORD_Q2; - break; - case 3: - l_DQKey = fapi::MBVPD_KEYWORD_Q3; - break; - case 4: - l_DQKey = fapi::MBVPD_KEYWORD_Q4; - break; - case 5: - l_DQKey = fapi::MBVPD_KEYWORD_Q5; - break; - case 6: - l_DQKey = fapi::MBVPD_KEYWORD_Q6; - break; - case 7: - l_DQKey = fapi::MBVPD_KEYWORD_Q7; - break; - case 8: - l_DQKey = fapi::MBVPD_KEYWORD_Q8; - break; - default: - FAPI_ERR("getISDIMMTOC4DAttrs: Incorrect Data to read DQ keyword, tried to read copy 0x%02x",i_whichCopy); - const uint8_t & DQ_COPY = i_whichCopy; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INVALID_DQ_DATA); - break; - } - - l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_SPDX, - l_DQKey, - i_mbTarget, - (uint8_t *) (&o_DQKeyword), - l_DQBufsize); - if(l_fapirc) - { - FAPI_ERR("getISDIMMTOC4DAttrs: Read of DQ keyword failed"); - break; - } - }while(0); - return l_fapirc; - -} - -} diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAddrMirrorData.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAddrMirrorData.C deleted file mode 100644 index 41b5c1240..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAddrMirrorData.C +++ /dev/null @@ -1,170 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAddrMirrorData.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* 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. */ -/* 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 */ -// $Id: getMBvpdAddrMirrorData.C,v 1.5 2014/10/23 22:01:31 dcrowell Exp $ -/** - * @file getMBvpdAddrMirrorData.C - * - * @brief get Address Mirroring Data from MBvpd AM keyword - * - */ - -#include <stdint.h> - -// fapi support -#include <fapi.H> -#include <fapiUtil.H> -#include <getMBvpdAddrMirrorData.H> - -extern "C" -{ -using namespace fapi; - -fapi::ReturnCode getMBvpdAddrMirrorData( - const fapi::Target &i_mbaTarget, - uint8_t (& o_val)[2][2]) -{ - //AM keyword layout - //The following constants are for readibility. They need to stay in sync - // with the vpd layout. - const uint8_t NUM_MBAS = 2; //There are 2 MBAs per Centaur memory buffer - const uint8_t NUM_PORTS = 2; //Each MBA has 2 ports - struct port_attributes - { - uint8_t iv_dimm ; // bits 0:3 DIMM 0 bits 4:7 DIMM 1 - }; - struct mba_attributes - { - port_attributes mba_port[NUM_PORTS]; - }; - struct am_keyword - { - mba_attributes mb_mba[NUM_MBAS]; - uint8_t spare[8]; //VPD data CCIN_31E1_v.5.3.ods - }; - const uint32_t AM_KEYWORD_SIZE = sizeof(am_keyword); // keyword size - - fapi::ReturnCode l_fapirc; - fapi::Target l_mbTarget; - uint8_t l_mbaPos = NUM_MBAS; //initialize to out of range value (+1) - am_keyword * l_pMaBuffer = NULL; // MBvpd MT keyword buffer - uint32_t l_MaBufsize = sizeof(am_keyword); - - FAPI_DBG("getMBvpdAddrMirrorData: entry "); - - do { - // Determine which VPD format we are using - uint8_t l_customDimm = 0; - l_fapirc=FAPI_ATTR_GET(ATTR_EFF_CUSTOM_DIMM,&i_mbaTarget,l_customDimm); - if(l_fapirc) - { - FAPI_ERR("getMBvpdAddrMirrorData: Read of Custom Dimm failed"); - break; - } - - //if not a custom_dimm then assume ISDIMM - if(fapi::ENUM_ATTR_EFF_CUSTOM_DIMM_NO == l_customDimm) - { - // Planar CVPD (==ISDIMM) has no AM keyword, by default there is - // no mirrored data - for (uint8_t l_port=0; l_port<NUM_PORTS; l_port++) - { - o_val[l_port][0] = 0; - o_val[l_port][1] = 0; - } - break; - } - - // find the position of the passed mba on the centuar - l_fapirc = FAPI_ATTR_GET(ATTR_CHIP_UNIT_POS,&i_mbaTarget,l_mbaPos); - if (l_fapirc) - { - FAPI_ERR(" getMBvpdAddrMirrorData: Get MBA position failed "); - break; // break out with fapirc - } - FAPI_DBG("getMBvpdAddrMirrorData: mba %s position=%d", - i_mbaTarget.toEcmdString(), - l_mbaPos); - - // find the Centaur memmory buffer from the passed MBA - l_fapirc = fapiGetParentChip (i_mbaTarget,l_mbTarget); - if (l_fapirc) - { - FAPI_ERR("getMBvpdAddrMirrorData: Finding the parent mb failed "); - break; // break out with fapirc - } - FAPI_DBG("getMBvpdAddrMirrorData: parent mb path=%s ", - l_mbTarget.toEcmdString() ); - - // Read the AM keyword field - l_pMaBuffer = new am_keyword; - - l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD, - fapi::MBVPD_KEYWORD_AM, - l_mbTarget, - reinterpret_cast<uint8_t *>(l_pMaBuffer), - l_MaBufsize); - if (l_fapirc) - { - FAPI_ERR("getMBvpdAddrMirrorData: Read of AM keyword failed"); - break; // break out with fapirc - } - - // Check that sufficient AM was returned. - if (l_MaBufsize < AM_KEYWORD_SIZE ) - { - FAPI_ERR("getMBvpdAddrMirrorData:" - " less AM keyword returned than expected %d < %d", - l_MaBufsize, AM_KEYWORD_SIZE); - const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_AM; - const uint32_t & RETURNED_SIZE = l_MaBufsize; - const fapi::Target & CHIP_TARGET = l_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INSUFFICIENT_VPD_RETURNED ); - break; // break out with fapirc - } - - // Return the 4 bits of address mirroring data for each - // of the 4 DIMMs for the requested mba from the AM keyword buffer - for (uint8_t l_port=0; l_port<NUM_PORTS; l_port++) - { - uint8_t l_dimm = l_pMaBuffer-> - mb_mba[l_mbaPos].mba_port[l_port].iv_dimm; - o_val[l_port][0]= ((l_dimm & 0xF0)>>4); - o_val[l_port][1]= l_dimm & 0x0F; - } - - } while (0); - - if( l_pMaBuffer ) - { - delete l_pMaBuffer; - l_pMaBuffer = NULL; - } - - FAPI_DBG("getMBvpdAddrMirrorData: exit rc=0x%08x", - static_cast<uint32_t>(l_fapirc)); - return l_fapirc; -} - -} // extern "C"
\ No newline at end of file diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttr.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttr.C deleted file mode 100644 index 499f225af..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttr.C +++ /dev/null @@ -1,2045 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttr.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ -/* [+] 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 */ -// $Id: getMBvpdAttr.C,v 1.9 2015/10/06 15:17:45 dcrowell Exp $ -/** - * @file getMBvpdAttr.C - * - * @brief get Attribute Data from MBvpd - * - */ -#include <stdint.h> - -// fapi support -#include <fapi.H> -#include <getMBvpdAttr.H> -#include <getMBvpdVersion.H> - -// Used to ensure attribute enums are equal at compile time -class Error_ConstantsDoNotMatch; -template<const bool MATCH> void checkConstantsMatch() -{ - Error_ConstantsDoNotMatch(); -} -template <> inline void checkConstantsMatch<true>() {} - -extern "C" -{ -using namespace fapi; -using namespace getAttrData; - -// ---------------------------------------------------------------------------- -// local functions -// ---------------------------------------------------------------------------- -/** - * @brief Find attribute definition in global table - */ -fapi::ReturnCode findAttrDef (const fapi::Target & i_mbaTarget, - const DimmType & i_dimmType, - const fapi::AttributeId & i_attr, - const MBvpdAttrDef* & o_pAttrDef, - const VpdVersion & i_version); -/** - * @brief Read the attribute keyword - */ -fapi::ReturnCode readKeyword (const fapi::Target & i_mbTarget, - const fapi::Target & i_mbaTarget, - const MBvpdAttrDef * i_pAttrDef, - const DimmType & i_dimmType, - uint8_t * i_pBuffer, - const uint32_t & i_bufsize, - const VpdVersion & i_version); -/** - * @brief return default output value - */ -fapi::ReturnCode returnDefault (const MBvpdAttrDef * i_pAttrDef, - void * o_pVal, - const size_t & i_valSize); - -/** - * @brief Return the output value - */ -fapi::ReturnCode returnValue (const MBvpdAttrDef * i_pAttrDef, - const uint8_t & i_pos, - void * o_pVal, - const size_t & i_valSize, - uint8_t * i_pBuffer, - const VpdVersion & i_version); - -// return version from keyword VM or VZ or VD -fapi::ReturnCode getVersion (const fapi::Target & i_mbaTarget, - const DimmType & i_dimmType, - VpdVersion & o_version); - - -/** - * @brief Translation functions - */ -fapi::ReturnCode xlate_DRAM_RON (const fapi::AttributeId i_attr, - uint8_t & io_value); -fapi::ReturnCode xlate_RTT_NOM (const fapi::AttributeId i_attr, - uint8_t & io_value); -fapi::ReturnCode xlate_RTT_WR (const fapi::AttributeId i_attr, - uint8_t & io_value); -fapi::ReturnCode xlate_WR_VREF (const fapi::AttributeId i_attr, - uint32_t & io_value); -fapi::ReturnCode xlate_RD_VREF (const fapi::AttributeId i_attr, - uint32_t & io_value); -fapi::ReturnCode xlate_SLEW_RATE (const fapi::AttributeId i_attr, - uint8_t & io_value); - -/** - * @brief Find the ISDIMM MR keyword - */ -fapi::ReturnCode FindMRkeyword (const fapi::Target & i_mbTarget, - fapi::MBvpdKeyword & o_keyword); -/** - * @brief Find the ISDIMM MT keyword - */ -fapi::ReturnCode FindMTkeyword (const fapi::Target & i_mbTarget, - const fapi::Target & i_mbaTarget, - fapi::MBvpdKeyword & o_keyword, - const VpdVersion & i_version); - -keywordLayout * layoutFactory :: getLayout(const uint32_t & i_keyword, - const uint32_t & i_ver) -{ - switch(i_ver) - { - case VM_01: - { - switch(i_keyword) - { - case MBVPD_KEYWORD_MT: - case MBVPD_KEYWORD_PD1: - case MBVPD_KEYWORD_PDZ: - case MBVPD_KEYWORD_PD4: - case MBVPD_KEYWORD_PD5: - case MBVPD_KEYWORD_PD6: - case MBVPD_KEYWORD_PD8: - case MBVPD_KEYWORD_PDY: { return ( new VM_01_MT_layout());} - - case MBVPD_KEYWORD_M1: - case MBVPD_KEYWORD_M2: - case MBVPD_KEYWORD_M3: - case MBVPD_KEYWORD_M4: - case MBVPD_KEYWORD_M5: - case MBVPD_KEYWORD_M6: - case MBVPD_KEYWORD_M7: - case MBVPD_KEYWORD_M8: - case MBVPD_KEYWORD_MR: { return ( new VM_01_MR_layout());} - default: return NULL; - } - } - default: - { - switch(i_keyword) - { - case MBVPD_KEYWORD_MT: - case MBVPD_KEYWORD_T1: - case MBVPD_KEYWORD_T2: - case MBVPD_KEYWORD_T4: - case MBVPD_KEYWORD_T5: - case MBVPD_KEYWORD_T6: - case MBVPD_KEYWORD_T8:{ return ( new VM_00_MT_layout());} - - case MBVPD_KEYWORD_M1: - case MBVPD_KEYWORD_M2: - case MBVPD_KEYWORD_M3: - case MBVPD_KEYWORD_M4: - case MBVPD_KEYWORD_M5: - case MBVPD_KEYWORD_M6: - case MBVPD_KEYWORD_M7: - case MBVPD_KEYWORD_M8: - case MBVPD_KEYWORD_MR: { return ( new VM_00_MR_layout());} - default: return NULL; - } - } - } -} - - -// ---------------------------------------------------------------------------- -// HWP accessor to get MBvpd Attribute Data -// ---------------------------------------------------------------------------- -fapi::ReturnCode getMBvpdAttr(const fapi::Target &i_mbaTarget, - const fapi::AttributeId i_attr, - void * o_pVal, - const size_t i_valSize) -{ - fapi::ReturnCode l_fapirc; - uint8_t * l_pBuffer = NULL; - uint32_t l_bufsize = 0; - - FAPI_DBG("getMBvpdAttr: entry attr=0x%02x, size=%d ", - i_attr,i_valSize ); - - do - { - fapi::Target l_mbTarget; - uint8_t l_pos = NUM_PORTS; //initialize to out of range value (+1) - DimmType l_dimmType = ALL_DIMM; - const MBvpdAttrDef * l_pAttrDef = NULL; - VpdVersion l_version = INVALID_VER; // invalid vpd value - - // find DIMM Info; parent, position, dimm type - l_fapirc = findDimmInfo (i_mbaTarget, l_mbTarget, l_pos, l_dimmType); - if (l_fapirc) - { - break; // return with error - } - - //read VPD version - l_fapirc = getVersion (i_mbaTarget, - l_dimmType, - l_version); - if (l_fapirc) - { - FAPI_ERR("findAttrDef: getVersion failed"); - break; // break out with fapirc - } - // find Attribute definition - l_fapirc = findAttrDef (i_mbaTarget, - l_dimmType, - i_attr, - l_pAttrDef, - l_version); - if (l_fapirc) - { - break; // return with error - } - - FAPI_DBG("getMBvpdAttr: attr=0x%08x, dimmType=%d " - "keyword=%d offset=%d outType=0x%04x default=%d ", - i_attr,l_dimmType,l_pAttrDef->iv_keyword,l_pAttrDef->iv_offset, - l_pAttrDef->iv_outputType,l_pAttrDef->iv_defaultValue ); - - // Either just return defaults or read keyword and return vpd data - // Mask off the special processing flags from the output type. - if (DEFAULT_VALUE == - ((l_pAttrDef->iv_outputType) & SPECIAL_PROCESSING_MASK)) - { - l_fapirc = returnDefault (l_pAttrDef, - o_pVal, - i_valSize); - if (l_fapirc) break; // return with error - - } - else - { - fapi::MBvpdKeyword l_keyword = l_pAttrDef->iv_keyword; - uint32_t l_keywordsize =0; - keywordLayout * l_kwLayout = layoutFactory::getLayout( l_keyword, - l_version); - if( l_kwLayout != NULL) - { - l_keywordsize = l_kwLayout->getKeywordSize(); - } - else - { - FAPI_ERR("layoutFactory::getLayout:" - " returned NULL pointer for Keyword: 0x%x ,Version :0x%x", - l_keyword, l_version); - const fapi::AttributeId & ATTR_ID = i_attr; - const uint32_t & KEYWORD = l_keyword; - const uint32_t & VERSION = l_version; - const uint32_t & DIMM_TYPE = l_dimmType; - FAPI_SET_HWP_ERROR(l_fapirc,RC_MBVPD_UNEXPECTED_KEYWORD); - break; // break out with fapirc - } - - l_pBuffer = new uint8_t[l_keywordsize]; - l_bufsize = l_keywordsize; - - l_fapirc = readKeyword (l_mbTarget, - i_mbaTarget, - l_pAttrDef, - l_dimmType, - l_pBuffer, - l_bufsize, - l_version); - if (l_fapirc) break; // return with error - - // retrun the output value - l_fapirc = returnValue (l_pAttrDef, - l_pos, - o_pVal, - i_valSize, - l_pBuffer, - l_version); - if (l_fapirc) break; // return with error - } - } - while (0); - - delete l_pBuffer; - l_pBuffer = NULL; - - FAPI_DBG("getMBvpdAttr: exit rc=0x%08x", - static_cast<uint32_t>(l_fapirc)); - - return l_fapirc; - -} - -// ---------------------------------------------------------------------------- -// local functions -// ---------------------------------------------------------------------------- - - -// find dimm info; parent, type, position -fapi::ReturnCode findDimmInfo (const fapi::Target & i_mbaTarget, - fapi::Target & o_mbTarget, - uint8_t & o_pos, - DimmType & o_dimmType) -{ - fapi::ReturnCode l_fapirc; - - do - { - // find the position of the passed mba on the centuar - l_fapirc = FAPI_ATTR_GET(ATTR_CHIP_UNIT_POS,&i_mbaTarget,o_pos); - if (l_fapirc) - { - FAPI_ERR(" getMBvpdAttr: Get MBA position failed "); - break; // break out with fapirc - } - FAPI_DBG("findDimmInfo: mba %s position=%d", - i_mbaTarget.toEcmdString(), - o_pos); - - // find the Centaur memmory buffer from the passed MBA - l_fapirc = fapiGetParentChip (i_mbaTarget,o_mbTarget); - if (l_fapirc) - { - FAPI_ERR("findDimmInfo: Finding the parent mb failed "); - break; // break out with fapirc - } - FAPI_DBG("findDimmInfo: parent path=%s ", - o_mbTarget.toEcmdString() ); - - // Determine if ISDIMM or CDIMM - std::vector<fapi::Target> l_target_dimm_array; - - l_fapirc = fapiGetAssociatedDimms(i_mbaTarget, l_target_dimm_array); - if(l_fapirc) - { - FAPI_ERR("findDimmInfo: Problem getting DIMMs of MBA"); - break; //return error - } - if(l_target_dimm_array.size() != 0) - { - uint8_t l_customDimm=0; - l_fapirc = FAPI_ATTR_GET(ATTR_SPD_CUSTOM,&l_target_dimm_array[0], - l_customDimm); - if(l_fapirc) { - FAPI_ERR("findDimmInfo: ATTR_SPD_CUSTOM failed "); - break; //return error - } - - if (l_customDimm == fapi::ENUM_ATTR_SPD_CUSTOM_YES) - { - o_dimmType = CDIMM; - FAPI_DBG("findDimmInfo: CDIMM TYPE!!!"); - } - else - { - o_dimmType = ISDIMM; - FAPI_DBG("findDimmInfo: ISDIMM TYPE!!!"); - } - } - else - { - o_dimmType = ISDIMM; - FAPI_DBG("findDimmInfo: ISDIMM TYPE (dimm array size = 0)"); - } - } - while (0); - - return l_fapirc; -} - -// return version from keyword VM or VZ or VD -fapi::ReturnCode getVersion (const fapi::Target & i_mbaTarget, - const DimmType & i_dimmType, - VpdVersion & o_version) -{ - fapi::ReturnCode l_fapirc; - fapi::Target l_mbTarget; - fapi::MBvpdKeyword l_keyword = fapi::MBVPD_KEYWORD_VM; // try VM first - fapi::MBvpdRecord l_record = fapi::MBVPD_RECORD_SPDX; // default to SPDX - MBvpdVMKeyword l_vmVersionBuf={}; - uint32_t l_vmBufSize = sizeof(MBvpdVMKeyword); // VM keyword is of 4 bytes. - uint16_t l_versionBuf = 0; - uint32_t l_bufSize = sizeof(l_versionBuf); - bool l_sizeMismatch = false; // to track returned size vs expected size - - do - { - // find the Centaur memory buffer from the passed MBA - l_fapirc = fapiGetParentChip (i_mbaTarget,l_mbTarget); - if (l_fapirc) - { - FAPI_ERR("getVersion: Finding the parent mb failed "); - break; // break out with fapirc - } - - if (CDIMM == i_dimmType) - { - l_record = fapi::MBVPD_RECORD_VSPD; - } - - o_version = VM_VER; // initialize to finding VM keyword - - // try to get VM keyword from SPDX or VSPD - l_fapirc = fapiGetMBvpdField(l_record, - l_keyword, - l_mbTarget, - reinterpret_cast<uint8_t *>(&l_vmVersionBuf), - l_vmBufSize); - if (l_vmBufSize < sizeof(MBvpdVMKeyword)) - { - l_sizeMismatch = true; - } - - if((l_fapirc == 0) && (!l_sizeMismatch)) - { - FAPI_DBG("getVersion:" - " returned vm data : 0x%x ", - l_vmVersionBuf.iv_version); - - // Get the first byte from VM keyword which has version value. - l_versionBuf = l_vmVersionBuf.iv_version; - if(l_versionBuf > VM_SUPPORTED_HIGH_VER) - { - FAPI_ERR("getVersion:" - " un-supported vm version returned : 0x%x ", - l_versionBuf); - const uint32_t & KEYWORD = l_keyword; - const uint32_t & RETURNED_VALUE = l_versionBuf; - const uint32_t & RECORD_NAME = l_record; - const uint32_t & DIMM_TYPE = i_dimmType; - const fapi::Target & CHIP_TARGET = l_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc,RC_MBVPD_INVALID_VM_VERSION_RETURNED); - break; // break out with fapirc - } - else if(l_versionBuf != VM_NOT_SUPPORTED) - { - o_version = static_cast<VpdVersion>(o_version | - static_cast<VpdVersion>(l_versionBuf)); - } - } - - // Get the VD in case of VM read error or - // VM returned size is fine but with value 0, then the Version is in - // VD format. - if((l_fapirc) || - ((!l_sizeMismatch) && (l_versionBuf == VM_NOT_SUPPORTED))) - { - fapi::ReturnCode l_fapirc2; - o_version = VD_VER; // initialize to finding VD keyword - l_keyword = fapi::MBVPD_KEYWORD_VD; - l_bufSize = sizeof(l_versionBuf); - - // try to get VD keyword from SPDX or VSPD - l_fapirc2 = fapiGetMBvpdField(l_record, - l_keyword, - l_mbTarget, - reinterpret_cast<uint8_t *>(&l_versionBuf), - l_bufSize); - l_fapirc = l_fapirc2; //explicitly free previous error infor - if (l_bufSize < sizeof(l_versionBuf)) - { - l_sizeMismatch = true; - } - else if(l_fapirc == 0) - { - o_version = static_cast<VpdVersion>(o_version | - static_cast<VpdVersion>(FAPI_BE16TOH(l_versionBuf))); - } - } - - // try record VINI keyword VZ (should work) - if (l_fapirc) - { - fapi::ReturnCode l_fapirc3; - - o_version = VZ_VER; // VZ keyword - l_record = fapi::MBVPD_RECORD_VINI; - l_keyword = fapi::MBVPD_KEYWORD_VZ; - l_bufSize = sizeof(l_versionBuf); - - l_fapirc3 = fapiGetMBvpdField(l_record, - l_keyword, - l_mbTarget, - reinterpret_cast<uint8_t *>(&l_versionBuf), - l_bufSize); - l_fapirc = l_fapirc3; //explicitly free previous error infor - if (l_bufSize < sizeof(l_versionBuf)) - { - l_sizeMismatch = true; - } - else if(l_fapirc == 0) - { - o_version = static_cast<VpdVersion>(o_version | - static_cast<VpdVersion>(FAPI_BE16TOH(l_versionBuf))); - } - } - - if (l_fapirc) - { - FAPI_ERR("getVersion: Read of VM,VD and VZ keyword failed"); - break; // break out with fapirc - } - - if (l_sizeMismatch) - { - FAPI_ERR("getVersion:" - " less keyword data returned than expected %d < %d", - l_bufSize, sizeof(l_versionBuf)); - const uint32_t & KEYWORD = l_keyword; - const uint32_t & RETURNED_SIZE = l_bufSize; - const fapi::Target & CHIP_TARGET = l_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc,RC_MBVPD_INSUFFICIENT_VPD_RETURNED); - break; // break out with fapirc - } - - FAPI_DBG("getVersion: vpd version=0x%x keyword=%d", - o_version,l_keyword); - - } - while (0); - - return l_fapirc; -} - -// find attribute definition -// table rules: -// Vesions must be in decreasing order (highest first...) -// for a specific Dimm Type. The first match found, searching -// from row index 0 to the end, will be used. -fapi::ReturnCode findAttrDef (const fapi::Target & i_mbaTarget, - const DimmType & i_dimmType, - const AttributeId & i_attr, - const MBvpdAttrDef* & o_pAttrDef, - const VpdVersion & i_version) -{ - -fapi::ReturnCode l_fapirc; - o_pAttrDef = NULL; - - // find first row in the attribute defintion table for this attribute - - uint32_t i=0; //at this scope for the debug message at end - for (; i < g_MBVPD_ATTR_DEF_array_size; i++) - { - if ( (g_MBVPD_ATTR_DEF_array[i].iv_attrId == i_attr) && - ((ALL_DIMM == g_MBVPD_ATTR_DEF_array[i].iv_dimmType) || - (i_dimmType == g_MBVPD_ATTR_DEF_array[i].iv_dimmType)) ) - { - - // Some of them are expected to be the same for all Dimm Types and versions - if (ALL_VER == g_MBVPD_ATTR_DEF_array[i].iv_version) - { - o_pAttrDef = &g_MBVPD_ATTR_DEF_array[i]; - break; //use this row - } - // If this row is for this version type (VM or VD or VZ) - // and is equal or less than the version, then use it - if ((g_MBVPD_ATTR_DEF_array[i].iv_version & - (VpdVersion)(ALL_VER & i_version)) && - ((g_MBVPD_ATTR_DEF_array[i].iv_version & VER_MASK) <= - (i_version & VER_MASK)) ) - { - o_pAttrDef = &g_MBVPD_ATTR_DEF_array[i]; - break; //use this row - } - } - } - - // return an error if definition was not found - if (NULL == o_pAttrDef) - { - if (!l_fapirc) // if no other error found - { - // Could be due to a table error, which shouldn't happen because - // every attribute has an ALL_DIMM ALL_VER entry. - // More likely due to an invalid attribute ID being passed. - FAPI_ERR("findAttrDef:" - " attr ID 0x%x not in table dimmType=%d version=%x", - i_attr, - i_dimmType, - i_version); - const fapi::AttributeId & ATTR_ID = i_attr; - const DimmType & DIMM_TYPE = i_dimmType; - const VpdVersion & VERSION = i_version; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_ATTRIBUTE_NOT_FOUND); - } - } - else - { - FAPI_DBG("findAttrDef: use attribute definition row=%d",i ); - } - - return l_fapirc; -} - -// read the attribute keyword -// note: i_pAttrDef->iv_dimmType is likely ALL_DIMM were as -// l_dimmType will be either CDIMM or ISDIMM -fapi::ReturnCode readKeyword (const fapi::Target & i_mbTarget, - const fapi::Target & i_mbaTarget, - const MBvpdAttrDef * i_pAttrDef, - const DimmType & i_dimmType, - uint8_t * i_pBuffer, - const uint32_t & i_bufsize, - const VpdVersion & i_version) -{ - fapi::ReturnCode l_fapirc; - uint32_t l_bufsize = i_bufsize; - uint32_t l_keywordsize = 0; - fapi::MBvpdKeyword l_keyword = i_pAttrDef->iv_keyword; //default for CDIMMs - fapi::MBvpdRecord l_record = MBVPD_RECORD_VSPD; //default for CDIMMs - - FAPI_DBG("readKeyword: Read keyword %d ",l_keyword); - do - { - if (CDIMM != i_dimmType) - { - if (MBVPD_KEYWORD_MT == l_keyword) - { - l_fapirc = FindMTkeyword (i_mbTarget, - i_mbaTarget, - l_keyword, - i_version); - if (l_fapirc) break; //return with error - } - else if (MBVPD_KEYWORD_MR == l_keyword) - { - l_fapirc = FindMRkeyword (i_mbTarget, - l_keyword); - if (l_fapirc) break; //return with error - } - else //table error, shouldn't happen - { - FAPI_ERR("readKeyword: invalid keyword %d for dimmType=%d", - l_keyword, - i_dimmType); - const fapi::AttributeId & ATTR_ID = i_pAttrDef->iv_attrId; - const fapi::MBvpdKeyword & KEYWORD = l_keyword; - FAPI_SET_HWP_ERROR(l_fapirc,RC_MBVPD_UNEXPECTED_ISDIMM_KEYWORD); - break; // return error - } - l_record = fapi::MBVPD_RECORD_SPDX; // for ISDIMMs - - } - else - { - if(( i_version == VM_01 ) && (MBVPD_KEYWORD_MT == l_keyword)) - { - l_keyword = MBVPD_KEYWORD_PDY; - } - } - - // Retrieve attribute keyword - l_fapirc = fapiGetMBvpdField(l_record, - l_keyword, - i_mbTarget, - reinterpret_cast<uint8_t *>(i_pBuffer), - l_bufsize); - if (l_fapirc) - { - FAPI_ERR("readKeyword: Read of attr keyword failed"); - FAPI_ERR("readKeyword:Attribute : 0x%x ,version : 0x%x", - i_pAttrDef->iv_attrId, i_version); - FAPI_ERR("readKeyword : Keyword : 0x%x , record 0x%x", - l_keyword , l_record); - break; // break out with fapirc - } - - // Check that sufficient keyword was returned. - if (l_bufsize < i_bufsize ) - { - FAPI_ERR("readKeyword:" - " less keyword returned than expected %d < %d", - l_bufsize, l_keywordsize); - const uint32_t & KEYWORD = l_keyword; - const uint32_t & RETURNED_SIZE = l_bufsize; - const fapi::Target & CHIP_TARGET = i_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INSUFFICIENT_VPD_RETURNED ); - break; // break out with fapirc - } - } - while (0); - - return l_fapirc; -} - -// used by returnValue to consolidate setting invalid size error -fapi::ReturnCode sizeMismatch (const size_t i_correctSize, - const size_t i_inputSize, - const fapi::AttributeId i_attr) -{ - fapi::ReturnCode l_fapirc; - do - { - FAPI_ERR("sizeMismatch:" - " output variable size does not match expected %d != %d" - " for attr id=0x%08x", - i_correctSize, i_inputSize, i_attr); - const fapi::AttributeId & ATTR_ID = i_attr; - const uint32_t & EXPECTED_SIZE = i_correctSize; - const uint32_t & PASSED_SIZE = i_inputSize; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INVALID_OUTPUT_VARIABLE_SIZE); - } - while (0); - return l_fapirc; -} - - -// return default output value -fapi::ReturnCode returnDefault (const MBvpdAttrDef * i_pAttrDef, - void * o_pVal, - const size_t & i_valSize) -{ - fapi::ReturnCode l_fapirc; - uint16_t l_outputType = i_pAttrDef->iv_outputType & OUTPUT_TYPE_MASK; - - FAPI_DBG("returnDefault: default value outputType=0x%04x ", - l_outputType); - - // return default according to the attribute varible type - switch (l_outputType) - { - case UINT8_BY2: // uint8_t [2] - { - // make sure return value size is correct - if (sizeof(UINT8_BY2_t) != i_valSize) - { - l_fapirc = sizeMismatch(sizeof(UINT8_BY2_t), - i_valSize, - i_pAttrDef->iv_attrId); - break; //return with error - } - - uint8_t l_value = (uint8_t)i_pAttrDef->iv_defaultValue; - - (*(UINT8_BY2_t*)o_pVal)[0] = l_value; - (*(UINT8_BY2_t*)o_pVal)[1] = l_value; - break; - } - - case UINT8_BY2_BY2: // uint8_t [2][2] - { - // make sure return value size is correct - if (sizeof(UINT8_BY2_BY2_t) != i_valSize) - { - l_fapirc = sizeMismatch(sizeof(UINT8_BY2_BY2_t), - i_valSize, - i_pAttrDef->iv_attrId); - break; //return with error - } - - uint8_t l_value = (uint8_t)i_pAttrDef->iv_defaultValue; - for (uint8_t l_port=0; l_port<NUM_PORTS;l_port++) - { - for (uint8_t l_j=0; l_j<NUM_DIMMS; l_j++) - { - (*(UINT8_BY2_BY2_t*)o_pVal)[l_port][l_j] = l_value; - } - } - break; - } - - case UINT8_BY2_BY2_BY4: // uint8_t [2][2][4] - { - // make sure return value size is correct - if (sizeof(UINT8_BY2_BY2_BY4_t) != i_valSize) - { - l_fapirc = sizeMismatch(sizeof(UINT8_BY2_BY2_BY4_t), - i_valSize, - i_pAttrDef->iv_attrId); - break; //return with error - } - - uint8_t l_value = (uint8_t)i_pAttrDef->iv_defaultValue; - for (uint8_t l_port=0; l_port<NUM_PORTS;l_port++) - { - for (uint8_t l_j=0; l_j<NUM_DIMMS; l_j++) - { - for (uint8_t l_k=0; l_k<NUM_RANKS; l_k++) - { - (*(UINT8_BY2_BY2_BY4_t*)o_pVal)[l_port][l_j][l_k] = - l_value; - } - } - } - break; - } - - case UINT32_BY2: // uint32_t [2] - { - // make sure return value size is correct - if (sizeof(UINT32_BY2_t) != i_valSize) - { - l_fapirc = sizeMismatch(sizeof(UINT32_BY2_t), - i_valSize, - i_pAttrDef->iv_attrId); - break; //return with error - } - - uint32_t l_value = (uint32_t)i_pAttrDef->iv_defaultValue; - - for (uint8_t l_port=0; l_port<2;l_port++) - { - (*(UINT32_BY2_t*)o_pVal)[l_port] = l_value; - } - break; - } - - case UINT32_BY2_BY2: // uint32_t [2][2] - { - // make sure return value size is correct - if (sizeof(UINT32_BY2_BY2_t) != i_valSize) - { - l_fapirc = sizeMismatch(sizeof(UINT32_BY2_BY2_t), - i_valSize, - i_pAttrDef->iv_attrId); - break; //return with error - } - - uint32_t l_value = (uint32_t)i_pAttrDef->iv_defaultValue; - - for (uint8_t l_port=0; l_port<NUM_PORTS;l_port++) - { - for (uint8_t l_j=0; l_j<NUM_DIMMS; l_j++) - { - (*(UINT32_BY2_BY2_t*)o_pVal)[l_port][l_j] = l_value; - } - } - break; - } - - case UINT64: // uint64_t - { - // make sure return value size is correct - if (sizeof(UINT64_t) != i_valSize) - { - l_fapirc = sizeMismatch(sizeof(UINT64_t), - i_valSize, - i_pAttrDef->iv_attrId); - break; //return with error - } - - uint64_t l_value = (uint64_t)i_pAttrDef->iv_defaultValue; - (*(UINT64_t*)o_pVal) = l_value; - break ; - } - default: // Hard to do, but needs to be caught - FAPI_ERR("returnDefault: invalid output type 0x%04x for" - " attribute ID 0x%08x", - i_pAttrDef->iv_outputType, - i_pAttrDef->iv_attrId); - const fapi::AttributeId & ATTR_ID = i_pAttrDef->iv_attrId; - const DimmType & DIMM_TYPE = i_pAttrDef->iv_dimmType; - const uint16_t & OUTPUT_TYPE = i_pAttrDef->iv_outputType; - FAPI_SET_HWP_ERROR(l_fapirc, - RC_MBVPD_DEFAULT_UNEXPECTED_OUTPUT_TYPE); - break; // break out with fapirc - } - - return l_fapirc; -} - -// used by returnValue to consolidate pulling an uint32_t value from vpd based -// on the size of the data in the vpd layout (uint8_t, uint16_t, or uint32_t). -uint32_t getUint32 (const uint16_t & i_dataSpecial, - uint8_t * i_pBuffer) -{ - uint32_t o_val = 0; - - if (UINT8_DATA == i_dataSpecial) - { - o_val = *i_pBuffer; - } - else if (UINT16_DATA == i_dataSpecial) - { - o_val = *(i_pBuffer+1); // LSB - o_val |= ((*i_pBuffer)<<8); // MSB - } - else - { - memcpy(&o_val, i_pBuffer, sizeof(o_val)); - o_val = FAPI_BE32TOH(o_val); - } - - return o_val; -} - -// return the output value -// i_pBuffer will be NULL if the default value is to be used. -fapi::ReturnCode returnValue (const MBvpdAttrDef* i_pAttrDef, - const uint8_t & i_pos, - void * o_pVal, - const size_t & i_valSize, - uint8_t * i_pBuffer, - const VpdVersion & i_version) -{ - fapi::ReturnCode l_fapirc; - const uint8_t l_attrOffset = i_pAttrDef->iv_offset; - uint32_t l_port_spec_sec_size = 0; - uint32_t l_mba_sec_size = 0; - fapi::MBvpdKeyword l_keyword = i_pAttrDef->iv_keyword; - uint16_t l_outputType= i_pAttrDef->iv_outputType & OUTPUT_TYPE_MASK; - uint16_t l_special = i_pAttrDef->iv_outputType & SPECIAL_PROCESSING_MASK; - - FAPI_DBG("returnValue: output offset=0%02x pos=%d outputType=0x%04x" - " special=0x%04x ", - l_attrOffset,i_pos,l_outputType,l_special); - - // UINT8 : only 1 value is present, it isn't stored per mba/port - if( l_outputType != UINT8 ) - { - keywordLayout * l_kwLayout = layoutFactory::getLayout( l_keyword, - i_version); - if( l_kwLayout != NULL) - { - // Move the pointer to port specific section data - i_pBuffer += l_kwLayout->getNonPortHeadSize(); - l_port_spec_sec_size = l_kwLayout->getPortSectionSize(); - l_mba_sec_size = l_port_spec_sec_size * NUM_PORTS; - } - } - - // return data according to the attribute varible type - switch (l_outputType) - { - case UINT8_BY2: // uint8_t [2] - { - // make sure return value size is correct - if (sizeof(UINT8_BY2_t) != i_valSize) - { - l_fapirc = sizeMismatch(sizeof(UINT8_BY2_t), - i_valSize, - i_pAttrDef->iv_attrId); - break; //return with error - } - // pull data from keyword buffer - uint8_t l_port0 = *( i_pBuffer + ( i_pos * l_mba_sec_size) - + (0 * l_port_spec_sec_size) + l_attrOffset); - uint8_t l_port1 = *( i_pBuffer + ( i_pos * l_mba_sec_size) - + (1 * l_port_spec_sec_size) + l_attrOffset); - - switch (l_special) - { - case LOW_NIBBLE: // return low nibble - l_port0 = l_port0 & 0x0F; - l_port1 = l_port1 & 0x0F; - break; - - case HIGH_NIBBLE: // return high nibble - l_port0 = ((l_port0 & 0xF0)>>4); - l_port1 = ((l_port1 & 0xF0)>>4); - break; - - case PORT00: // return port 0 for both ports 0 and 1 - l_port1=l_port0; - break; - - case PORT11: // return port 1 for both ports 0 and 1 - l_port0=l_port1; - break; - - case XLATE_SLEW: - l_fapirc = xlate_SLEW_RATE( i_pAttrDef->iv_attrId,l_port0); - if (l_fapirc) break; - l_fapirc = xlate_SLEW_RATE( i_pAttrDef->iv_attrId,l_port1); - if (l_fapirc) break; - - default: - ; // use data directly from keyword buffer - } - if (l_fapirc) break; - - (*(UINT8_BY2_t*)o_pVal)[0] = l_port0; - (*(UINT8_BY2_t*)o_pVal)[1] = l_port1; - break; - } - - case UINT8_BY2_BY2: // uint8_t [2][2] - { - // make sure return value size is correct - if (sizeof(UINT8_BY2_BY2_t) != i_valSize) - { - l_fapirc = sizeMismatch(sizeof(UINT8_BY2_BY2_t), - i_valSize, - i_pAttrDef->iv_attrId); - break; //return with error - } - - for (uint8_t l_port=0; l_port<NUM_PORTS;l_port++) - { - - uint8_t l_dimm0 = *( i_pBuffer + ( i_pos * l_mba_sec_size) - + (l_port * l_port_spec_sec_size) + l_attrOffset); - uint8_t l_dimm1 = 0; - if (BOTH_DIMMS == l_special) - { - l_dimm1 = l_dimm0; //use vpd value for both DIMMs - } - else - { - l_dimm1 = *( i_pBuffer + ( i_pos * l_mba_sec_size) - + (l_port * l_port_spec_sec_size) + l_attrOffset+ 1); - switch (l_special) - { - case XLATE_DRAM_RON: // translate - l_fapirc = - xlate_DRAM_RON(i_pAttrDef->iv_attrId,l_dimm0); - if (l_fapirc) break; //break with error - l_fapirc = - xlate_DRAM_RON(i_pAttrDef->iv_attrId,l_dimm1); - default: - ; // use data directly from keyword buffer - } - } - if (l_fapirc) break; // break with error - (*(UINT8_BY2_BY2_t*)o_pVal)[l_port][0] = l_dimm0; - (*(UINT8_BY2_BY2_t*)o_pVal)[l_port][1] = l_dimm1; - } - break; - } - - case UINT8_BY2_BY2_BY4: // uint8_t [2][2][4] - { - // make sure return value size is correct - if (sizeof(UINT8_BY2_BY2_BY4_t) != i_valSize) - { - l_fapirc = sizeMismatch(sizeof(UINT8_BY2_BY2_BY4_t), - i_valSize, - i_pAttrDef->iv_attrId); - break; //return with error - } - - uint8_t l_value = 0; - for (uint8_t l_port=0; l_port<NUM_PORTS;l_port++) - { - for (uint8_t l_j=0; l_j<NUM_DIMMS; l_j++) - { - for (uint8_t l_k=0; l_k<NUM_RANKS; l_k++) - { - l_value = *( i_pBuffer + ( i_pos * l_mba_sec_size) - + (l_port * l_port_spec_sec_size) - + ( l_attrOffset +(l_j)*NUM_RANKS+l_k)); - switch (l_special) - { - case XLATE_RTT_NOM: // translate - l_fapirc=xlate_RTT_NOM(i_pAttrDef->iv_attrId, - l_value); - break; - case XLATE_RTT_WR: // translate - l_fapirc=xlate_RTT_WR(i_pAttrDef->iv_attrId, - l_value); - default: - ; // use data directly from keyword buffer - } - if (l_fapirc) break; // break with error - (*(UINT8_BY2_BY2_BY4_t*)o_pVal)[l_port][l_j][l_k] = - l_value; - } - if (l_fapirc) break; // break with error - } - if (l_fapirc) break; // break with error - } - break; - - } - case UINT32_BY2: // uint32_t [2] - { - // make sure return value size is correct - if (sizeof(UINT32_BY2_t) != i_valSize) - { - l_fapirc = sizeMismatch(sizeof(UINT32_BY2_t), - i_valSize, - i_pAttrDef->iv_attrId); - break; //return with error - } - - uint16_t l_xlateSpecial = SPECIAL_XLATE_MASK & l_special; - uint16_t l_dataSpecial = SPECIAL_DATA_MASK & l_special; - for (uint8_t l_port=0; l_port<2;l_port++) - { - uint32_t l_value = getUint32 (l_dataSpecial, - ( i_pBuffer + ( i_pos * l_mba_sec_size) + - + (l_port * l_port_spec_sec_size) + l_attrOffset)); - switch (l_xlateSpecial) - { - case XLATE_RD_VREF: // translate - l_fapirc=xlate_RD_VREF(i_pAttrDef->iv_attrId, - l_value); - break; - case XLATE_WR_VREF: // translate - l_fapirc=xlate_WR_VREF(i_pAttrDef->iv_attrId, - l_value); - default: - ; // use data directly from keyword buffer - } - if (l_fapirc) break; // break with error - (*(UINT32_BY2_t*)o_pVal)[l_port] = l_value; - } - break; - } - case UINT32_BY2_BY2: // uint32_t [2][2] - { - // make sure return value size is correct - if (sizeof(UINT32_BY2_BY2_t) != i_valSize) - { - l_fapirc = sizeMismatch(sizeof(UINT32_BY2_BY2_t), - i_valSize, - i_pAttrDef->iv_attrId); - break; //return with error - } - - uint16_t l_dataSpecial = SPECIAL_DATA_MASK & l_special; - uint8_t l_vpdIncrement = 4; //default to 4 byte vpd field - if (UINT8_DATA == l_dataSpecial) - { - l_vpdIncrement = 1; // vpd is only 1 byte - } - else if (UINT16_DATA == l_dataSpecial) - { - l_vpdIncrement = 2; // vpd is 2 bytes - } - - for (uint8_t l_port=0; l_port<2;l_port++) - { - uint8_t l_vpdOffset = 0; - for (uint8_t l_j=0; l_j<NUM_DIMMS; l_j++) - { - uint32_t l_value = getUint32 (l_dataSpecial, - ( i_pBuffer + ( i_pos * l_mba_sec_size) + - + (l_port * l_port_spec_sec_size) - + (l_attrOffset+l_vpdOffset))); - - (*(UINT32_BY2_BY2_t*)o_pVal)[l_port][l_j] = l_value; - l_vpdOffset += l_vpdIncrement; - } - } - break; - } - case UINT64: // uint64_t - { - // make sure return value size is correct - if (sizeof(UINT64_t) != i_valSize) - { - l_fapirc = sizeMismatch(sizeof(UINT64_t), - i_valSize, - i_pAttrDef->iv_attrId); - break; //return with error - } - - uint64_t l_value = 0; - if (MERGE == l_special) - { - uint32_t l_port0 = getUint32 (UINT32_DATA, - ( i_pBuffer + ( i_pos * l_mba_sec_size) + - + (0 * l_port_spec_sec_size)+ l_attrOffset)); - uint32_t l_port1 = getUint32 (UINT32_DATA, - ( i_pBuffer + ( i_pos * l_mba_sec_size) + - + (1 * l_port_spec_sec_size)+ l_attrOffset)); - - l_value = ( ((static_cast<uint64_t>(l_port0))<<32) | - (static_cast<uint64_t>(l_port1)) ); - } - else - { - FAPI_ERR("returnValue: invalid output type 0x%04x for" - " attribute ID 0x%08x UINT64_T", - i_pAttrDef->iv_outputType, - i_pAttrDef->iv_attrId); - const fapi::AttributeId & ATTR_ID = i_pAttrDef->iv_attrId; - const DimmType & DIMM_TYPE = i_pAttrDef->iv_dimmType; - const uint16_t & OUTPUT_TYPE = i_pAttrDef->iv_outputType; - FAPI_SET_HWP_ERROR(l_fapirc, - RC_MBVPD_UINT64_UNEXPECTED_OUTPUT_TYPE); - break; // break out with fapirc - } - (*(UINT64_t*)o_pVal) = l_value; - break ; - } - case UINT8: // uint8_t - { - // make sure return value size is correct - if (sizeof(UINT8_t) != i_valSize) - { - l_fapirc = sizeMismatch(sizeof(UINT8_t), - i_valSize, - i_pAttrDef->iv_attrId); - break; //return with error - } - - // only 1 value is present, it isn't stored per mba/port - uint8_t l_value = (reinterpret_cast<uint8_t*>(i_pBuffer))[l_attrOffset]; - (*(UINT8_t*)o_pVal) = l_value; - break ; - } - default: // Hard to do, but needs to be caught - FAPI_ERR("returnValue: invalid output type 0x%04x for" - " attribute ID 0x%08x", - i_pAttrDef->iv_outputType, - i_pAttrDef->iv_attrId); - const fapi::AttributeId & ATTR_ID = i_pAttrDef->iv_attrId; - const DimmType & DIMM_TYPE = i_pAttrDef->iv_dimmType; - const uint16_t & OUTPUT_TYPE = i_pAttrDef->iv_outputType; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_UNEXPECTED_OUTPUT_TYPE); - break; // break out with fapirc - } - return l_fapirc; -} - -// ---------------------------------------------------------------------------- -// Translate vpd values to attribute enumeration for ATTR_VPD_DRAM_RON -// ---------------------------------------------------------------------------- -fapi::ReturnCode xlate_DRAM_RON (const fapi::AttributeId i_attr, - uint8_t & io_value) -{ - fapi::ReturnCode l_fapirc; - const uint8_t VPD_DRAM_RON_INVALID = 0x00; - const uint8_t VPD_DRAM_RON_OHM34 = 0x07; - const uint8_t VPD_DRAM_RON_OHM40 = 0x03; - - switch (io_value) - { - case VPD_DRAM_RON_INVALID: - io_value=fapi::ENUM_ATTR_VPD_DRAM_RON_INVALID; - break; - case VPD_DRAM_RON_OHM34: - io_value=fapi::ENUM_ATTR_VPD_DRAM_RON_OHM34; - break; - case VPD_DRAM_RON_OHM40: - io_value=fapi::ENUM_ATTR_VPD_DRAM_RON_OHM40; - break; - default: - FAPI_ERR("Unsupported VPD encode for ATTR_VPD_DRAM_RON 0x%02x", - io_value); - const fapi::AttributeId & ATTR_ID = i_attr; - const uint8_t & VPD_VALUE = io_value; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_TERM_DATA_UNSUPPORTED_VPD_ENCODE); - break; - } - - return l_fapirc; -} - -// ---------------------------------------------------------------------------- -// Translate vpd values to attribute enumeration for ATTR_VPD_DRAM_RTT_NOM -// ---------------------------------------------------------------------------- -fapi::ReturnCode xlate_RTT_NOM (const fapi::AttributeId i_attr, - uint8_t & io_value) -{ - fapi::ReturnCode l_fapirc; - const uint8_t DRAM_RTT_NOM_DISABLE = 0x00; - const uint8_t DRAM_RTT_NOM_OHM20 = 0x04; - const uint8_t DRAM_RTT_NOM_OHM30 = 0x05; - const uint8_t DRAM_RTT_NOM_OHM34 = 0x07; - const uint8_t DRAM_RTT_NOM_OHM40 = 0x03; - const uint8_t DRAM_RTT_NOM_OHM48 = 0x85; - const uint8_t DRAM_RTT_NOM_OHM60 = 0x01; - const uint8_t DRAM_RTT_NOM_OHM80 = 0x06; - const uint8_t DRAM_RTT_NOM_OHM120 = 0x02; - const uint8_t DRAM_RTT_NOM_OHM240 = 0x84; - - switch(io_value) - { - case DRAM_RTT_NOM_DISABLE: - io_value=fapi::ENUM_ATTR_VPD_DRAM_RTT_NOM_DISABLE; - break; - case DRAM_RTT_NOM_OHM20: - io_value= fapi::ENUM_ATTR_VPD_DRAM_RTT_NOM_OHM20; - break; - case DRAM_RTT_NOM_OHM30: - io_value= fapi::ENUM_ATTR_VPD_DRAM_RTT_NOM_OHM30; - break; - case DRAM_RTT_NOM_OHM34: - io_value = fapi::ENUM_ATTR_VPD_DRAM_RTT_NOM_OHM34; - break; - case DRAM_RTT_NOM_OHM40: - io_value = fapi::ENUM_ATTR_VPD_DRAM_RTT_NOM_OHM40; - break; - case DRAM_RTT_NOM_OHM48: - io_value = fapi::ENUM_ATTR_VPD_DRAM_RTT_NOM_OHM48; - break; - case DRAM_RTT_NOM_OHM60: - io_value = fapi::ENUM_ATTR_VPD_DRAM_RTT_NOM_OHM60; - break; - case DRAM_RTT_NOM_OHM80: - io_value = fapi::ENUM_ATTR_VPD_DRAM_RTT_NOM_OHM80; - break; - case DRAM_RTT_NOM_OHM120: - io_value = fapi::ENUM_ATTR_VPD_DRAM_RTT_NOM_OHM120; - break; - case DRAM_RTT_NOM_OHM240: - io_value = fapi::ENUM_ATTR_VPD_DRAM_RTT_NOM_OHM240; - break; - default: - FAPI_ERR("Unsupported VPD encode for ATTR_VPD_DRAM_RTT_NOM 0x%02x", - io_value); - const fapi::AttributeId & ATTR_ID = i_attr; - const uint8_t & VPD_VALUE = io_value; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_TERM_DATA_UNSUPPORTED_VPD_ENCODE); - break; - } - - return l_fapirc; -} - -// ---------------------------------------------------------------------------- -// Translate vpd values to attribute enumeration for ATTR_VPD_DRAM_RTT_WR -// ---------------------------------------------------------------------------- -fapi::ReturnCode xlate_RTT_WR (const fapi::AttributeId i_attr, - uint8_t & io_value) -{ - fapi::ReturnCode l_fapirc; - const uint8_t DRAM_RTT_WR_DISABLE = 0x00; - const uint8_t DRAM_RTT_WR_OHM60 = 0x01; - const uint8_t DRAM_RTT_WR_OHM120 = 0x02; - - switch(io_value) - { - case DRAM_RTT_WR_DISABLE: - io_value=fapi::ENUM_ATTR_VPD_DRAM_RTT_WR_DISABLE; - break; - case DRAM_RTT_WR_OHM60: - io_value= fapi::ENUM_ATTR_VPD_DRAM_RTT_WR_OHM60; - break; - case DRAM_RTT_WR_OHM120: - io_value= fapi::ENUM_ATTR_VPD_DRAM_RTT_WR_OHM120; - break; - default: - FAPI_ERR("Unsupported VPD encode for ATTR_VPD_DRAM_RTT_WR 0x%02x", - io_value); - const fapi::AttributeId & ATTR_ID = i_attr; - const uint8_t & VPD_VALUE = io_value; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_TERM_DATA_UNSUPPORTED_VPD_ENCODE); - break; - } - - return l_fapirc; -} - -// ---------------------------------------------------------------------------- -// Translate vpd values to attribute enumeration for ATTR_VPD_DRAM_WR_VREF -// ---------------------------------------------------------------------------- -fapi::ReturnCode xlate_WR_VREF (const fapi::AttributeId i_attr, - uint32_t & io_value) -{ - fapi::ReturnCode l_fapirc; - // The following intentionally skips 0x0a..0x0f, 0x1a..0x1f, and 0x2a..0x2f - const uint8_t WR_VREF_VDD420 = 0x00; - const uint8_t WR_VREF_VDD425 = 0x01; - const uint8_t WR_VREF_VDD430 = 0x02; - const uint8_t WR_VREF_VDD435 = 0x03; - const uint8_t WR_VREF_VDD440 = 0x04; - const uint8_t WR_VREF_VDD445 = 0x05; - const uint8_t WR_VREF_VDD450 = 0x06; - const uint8_t WR_VREF_VDD455 = 0x07; - const uint8_t WR_VREF_VDD460 = 0x08; - const uint8_t WR_VREF_VDD465 = 0x09; - const uint8_t WR_VREF_VDD470 = 0x10; - const uint8_t WR_VREF_VDD475 = 0x11; - const uint8_t WR_VREF_VDD480 = 0x12; - const uint8_t WR_VREF_VDD485 = 0x13; - const uint8_t WR_VREF_VDD490 = 0x14; - const uint8_t WR_VREF_VDD495 = 0x15; - const uint8_t WR_VREF_VDD500 = 0x16; - const uint8_t WR_VREF_VDD505 = 0x17; - const uint8_t WR_VREF_VDD510 = 0x18; - const uint8_t WR_VREF_VDD515 = 0x19; - const uint8_t WR_VREF_VDD520 = 0x20; - const uint8_t WR_VREF_VDD525 = 0x21; - const uint8_t WR_VREF_VDD530 = 0x22; - const uint8_t WR_VREF_VDD535 = 0x23; - const uint8_t WR_VREF_VDD540 = 0x24; - const uint8_t WR_VREF_VDD545 = 0x25; - const uint8_t WR_VREF_VDD550 = 0x26; - const uint8_t WR_VREF_VDD555 = 0x27; - const uint8_t WR_VREF_VDD560 = 0x28; - const uint8_t WR_VREF_VDD565 = 0x29; - const uint8_t WR_VREF_VDD570 = 0x30; - const uint8_t WR_VREF_VDD575 = 0x31; - - switch(io_value) - { - case WR_VREF_VDD420: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD420; - break; - case WR_VREF_VDD425: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD425; - break; - case WR_VREF_VDD430: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD430; - break; - case WR_VREF_VDD435: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD435; - break; - case WR_VREF_VDD440: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD440; - break; - case WR_VREF_VDD445: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD445; - break; - case WR_VREF_VDD450: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD450; - break; - case WR_VREF_VDD455: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD455; - break; - case WR_VREF_VDD460: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD460; - break; - case WR_VREF_VDD465: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD465; - break; - case WR_VREF_VDD470: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD470; - break; - case WR_VREF_VDD475: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD475; - break; - case WR_VREF_VDD480: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD480; - break; - case WR_VREF_VDD485: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD485; - break; - case WR_VREF_VDD490: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD490; - break; - case WR_VREF_VDD495: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD495; - break; - case WR_VREF_VDD500: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD500; - break; - case WR_VREF_VDD505: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD505; - break; - case WR_VREF_VDD510: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD510; - break; - case WR_VREF_VDD515: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD515; - break; - case WR_VREF_VDD520: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD520; - break; - case WR_VREF_VDD525: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD525; - break; - case WR_VREF_VDD530: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD530; - break; - case WR_VREF_VDD535: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD535; - break; - case WR_VREF_VDD540: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD540; - break; - case WR_VREF_VDD545: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD545; - break; - case WR_VREF_VDD550: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD550; - break; - case WR_VREF_VDD555: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD555; - break; - case WR_VREF_VDD560: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD560; - break; - case WR_VREF_VDD565: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD565; - break; - case WR_VREF_VDD570: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD570; - break; - case WR_VREF_VDD575: - io_value = fapi::ENUM_ATTR_VPD_DRAM_WR_VREF_VDD575; - break; - default: - FAPI_ERR("Unsupported VPD encode for ATTR_VPD_DRAM_WR_VREF 0x%08x", - io_value); - const fapi::AttributeId & ATTR_ID = i_attr; - const uint32_t & VPD_VALUE = io_value; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_TERM_DATA_UNSUPPORTED_VPD_ENCODE); - break; - } - return l_fapirc; -} - -// ---------------------------------------------------------------------------- -// Translate vpd values to attribute enumeration for ATTR_VPD_CEN_RD_VREF -// ---------------------------------------------------------------------------- -fapi::ReturnCode xlate_RD_VREF (const fapi::AttributeId i_attr, - uint32_t & io_value) -{ - fapi::ReturnCode l_fapirc; - const uint8_t RD_VREF_VDD61000 = 0x15; - const uint8_t RD_VREF_VDD59625 = 0x14; - const uint8_t RD_VREF_VDD58250 = 0x13; - const uint8_t RD_VREF_VDD56875 = 0x12; - const uint8_t RD_VREF_VDD55500 = 0x11; - const uint8_t RD_VREF_VDD54125 = 0x10; - const uint8_t RD_VREF_VDD52750 = 0x09; - const uint8_t RD_VREF_VDD51375 = 0x08; - const uint8_t RD_VREF_VDD50000 = 0x07; - const uint8_t RD_VREF_VDD48625 = 0x06; - const uint8_t RD_VREF_VDD47250 = 0x05; - const uint8_t RD_VREF_VDD45875 = 0x04; - const uint8_t RD_VREF_VDD44500 = 0x03; - const uint8_t RD_VREF_VDD43125 = 0x02; - const uint8_t RD_VREF_VDD41750 = 0x01; - const uint8_t RD_VREF_VDD40375 = 0x00; - const uint8_t RD_VREF_VDD81000 = 0x31; - const uint8_t RD_VREF_VDD79625 = 0x30; - const uint8_t RD_VREF_VDD78250 = 0x29; - const uint8_t RD_VREF_VDD76875 = 0x28; - const uint8_t RD_VREF_VDD75500 = 0x27; - const uint8_t RD_VREF_VDD74125 = 0x26; - const uint8_t RD_VREF_VDD72750 = 0x25; - const uint8_t RD_VREF_VDD71375 = 0x24; - const uint8_t RD_VREF_VDD70000 = 0x23; - const uint8_t RD_VREF_VDD68625 = 0x22; - const uint8_t RD_VREF_VDD67250 = 0x21; - const uint8_t RD_VREF_VDD65875 = 0x20; - const uint8_t RD_VREF_VDD64500 = 0x19; - const uint8_t RD_VREF_VDD63125 = 0x18; - const uint8_t RD_VREF_VDD61750 = 0x17; - const uint8_t RD_VREF_VDD60375 = 0x16; - - switch(io_value) - { - case RD_VREF_VDD61000: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD61000; - break; - case RD_VREF_VDD59625: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD59625; - break; - case RD_VREF_VDD58250: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD58250; - break; - case RD_VREF_VDD56875: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD56875; - break; - case RD_VREF_VDD55500: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD55500; - break; - case RD_VREF_VDD54125: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD54125; - break; - case RD_VREF_VDD52750: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD52750; - break; - case RD_VREF_VDD51375: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD51375; - break; - case RD_VREF_VDD50000: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD50000; - break; - case RD_VREF_VDD48625: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD48625; - break; - case RD_VREF_VDD47250: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD47250; - break; - case RD_VREF_VDD45875: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD45875; - break; - case RD_VREF_VDD44500: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD44500; - break; - case RD_VREF_VDD43125: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD43125; - break; - case RD_VREF_VDD41750: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD41750; - break; - case RD_VREF_VDD40375: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD40375; - break; - case RD_VREF_VDD81000: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD81000; - break; - case RD_VREF_VDD79625: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD79625; - break; - case RD_VREF_VDD78250: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD78250; - break; - case RD_VREF_VDD76875: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD76875; - break; - case RD_VREF_VDD75500: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD75500; - break; - case RD_VREF_VDD74125: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD74125; - break; - case RD_VREF_VDD72750: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD72750; - break; - case RD_VREF_VDD71375: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD71375; - break; - case RD_VREF_VDD70000: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD70000; - break; - case RD_VREF_VDD68625: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD68625; - break; - case RD_VREF_VDD67250: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD67250; - break; - case RD_VREF_VDD65875: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD65875; - break; - case RD_VREF_VDD64500: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD64500; - break; - case RD_VREF_VDD63125: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD63125; - break; - case RD_VREF_VDD61750: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD61750; - break; - case RD_VREF_VDD60375: - io_value = fapi::ENUM_ATTR_VPD_CEN_RD_VREF_VDD60375; - break; - default: - FAPI_ERR("Unsupported VPD encode for ATTR_VPD_CEN_RD_VREF 0x%08x", - io_value); - const fapi::AttributeId & ATTR_ID = i_attr; - const uint32_t & VPD_VALUE = io_value; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_TERM_DATA_UNSUPPORTED_VPD_ENCODE); - break; - } - return l_fapirc; -} - -// ---------------------------------------------------------------------------- -// Translate vpd values to attribute enumeration for -// ATTR_VPD_CEN_SLEW_RATE_DQ_DQS -// ATTR_VPD_CEN_SLEW_RATE_ADDR -// ATTR_VPD_CEN_SLEW_RATE_CLK -// ATTR_VPD_CEN_SLEW_RATE_SPCKE -// ATTR_VPD_CEN_SLEW_RATE_CNTL -// They all have the same mapping and can share a translation procedure -// ---------------------------------------------------------------------------- -fapi::ReturnCode xlate_SLEW_RATE (const fapi::AttributeId i_attr, - uint8_t & io_value) -{ - fapi::ReturnCode l_fapirc; - const uint8_t SLEW_RATE_3V_NS = 0x03; - const uint8_t SLEW_RATE_4V_NS = 0x04; - const uint8_t SLEW_RATE_5V_NS = 0x05; - const uint8_t SLEW_RATE_6V_NS = 0x06; - const uint8_t SLEW_RATE_MAXV_NS = 0x0F; - -// Ensure that the enums are equal so that one routine can be shared - checkConstantsMatch<(uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_3V_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_ADDR_SLEW_3V_NS>(); - checkConstantsMatch<(uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_3V_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_CLK_SLEW_3V_NS>(); - checkConstantsMatch<(uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_3V_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_SPCKE_SLEW_3V_NS>(); - checkConstantsMatch<(uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_3V_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_CNTL_SLEW_3V_NS>(); - - checkConstantsMatch<(uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_4V_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_ADDR_SLEW_4V_NS>(); - checkConstantsMatch<(uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_4V_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_CLK_SLEW_4V_NS>(); - checkConstantsMatch<(uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_4V_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_SPCKE_SLEW_4V_NS>(); - checkConstantsMatch<(uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_4V_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_CNTL_SLEW_4V_NS>(); - - checkConstantsMatch<(uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_5V_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_ADDR_SLEW_5V_NS>(); - checkConstantsMatch<(uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_5V_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_CLK_SLEW_5V_NS>(); - checkConstantsMatch<(uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_5V_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_SPCKE_SLEW_5V_NS>(); - checkConstantsMatch<(uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_5V_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_CNTL_SLEW_5V_NS>(); - - checkConstantsMatch<(uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_6V_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_ADDR_SLEW_6V_NS>(); - checkConstantsMatch<(uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_6V_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_CLK_SLEW_6V_NS>(); - checkConstantsMatch<(uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_6V_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_SPCKE_SLEW_6V_NS>(); - checkConstantsMatch<(uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_6V_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_CNTL_SLEW_6V_NS>(); - - checkConstantsMatch< - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_MAXV_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_ADDR_SLEW_MAXV_NS>(); - checkConstantsMatch< - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_MAXV_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_CLK_SLEW_MAXV_NS>(); - checkConstantsMatch< - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_MAXV_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_SPCKE_SLEW_MAXV_NS>(); - checkConstantsMatch< - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_MAXV_NS== - (uint8_t)ENUM_ATTR_VPD_CEN_SLEW_RATE_CNTL_SLEW_MAXV_NS>(); - - switch(io_value) - { - case SLEW_RATE_3V_NS: - io_value = fapi::ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_3V_NS; - break; - case SLEW_RATE_4V_NS: - io_value = fapi::ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_4V_NS; - break; - case SLEW_RATE_5V_NS: - io_value = fapi::ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_5V_NS; - break; - case SLEW_RATE_6V_NS: - io_value = fapi::ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_6V_NS; - break; - case SLEW_RATE_MAXV_NS: - io_value = fapi::ENUM_ATTR_VPD_CEN_SLEW_RATE_DQ_DQS_SLEW_MAXV_NS; - break; - default: - FAPI_ERR("Unsupported VPD encode for ATTR_VPD_CEN_SLEW_RATE 0x%02x", - io_value); - const fapi::AttributeId & ATTR_ID = i_attr; - const uint8_t & VPD_VALUE = io_value; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_TERM_DATA_UNSUPPORTED_VPD_ENCODE); - break; - } - - return l_fapirc; -} - -// Determine ISDMM MR keyword to use -fapi::ReturnCode FindMRkeyword (const fapi::Target & i_mbTarget, - fapi::MBvpdKeyword & o_keyword) -{ - fapi::ReturnCode l_fapirc; - const uint8_t l_M0_KEYWORD_SIZE = 32; - uint8_t l_m0_keyword[l_M0_KEYWORD_SIZE]; - uint32_t l_M0Bufsize = l_M0_KEYWORD_SIZE; - - do - { - - l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_SPDX, - fapi::MBVPD_KEYWORD_M0, - i_mbTarget, - (uint8_t *)(&l_m0_keyword), - l_M0Bufsize); - if (l_fapirc) - { - FAPI_ERR("FindMRkeyword: Read of M0 keyword failed"); - break; // break out with fapirc - } - if (l_M0_KEYWORD_SIZE > l_M0Bufsize) - { - FAPI_ERR("FindMRkeyword:" - " less M0 keyword returned than expected %d < %d", - l_M0Bufsize, l_M0_KEYWORD_SIZE); - const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_M0; - const uint32_t & RETURNED_SIZE = l_M0Bufsize; - const fapi::Target & CHIP_TARGET = i_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INSUFFICIENT_VPD_RETURNED ); - break; // break out with fapirc - } - - uint8_t l_index = 0; - l_fapirc = FAPI_ATTR_GET(ATTR_ISDIMM_MBVPD_INDEX,&i_mbTarget, - l_index); - if(l_fapirc) - { - FAPI_ERR("FindMRkeyword: read of ISDIMM MBVPD Index failed"); - break; - } - if (l_M0_KEYWORD_SIZE < l_index) - { - FAPI_ERR("unsupported MBVPD index : 0x%02x",l_index); - const uint8_t & M0_DATA = l_index; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INVALID_M0_DATA); - break; - } - - o_keyword = fapi::MBVPD_KEYWORD_M1; - - uint8_t l_actualM0Data = l_m0_keyword[l_index]; - - switch (l_actualM0Data) - { - case 1: - o_keyword = fapi::MBVPD_KEYWORD_M1; - break; - case 2: - o_keyword = fapi::MBVPD_KEYWORD_M2; - break; - case 3: - o_keyword = fapi::MBVPD_KEYWORD_M3; - break; - case 4: - o_keyword = fapi::MBVPD_KEYWORD_M4; - break; - case 5: - o_keyword = fapi::MBVPD_KEYWORD_M5; - break; - case 6: - o_keyword = fapi::MBVPD_KEYWORD_M6; - break; - case 7: - o_keyword = fapi::MBVPD_KEYWORD_M7; - break; - case 8: - o_keyword = fapi::MBVPD_KEYWORD_M8; - break; - default: - FAPI_ERR("Incorrect M0 data : 0x%02x",l_actualM0Data); - const uint8_t & M0_DATA = l_actualM0Data; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INVALID_M0_DATA); - break; - } - - } - while (0); - if (!l_fapirc) - { - FAPI_DBG ("FindMRkeyword: use MR keyword %d",o_keyword); - } - - return l_fapirc; -} - -// Determine ISDMM MT keyword to use -fapi::ReturnCode FindMTkeyword (const fapi::Target & i_mbTarget, - const fapi::Target & i_mbaTarget, - fapi::MBvpdKeyword & o_keyword, - const VpdVersion & i_version) -{ - fapi::ReturnCode l_fapirc; - do - { - //MT keyword is located in the SPDX record, - //and found by using ATTR_SPD_NUM_RANKS - //T1: one dimm, rank 1 T2: one dimm, rank 2 T3: one dimm, rank 4 - //T5: two dimm, rank 1 T6: two dimm, rank 2 T8: two dimm, rank 4 - fapi::ATTR_SPD_NUM_RANKS_Type l_spd_dimm_ranks[2][2] = { - {fapi::ENUM_ATTR_SPD_NUM_RANKS_RX, - fapi::ENUM_ATTR_SPD_NUM_RANKS_RX}, - {fapi::ENUM_ATTR_SPD_NUM_RANKS_RX, - fapi::ENUM_ATTR_SPD_NUM_RANKS_RX} - }; - uint8_t l_mba_port; - uint8_t l_mba_dimm; - - std::vector<fapi::Target> l_target_dimm_array; - l_fapirc = fapiGetAssociatedDimms(i_mbaTarget, l_target_dimm_array, - fapi::TARGET_STATE_PRESENT); - if(l_fapirc) - { - FAPI_ERR("FindMTkeyword: read of Associated Dimms failed"); - break; - } - - for(uint8_t l_dimm_index=0; l_dimm_index<l_target_dimm_array.size(); - l_dimm_index+=1) - { - l_fapirc = FAPI_ATTR_GET(ATTR_MBA_PORT, - &l_target_dimm_array[l_dimm_index], - l_mba_port); - if(l_fapirc) - { - FAPI_ERR("FindMTkeyword: read of ATTR_MBA_PORT failed"); - break; - } - l_fapirc = FAPI_ATTR_GET(ATTR_MBA_DIMM, - &l_target_dimm_array[l_dimm_index], - l_mba_dimm); - if(l_fapirc) - { - FAPI_ERR("FindMTkeyword: read of ATTR_MBA_DIMM failed"); - break; - } - - l_fapirc = FAPI_ATTR_GET(ATTR_SPD_NUM_RANKS, - &l_target_dimm_array[l_dimm_index], - l_spd_dimm_ranks[l_mba_port][l_mba_dimm]); - if(l_fapirc) - { - FAPI_ERR("FindMTkeyword: read of ATTR_SPD_NUM_RANKS failed"); - break; - } - } - if(l_fapirc) - { - break; - } - - fapi::ATTR_SPD_NUM_RANKS_Type l_rankCopy = - fapi::ENUM_ATTR_SPD_NUM_RANKS_RX; - uint8_t l_dimmInvalid = 0; - bool l_double_drop = false; - /* Mismatched rank numbers between the paired ports is an error - * that should deconfigure the parent MBA so the data for that - * MBA should never be fetched. The same is for mismatched slot 1 - * and slot 0 on the same port - */ - - //single or double drop - if( (l_spd_dimm_ranks[0][1] == fapi::ENUM_ATTR_SPD_NUM_RANKS_RX) - && (l_spd_dimm_ranks[1][1] == fapi::ENUM_ATTR_SPD_NUM_RANKS_RX) ) - { - //if the two match, it's a valid case. - if(l_spd_dimm_ranks[0][0] == l_spd_dimm_ranks[1][0]) - { - //0000, set to 1 - if(l_spd_dimm_ranks[0][0] - == fapi::ENUM_ATTR_SPD_NUM_RANKS_RX) - { - l_rankCopy = 1; - //throwing error for all empty - FAPI_ERR("FindMTkeyword: No dimm's found"); - const uint8_t DIMM_P0S0 = l_spd_dimm_ranks[0][0]; - const uint8_t DIMM_P0S1 = l_spd_dimm_ranks[0][1]; - const uint8_t DIMM_P1S0 = l_spd_dimm_ranks[1][0]; - const uint8_t DIMM_P1S1 = l_spd_dimm_ranks[1][1]; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_DIMMS_NOT_FOUND); - break; - - //either 0101,0202,0404. - } - else - { - l_rankCopy = l_spd_dimm_ranks[0][0]; - } - } - else - { - //throwing error for invalid dimm combination - l_dimmInvalid = 1; - } - //if all 4 are the same, its double ranked - } else if(l_spd_dimm_ranks[0][1] == l_spd_dimm_ranks[0][0] && - l_spd_dimm_ranks[1][1] == l_spd_dimm_ranks[1][0] && - l_spd_dimm_ranks[0][1] == l_spd_dimm_ranks[1][1]) - { - //either 1111,2222,4444 - l_rankCopy = l_spd_dimm_ranks[0][0]; - l_double_drop = true; - } - else - { - //throwing error for invalid dimm combination - l_dimmInvalid = 1; - } - - if(l_dimmInvalid) - { - FAPI_ERR("There is an invalid combination of dimm's found"); - const uint8_t INVALID_DIMM_P0S0 = l_spd_dimm_ranks[0][0]; - const uint8_t INVALID_DIMM_P0S1 = l_spd_dimm_ranks[0][1]; - const uint8_t INVALID_DIMM_P1S0 = l_spd_dimm_ranks[1][0]; - const uint8_t INVALID_DIMM_P1S1 = l_spd_dimm_ranks[1][1]; - const fapi::Target & MBA = i_mbaTarget; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INVALID_DIMM_FOUND); - break; - } - - switch (l_rankCopy) - { - case fapi::ENUM_ATTR_SPD_NUM_RANKS_R1: - if( l_double_drop ) { - if(i_version == VM_01){ - o_keyword = fapi::MBVPD_KEYWORD_PD5; - } else { - o_keyword = fapi::MBVPD_KEYWORD_T5; - } - } else { - if(i_version == VM_01){ - o_keyword = fapi::MBVPD_KEYWORD_PD1; - } else { - o_keyword = fapi::MBVPD_KEYWORD_T1; - } - } - break; - case fapi::ENUM_ATTR_SPD_NUM_RANKS_R2: - if( l_double_drop ) { - if(i_version == VM_01){ - o_keyword = fapi::MBVPD_KEYWORD_PD6; - } else { - o_keyword = fapi::MBVPD_KEYWORD_T6; - } - } else { - if(i_version == VM_01){ - o_keyword = fapi::MBVPD_KEYWORD_PDZ; - } else { - o_keyword = fapi::MBVPD_KEYWORD_T2; - } - } - break; - case fapi::ENUM_ATTR_SPD_NUM_RANKS_R4: - if( l_double_drop ) { - if(i_version == VM_01){ - o_keyword = fapi::MBVPD_KEYWORD_PD8; - } else { - o_keyword = fapi::MBVPD_KEYWORD_T8; - } - } else { - if(i_version == VM_01){ - o_keyword = fapi::MBVPD_KEYWORD_PD4; - } else { - o_keyword = fapi::MBVPD_KEYWORD_T4; - } - } - break; - default: - FAPI_ERR("Invalid dimm rank : 0x%02x",l_rankCopy); - const uint8_t & RANK_NUM = l_rankCopy; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INVALID_MT_DATA); - break; - } - - } - while (0); - - if (!l_fapirc) - { - FAPI_DBG ("FindMTkeyword: use MT keyword %d",o_keyword); - } - - return l_fapirc; -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttrData.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttrData.C deleted file mode 100644 index 27fd1d821..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttrData.C +++ /dev/null @@ -1,227 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttrData.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ -/* [+] 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 */ -// $Id: getMBvpdAttrData.C,v 1.7 2015/09/30 20:44:12 janssens Exp $ -/** - * @file getMBvpdAttrData.C - * - * @brief get Attribute Data from MBvpd - * - */ -#include <stdint.h> - -// fapi support -#include <fapi.H> -#include <fapiUtil.H> -#include <getMBvpdAttr.H> - -using namespace fapi; -using namespace getAttrData; - -namespace fapi -{ -namespace getAttrData -{ - -// ---------------------------------------------------------------------------- -// Attribute definition table -// ---------------------------------------------------------------------------- - -const MBvpdAttrDef g_MBVPD_ATTR_DEF_array [] = -{ - -//---------------------------------------------------------------------------------- -// Attribute exceptions to use with SPDX or VSPD VM keyword -// Note: Ideally, all new exception will be in this section and be for both -// ISDIMMs and CDIMMMs -//---------------------------------------------------------------------------------- - {ATTR_VPD_MR_VERSION_BYTE,ALL_DIMM,VM_01,MBVPD_KEYWORD_MR,0,UINT8,0}, - {ATTR_VPD_MR_DATA_CONTROL_BYTE,ALL_DIMM,VM_01,MBVPD_KEYWORD_MR,1,UINT8,0}, - {ATTR_VPD_MT_VERSION_BYTE,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,0,UINT8,0}, - {ATTR_VPD_MT_DATA_CONTROL_BYTE,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,1,UINT8,0}, - {ATTR_VPD_PERIODIC_MEMCAL_MODE_OPTIONS,ALL_DIMM,VM_01,MBVPD_KEYWORD_MR,50,UINT32_BY2|UINT16_DATA,0}, - {ATTR_VPD_DRAM_RTT_PARK,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,10,UINT8_BY2_BY2_BY4|XLATE_RTT_WR,0}, - {ATTR_VPD_RD_CTR_WINDAGE_OFFSET,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,64,UINT32_BY2|UINT16_DATA,0}, - - {ATTR_VPD_DIMM_RCD_OUTPUT_TIMING,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,68,UINT8_BY2_BY2|DEFAULT_VALUE,0}, - {ATTR_VPD_DIMM_RCD_IBT,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,66,UINT32_BY2_BY2|DEFAULT_VALUE,0}, - {ATTR_VPD_CEN_RD_VREF,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,34,UINT32_BY2|UINT8_DATA|XLATE_RD_VREF,0}, - {ATTR_VPD_DRAM_WR_VREF,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,35,UINT32_BY2|UINT8_DATA|XLATE_WR_VREF,0}, - {ATTR_VPD_DRAM_WRDDR4_VREF,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,36,UINT8_BY2,0}, - {ATTR_VPD_CEN_RCV_IMP_DQ_DQS,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,37,UINT8_BY2,0}, - {ATTR_VPD_CEN_DRV_IMP_DQ_DQS,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,38,UINT8_BY2,0}, - {ATTR_VPD_CEN_DRV_IMP_CNTL,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,39,UINT8_BY2,0}, - {ATTR_VPD_CEN_DRV_IMP_ADDR,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,40,UINT8_BY2,0}, - {ATTR_VPD_CEN_DRV_IMP_CLK,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,41,UINT8_BY2,0}, - {ATTR_VPD_CEN_DRV_IMP_SPCKE,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,42,UINT8_BY2,0}, - {ATTR_VPD_CEN_SLEW_RATE_DQ_DQS,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,43,UINT8_BY2|XLATE_SLEW,0}, - {ATTR_VPD_CEN_SLEW_RATE_CNTL,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,44,UINT8_BY2|XLATE_SLEW,0}, - {ATTR_VPD_CEN_SLEW_RATE_ADDR,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,45,UINT8_BY2|XLATE_SLEW,0}, - {ATTR_VPD_CEN_SLEW_RATE_CLK,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,46,UINT8_BY2|XLATE_SLEW,0}, - {ATTR_VPD_CEN_SLEW_RATE_SPCKE,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,47,UINT8_BY2|XLATE_SLEW,0}, - {ATTR_VPD_CKE_PRI_MAP,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,48,UINT32_BY2|UINT16_DATA,0}, - {ATTR_VPD_CKE_PWR_MAP,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,50,UINT64|MERGE,0}, - {ATTR_VPD_RLO,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,54,UINT8_BY2|LOW_NIBBLE,0}, - {ATTR_VPD_WLO,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,54,UINT8_BY2|HIGH_NIBBLE,0}, - {ATTR_VPD_GPO,ALL_DIMM,VM_01,MBVPD_KEYWORD_MT,55,UINT8_BY2,0}, - -//---------------------------------------------------------------------------------- -// Attribute exceptions to use with SPDX or VSPD VD keyword -// Note: Ideally, all new exception will be in this section and be for both -// ISDIMMs and CDIMMMs -//---------------------------------------------------------------------------------- - {ATTR_VPD_DIMM_RCD_IBT,ALL_DIMM,VD_01,MBVPD_KEYWORD_MT,34,UINT32_BY2_BY2|UINT8_DATA,0}, - {ATTR_VPD_DIMM_RCD_OUTPUT_TIMING,ALL_DIMM,VD_01,MBVPD_KEYWORD_MT,36,UINT8_BY2_BY2|BOTH_DIMMS,0}, - {ATTR_VPD_DRAM_WR_VREF,ALL_DIMM,VD_01,MBVPD_KEYWORD_MT,38,UINT32_BY2|UINT8_DATA|XLATE_WR_VREF,0}, - -//---------------------------------------------------------------------------------- -// Attribute exceptions to use with VINI VZ keyword -// All entries should select either ISDIMM or CDIMM since both used the VZ keyword -// Note: Ideally, there will be no more additions in this section as all future -// DIMMs will use the VD keword -//---------------------------------------------------------------------------------- - -// Planar ISDIMM changes -// Need to include these exceptions to support early Palmetto and Habanero without the VD keyword & VZ=13 - {ATTR_VPD_DIMM_RCD_IBT,ISDIMM,VZ_13,MBVPD_KEYWORD_MT,34,UINT32_BY2_BY2|UINT8_DATA,0}, - {ATTR_VPD_DIMM_RCD_OUTPUT_TIMING,ISDIMM,VZ_13,MBVPD_KEYWORD_MT,36,UINT8_BY2_BY2|BOTH_DIMMS,0}, - // Create 3 reserved bytes in V13 - {ATTR_VPD_DRAM_WR_VREF,ISDIMM,VZ_13,MBVPD_KEYWORD_MT,38,UINT32_BY2|UINT8_DATA|XLATE_WR_VREF,0}, -// Need to include these exceptions to support early Palmetto and Habanero with VZ=11 and 10 - {ATTR_VPD_DIMM_RCD_IBT,ISDIMM,ALL_VZ,MBVPD_KEYWORD_MT,34,UINT32_BY2_BY2|DEFAULT_VALUE,0x64}, - {ATTR_VPD_DIMM_RCD_OUTPUT_TIMING,ISDIMM,ALL_VZ,MBVPD_KEYWORD_MT,35,UINT8_BY2_BY2|DEFAULT_VALUE,1}, - -// CDIMM changes in V60 (ascii 10) -// Need to include these exceptions to support pre DD 2.0 centaurs - {ATTR_VPD_TSYS_ADR,CDIMM,VZ_10,MBVPD_KEYWORD_MR,49,UINT8_BY2|PORT00,0}, - {ATTR_VPD_TSYS_ADR,CDIMM,ALL_VZ,MBVPD_KEYWORD_MR,51,UINT8_BY2|PORT00,0}, - - {ATTR_VPD_TSYS_DP18,CDIMM,VZ_10,MBVPD_KEYWORD_MR,49,UINT8_BY2|PORT11,0}, - {ATTR_VPD_TSYS_DP18,CDIMM,ALL_VZ,MBVPD_KEYWORD_MR,51,UINT8_BY2|PORT11,0}, - - {ATTR_VPD_RLO,CDIMM,VZ_10,MBVPD_KEYWORD_MT,60,UINT8_BY2|LOW_NIBBLE,0}, - {ATTR_VPD_RLO,CDIMM,ALL_VZ,MBVPD_KEYWORD_MR,49,UINT8_BY2|LOW_NIBBLE,0}, - - {ATTR_VPD_WLO,CDIMM,VZ_10,MBVPD_KEYWORD_MT,60,UINT8_BY2|HIGH_NIBBLE,0}, - {ATTR_VPD_WLO,CDIMM,ALL_VZ,MBVPD_KEYWORD_MR,49,UINT8_BY2|HIGH_NIBBLE,0}, - - {ATTR_VPD_GPO,CDIMM,VZ_10,MBVPD_KEYWORD_MT,61,UINT8_BY2,0}, - {ATTR_VPD_GPO,CDIMM,ALL_VZ,MBVPD_KEYWORD_MR,50,UINT8_BY2,0}, - -//---------------------------------------------------------------------------------- -// Base Term Data definitions to be used if no other version exceptions -// All entries to be ALL_DIMM ALL_VER -// Note: No changes are expected in this section -//---------------------------------------------------------------------------------- -// Base Term Data definitions to be used if no version exceptions - {ATTR_VPD_DRAM_RON,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,0,UINT8_BY2_BY2|XLATE_DRAM_RON,0}, - {ATTR_VPD_DRAM_RTT_NOM,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,2,UINT8_BY2_BY2_BY4|XLATE_RTT_NOM,0}, - {ATTR_VPD_DRAM_RTT_WR,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,10,UINT8_BY2_BY2_BY4|XLATE_RTT_WR,0}, - {ATTR_VPD_ODT_RD,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,18,UINT8_BY2_BY2_BY4,0}, - {ATTR_VPD_ODT_WR,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,26,UINT8_BY2_BY2_BY4,0}, - {ATTR_VPD_DIMM_RCD_OUTPUT_TIMING,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,36,UINT8_BY2_BY2|DEFAULT_VALUE,0}, - {ATTR_VPD_DIMM_RCD_IBT,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,34,UINT32_BY2_BY2|DEFAULT_VALUE,0}, - {ATTR_VPD_CEN_RD_VREF,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,37,UINT32_BY2|UINT8_DATA|XLATE_RD_VREF,0}, - {ATTR_VPD_DRAM_WR_VREF,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,38,UINT32_BY2|XLATE_WR_VREF,0}, - {ATTR_VPD_DRAM_WRDDR4_VREF,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,42,UINT8_BY2,0}, - {ATTR_VPD_CEN_RCV_IMP_DQ_DQS,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,43,UINT8_BY2,0}, - {ATTR_VPD_CEN_DRV_IMP_DQ_DQS,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,44,UINT8_BY2,0}, - {ATTR_VPD_CEN_DRV_IMP_CNTL,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,45,UINT8_BY2,0}, - {ATTR_VPD_CEN_DRV_IMP_ADDR,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,46,UINT8_BY2,0}, - {ATTR_VPD_CEN_DRV_IMP_CLK,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,47,UINT8_BY2,0}, - {ATTR_VPD_CEN_DRV_IMP_SPCKE,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,48,UINT8_BY2,0}, - {ATTR_VPD_CEN_SLEW_RATE_DQ_DQS,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,49,UINT8_BY2|XLATE_SLEW,0}, - {ATTR_VPD_CEN_SLEW_RATE_CNTL,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,50,UINT8_BY2|XLATE_SLEW,0}, - {ATTR_VPD_CEN_SLEW_RATE_ADDR,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,51,UINT8_BY2|XLATE_SLEW,0}, - {ATTR_VPD_CEN_SLEW_RATE_CLK,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,52,UINT8_BY2|XLATE_SLEW,0}, - {ATTR_VPD_CEN_SLEW_RATE_SPCKE,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,53,UINT8_BY2|XLATE_SLEW,0}, - {ATTR_VPD_CKE_PRI_MAP,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,54,UINT32_BY2|UINT16_DATA,0}, - {ATTR_VPD_CKE_PWR_MAP,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,56,UINT64|MERGE,0}, - {ATTR_VPD_RLO,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,60,UINT8_BY2|LOW_NIBBLE,0}, - {ATTR_VPD_WLO,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,60,UINT8_BY2|HIGH_NIBBLE,0}, - {ATTR_VPD_GPO,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MT,61,UINT8_BY2,0}, - -// Base Phase Rotator definitions to be used if no version exceptions - {ATTR_VPD_CEN_PHASE_ROT_M0_CLK_P0,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,0,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M0_CLK_P1,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,1,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M1_CLK_P0,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,2,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M1_CLK_P1,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,3,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_A0,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,4,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_A1,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,5,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_A2,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,6,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_A3,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,7,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_A4,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,8,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_A5,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,9,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_A6,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,10,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_A7,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,11,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_A8,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,12,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_A9,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,13,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_A10,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,14,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_A11,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,15,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_A12,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,16,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_A13,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,17,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_A14,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,18,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_A15,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,19,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_BA0,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,20,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_BA1,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,21,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_BA2,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,22,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_CASN,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,23,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_RASN,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,24,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_CMD_WEN,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,25,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_PAR,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,26,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M_ACTN,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,27,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CKE0,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,28,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CKE1,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,29,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CKE2,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,30,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CKE3,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,31,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CSN0,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,32,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CSN1,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,33,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CSN2,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,34,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_CSN3,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,35,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_ODT0,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,36,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M0_CNTL_ODT1,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,37,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CKE0,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,38,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CKE1,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,39,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CKE2,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,40,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CKE3,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,41,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CSN0,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,42,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CSN1,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,43,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CSN2,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,44,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_CSN3,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,45,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_ODT0,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,46,UINT8_BY2,0}, - {ATTR_VPD_CEN_PHASE_ROT_M1_CNTL_ODT1,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,47,UINT8_BY2,0}, - {ATTR_VPD_DRAM_2N_MODE_ENABLED,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,48,UINT8_BY2,0}, - {ATTR_VPD_TSYS_ADR,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,49,UINT8_BY2|PORT00,0}, - {ATTR_VPD_TSYS_DP18,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,49,UINT8_BY2|PORT11,0}, - -// Membuf-level data that is stored within MR - {ATTR_VPD_POWER_CONTROL_CAPABLE,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,253,UINT8,0}, -}; - -const uint32_t g_MBVPD_ATTR_DEF_array_size = - sizeof(g_MBVPD_ATTR_DEF_array) / - sizeof(MBvpdAttrDef); - -} // namespace getAttrData -} // namespace fapi diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdDram2NModeEnabled.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdDram2NModeEnabled.C deleted file mode 100644 index b5b4b95ad..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdDram2NModeEnabled.C +++ /dev/null @@ -1,98 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMBvpdDram2NModeEnabled.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2013,2015 */ -/* [+] 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 */ -// $Id: getMBvpdDram2NModeEnabled.C,v 1.4 2014/12/11 13:35:35 whs Exp $ -/** - * @file getMBvpdDram2NModeEnabled.C - * - * @brief get the Dram 2N Mode value from MBvpd keyword MR - * and return whether 2N mode is enabled - * - */ - -#include <stdint.h> - -// fapi support -#include <fapi.H> -#include <fapiUtil.H> -#include <getMBvpdDram2NModeEnabled.H> -#include <getMBvpdAttr.H> - -extern "C" -{ -using namespace fapi; - -fapi::ReturnCode getMBvpdDram2NModeEnabled( - const fapi::Target &i_mbaTarget, - uint8_t & o_val) -{ - fapi::ReturnCode l_fapirc; - uint8_t l_dram2NMode [2] = {0,0}; - - FAPI_DBG("getMBvpdDram2NModeEnabled: entry "); - - do { - // Retrieve the Dram 2N Mode from the MR keyword - FAPI_EXEC_HWP(l_fapirc, - getMBvpdAttr, - i_mbaTarget, - fapi::ATTR_VPD_DRAM_2N_MODE_ENABLED, - &l_dram2NMode, - sizeof(l_dram2NMode)); - if (l_fapirc) - { - FAPI_ERR("getMBvpdDram2NModeEnabled: Read of VZ keyword failed"); - break; // break out with fapirc - } - // ensure values match - if (l_dram2NMode[0] != l_dram2NMode[1]) { - FAPI_ERR("getMBvpdDram2NModeEnabled:" - " ports should have same value 0x%02x != 0x%02x", - l_dram2NMode[0],l_dram2NMode[1]); - const uint32_t & PORT0 = l_dram2NMode[0]; - const uint32_t & PORT1 = l_dram2NMode[1]; - const fapi::Target & MBA_TARGET = i_mbaTarget; - FAPI_SET_HWP_ERROR(l_fapirc,RC_MBVPD_DRAM_2N_MODE_NOT_EQUAL); - break; // break out with fapirc - } - // return value - const uint8_t DRAM_2N_MODE = 0x02; - if (DRAM_2N_MODE == l_dram2NMode[0] ) - { - o_val=fapi::ENUM_ATTR_VPD_DRAM_2N_MODE_ENABLED_TRUE; - } - else - { - o_val=fapi::ENUM_ATTR_VPD_DRAM_2N_MODE_ENABLED_FALSE; - } - - } while (0); - - FAPI_DBG("getMBvpdDram2NModeEnabled: exit rc=0x%08x)", - static_cast<uint32_t>(l_fapirc)); - - return l_fapirc; -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdMemoryDataVersion.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdMemoryDataVersion.C deleted file mode 100644 index 2f83fa234..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdMemoryDataVersion.C +++ /dev/null @@ -1,172 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMBvpdMemoryDataVersion.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2015 */ -/* [+] 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 */ -// $Id: getMBvpdMemoryDataVersion.C,v 1.3 2015/10/06 15:18:04 dcrowell Exp $ -/** - * @file getMBvpdMemoryDataVersion.C - * - * @brief get the Memory Data version from MBvpd record SPDX keyword VM - * - */ - -#include <stdint.h> - -// fapi support -#include <fapi.H> -#include <fapiUtil.H> -#include <getMBvpdMemoryDataVersion.H> -#include <fapiSystemConfig.H> -#include <getMBvpdAttr.H> -extern "C" -{ -using namespace fapi; -using namespace getAttrData; - -fapi::ReturnCode getMBvpdMemoryDataVersion( - const fapi::Target &i_mbTarget, - uint32_t & o_val) -{ - fapi::ReturnCode l_fapirc; - DimmType l_dimmType = ISDIMM; - fapi::MBvpdRecord l_record = fapi::MBVPD_RECORD_SPDX; - uint32_t l_vpdMemoryDataVersion = VM_KEYWORD_DEFAULT_VALUE; - uint32_t l_bufSize = sizeof(l_vpdMemoryDataVersion); - - FAPI_DBG("getMBvpdMemoryDataVersion: entry "); - - do { - - FAPI_DBG("getMBvpdMemoryDataVersion: Membuff path=%s ", - i_mbTarget.toEcmdString() ); - - // Find the dimm type - // Determine if ISDIMM or CDIMM - - // Find one mba target for passing it to fapiGetAssociatedDimms - std::vector<fapi::Target> l_mba_chiplets; - l_fapirc = fapiGetChildChiplets( i_mbTarget , - fapi::TARGET_TYPE_MBA_CHIPLET, l_mba_chiplets ); - if((l_fapirc) || (l_mba_chiplets.size() == 0)) - { - FAPI_ERR("getMBvpdMemoryDataVersion: Problem getting MBA's of Membuff"); - break; //return error - } - - std::vector<fapi::Target> l_target_dimm_array; - l_fapirc = fapiGetAssociatedDimms(l_mba_chiplets[0], l_target_dimm_array); - if(l_fapirc) - { - FAPI_ERR("getMBvpdMemoryDataVersion: Problem getting DIMMs of Membuff"); - break; //return error - } - if(l_target_dimm_array.size() != 0) - { - uint8_t l_customDimm=0; - l_fapirc = FAPI_ATTR_GET(ATTR_SPD_CUSTOM,&l_target_dimm_array[0], - l_customDimm); - if(l_fapirc) { - FAPI_ERR("getMBvpdMemoryDataVersion: ATTR_SPD_CUSTOM failed "); - break; //return error - } - - if (l_customDimm == fapi::ENUM_ATTR_SPD_CUSTOM_YES) - { - l_dimmType = CDIMM; - FAPI_DBG("getMBvpdMemoryDataVersion: CDIMM TYPE!!!"); - } - else - { - l_dimmType = ISDIMM; - FAPI_DBG("getMBvpdMemoryDataVersion: ISDIMM TYPE!!!"); - } - } - else - { - l_dimmType = ISDIMM; - FAPI_DBG("getMBvpdMemoryDataVersion: ISDIMM TYPE (dimm array size = 0)"); - } - - if( l_dimmType == CDIMM) - { - l_record = fapi::MBVPD_RECORD_VSPD; - } - - // get Memory Data version from record VSPD/SPDX keyword VM - l_fapirc = fapiGetMBvpdField(l_record, - fapi::MBVPD_KEYWORD_VM, - i_mbTarget, - reinterpret_cast<uint8_t *>(&l_vpdMemoryDataVersion), - l_bufSize); - if (l_fapirc) - { - FAPI_DBG("getMBvpdMemoryDataVersion: Returning default" - " as VM keyword read failed."); - l_fapirc = FAPI_RC_SUCCESS; // Lets make it success and return default - break; // break out and return - } - - // Check that sufficient size was returned. - if (l_bufSize < sizeof(l_vpdMemoryDataVersion) ) - { - FAPI_ERR("getMBvpdMemoryDataVersion:" - " less keyword data returned than expected %d < %d", - l_bufSize, sizeof(l_vpdMemoryDataVersion)); - const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_VM; - const uint32_t & RETURNED_SIZE = l_bufSize; - const fapi::Target & CHIP_TARGET = i_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc,RC_MBVPD_INSUFFICIENT_VPD_RETURNED); - break; // break out with fapirc - } - - // Check if the format byte in the value returned is in between valid range - if (( ((MBvpdVMKeyword *)(&l_vpdMemoryDataVersion))->iv_version > VM_SUPPORTED_HIGH_VER )|| - ( ((MBvpdVMKeyword *)(&l_vpdMemoryDataVersion))->iv_version == VM_NOT_SUPPORTED )) - { - FAPI_ERR("getMBvpdMemoryDataVersion:" - " keyword data returned is invalid : %d ", - l_vpdMemoryDataVersion); - const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_VM; - const uint32_t & RETURNED_VALUE = l_vpdMemoryDataVersion; - const uint32_t & RECORD_NAME = l_record; - const uint32_t & DIMM_TYPE = l_dimmType; - const fapi::Target & CHIP_TARGET = i_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc,RC_MBVPD_INVALID_VM_DATA_RETURNED); - break; // break out with fapirc - } - // return value - o_val = static_cast<uint32_t>(FAPI_BE16TOH(l_vpdMemoryDataVersion)); - - FAPI_DBG("getMBvpdMemoryDataVersion: Memory Data version=0x%08x", - o_val); - - - } while (0); - - FAPI_DBG("getMBvpdMemoryDataVersion: exit rc=0x%08x)", - static_cast<uint32_t>(l_fapirc)); - - return l_fapirc; -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdRing.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdRing.C deleted file mode 100644 index b5b8b2b92..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdRing.C +++ /dev/null @@ -1,69 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMBvpdRing.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* 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 */ -// $Id: getMBvpdRing.C,v 1.1 2013/10/09 20:52:37 mjjones Exp $ -/** - * @file getMBvpdRing.C - * - * @brief function to fetch repair rings from MBVPD records - * - */ - -#include <stdint.h> -#include <fapi.H> // fapi support -#include <getMBvpdRing.H> -#include <mvpdRingFuncs.H> - -extern "C" -{ -using namespace fapi; - -// getMBvpdRing: Wrapper to call common function mbvpdRingFunc -fapi::ReturnCode getMBvpdRing(fapi::MBvpdRecord i_record, - fapi::MBvpdKeyword i_keyword, - const fapi::Target &i_fapiTarget, - const uint8_t i_chipletId, - const uint8_t i_ringId, - uint8_t *i_pRingBuf, - uint32_t &io_rRingBufsize) -{ - fapi::ReturnCode l_fapirc; - - FAPI_INF("getMBvpdRing: entry ringId=0x%x, chipletId=0x%x, size=0x%x", - i_ringId, i_chipletId, io_rRingBufsize ); - - // Pass the parameters into mbvpdRingFunc - l_fapirc = mbvpdRingFunc(MBVPD_RING_GET, - i_record, - i_keyword, - i_fapiTarget, - i_chipletId, - i_ringId, - i_pRingBuf, - io_rRingBufsize ); - - FAPI_INF("getMBvpdRing: exit rc=0x%x", static_cast<uint32_t>(l_fapirc)); - - return l_fapirc; -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdRing.H b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdRing.H deleted file mode 100644 index abde02fde..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdRing.H +++ /dev/null @@ -1,93 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMBvpdRing.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* 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 */ -// $Id: getMBvpdRing.H,v 1.1 2013/10/09 20:53:03 mjjones Exp $ -/** - * @file getMBvpdRing.H - * - * @brief Prototype for getMBvpdRing() - - * get a repair ring from a MBVPD record - */ - - #ifndef _HWP_GETMBVPDRING_ - #define _HWP_GETMBVPDRING_ - - #include <fapi.H> - -// function pointer typedef definition for HWP call support -typedef fapi::ReturnCode (*getMBvpdRing_FP_t) - (fapi::MBvpdRecord,fapi::MBvpdKeyword,const fapi::Target &, - const uint8_t, const uint8_t, uint8_t *, uint32_t &); - - -extern "C" -{ -/** - * @brief get specified ring from MBVPD for the specified memory buffer target. - * - * A Ring Id Chiplet Id should be unique in the mbvpd record. - * The code does not validate. No assumption should be made on which would - * be returned if there are multiple. - * - * @param i_record - Record enumerator - * @param i_keyword - Keyword enumerator - * Supported Rings are: - * MBVPD_RECORD_VSPD - MBVPD_KEYWORD_PDD - * @param i_fapiTarget - memory buffer target - * @param i_chipletId - Chiplet ID - * @param i_ringId - Ring ID - * @param i_pRingBuf - pointer to a buffer allocated by the caller - * to receive the ring header and data. - * if NULL, the size of the min buffer required - * buffer will be returned in io_rRingBufsize - * with rc FAPI_RC_SUCCESS. - * @param io_rRingBufsize - in: size of ring buffer that caller has - * allocated - * out: number of BYTES that were copied to the - * output buffer. - * If the ring was not found, an error - * will be returned and this will be 0. - * If the output buffer is not big enough, - * an error will be returned and this will - * be the minimum size required. - * The buffer contains the CompressedScanData - * structure followed by compressed data. The - * caller does compression and decompression. - * Buffer: io_rRingBufsize returns xNN. - * byte x0 CompressedScanData structure (rs4 header) - * byte x18 compressed data (sizeof CompressedScanData is 0x18) - * byte xNN last byte of compressed data - * - * @return fapi::ReturnCode - FAPI_RC_SUCCESS if success, - * relevant error code for failure. - */ -fapi::ReturnCode getMBvpdRing( fapi::MBvpdRecord i_record, - fapi::MBvpdKeyword i_keyword, - const fapi::Target &i_fapiTarget, - const uint8_t i_chipletId, - const uint8_t i_ringId, - uint8_t *io_pRingBuf, - uint32_t &io_rRingBufsize ); - -} - -#endif diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSPDXRecordVersion.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSPDXRecordVersion.C deleted file mode 100644 index 0dace4805..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSPDXRecordVersion.C +++ /dev/null @@ -1,157 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSPDXRecordVersion.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2015 */ -/* [+] 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 */ -// $Id: getMBvpdSPDXRecordVersion.C,v 1.2 2015/09/29 20:55:54 janssens Exp $ -/** - * @file getMBvpdSPDXRecordVersion.C - * - * @brief get the SPDX record version from MBvpd record SPDX keyword VD - * - */ - -#include <stdint.h> - -// fapi support -#include <fapi.H> -#include <fapiUtil.H> -#include <getMBvpdSPDXRecordVersion.H> -#include <fapiSystemConfig.H> -#include <getMBvpdAttr.H> - -extern "C" -{ -using namespace fapi; -using namespace getAttrData; - -fapi::ReturnCode getMBvpdSPDXRecordVersion( - const fapi::Target &i_mbTarget, - uint32_t & o_val) -{ - fapi::ReturnCode l_fapirc; - DimmType l_dimmType = ISDIMM; - fapi::MBvpdRecord l_record = fapi::MBVPD_RECORD_SPDX; - uint16_t l_vpdSPDXRecordVersion = VD_KEYWORD_DEFAULT_VALUE; - uint32_t l_bufSize = sizeof(l_vpdSPDXRecordVersion); - - FAPI_DBG("getMBvpdSPDXRecordVersion: entry "); - - do { - - FAPI_DBG("getMBvpdSPDXRecordVersion: Membuff path=%s ", - i_mbTarget.toEcmdString() ); - - // Find the dimm type - // Determine if ISDIMM or CDIMM - - // Find one mba target for passing it to fapiGetAssociatedDimms - std::vector<fapi::Target> l_mba_chiplets; - l_fapirc = fapiGetChildChiplets( i_mbTarget , - fapi::TARGET_TYPE_MBA_CHIPLET, l_mba_chiplets ); - if((l_fapirc) || (l_mba_chiplets.size() == 0)) - { - FAPI_ERR("getMBvpdSPDXRecordVersion: Problem getting MBA's of Membuff"); - break; //return error - } - - std::vector<fapi::Target> l_target_dimm_array; - l_fapirc = fapiGetAssociatedDimms(l_mba_chiplets[0], l_target_dimm_array); - if(l_fapirc) - { - FAPI_ERR("getMBvpdSPDXRecordVersion: Problem getting DIMMs of Membuff"); - break; //return error - } - if(l_target_dimm_array.size() != 0) - { - uint8_t l_customDimm=0; - l_fapirc = FAPI_ATTR_GET(ATTR_SPD_CUSTOM,&l_target_dimm_array[0], - l_customDimm); - if(l_fapirc) { - FAPI_ERR("getMBvpdSPDXRecordVersion: ATTR_SPD_CUSTOM failed "); - break; //return error - } - - if (l_customDimm == fapi::ENUM_ATTR_SPD_CUSTOM_YES) - { - l_dimmType = CDIMM; - FAPI_DBG("getMBvpdSPDXRecordVersion: CDIMM TYPE!!!"); - } - else - { - l_dimmType = ISDIMM; - FAPI_DBG("getMBvpdSPDXRecordVersion: ISDIMM TYPE!!!"); - } - } - else - { - l_dimmType = ISDIMM; - FAPI_DBG("getMBvpdSPDXRecordVersion: ISDIMM TYPE (dimm array size = 0)"); - } - - if(l_dimmType == CDIMM) - { - l_record = fapi::MBVPD_RECORD_VSPD; - } - - // get version from record SPDX/VSPD keyword VD - l_fapirc = fapiGetMBvpdField(l_record, - fapi::MBVPD_KEYWORD_VD, - i_mbTarget, - reinterpret_cast<uint8_t *>(&l_vpdSPDXRecordVersion), - l_bufSize); - if (l_fapirc) - { - FAPI_DBG("getMBvpdSPDXRecordVersion: Returning default " - "as VD keyword read failed"); - l_fapirc = FAPI_RC_SUCCESS; // Lets make it success and return default - break; // break out with fapirc - } - - // Check that sufficient size was returned. - if (l_bufSize < sizeof(l_vpdSPDXRecordVersion) ) - { - FAPI_ERR("getMBvpdSPDXRecordVersion:" - " less keyword data returned than expected %d < %d", - l_bufSize, sizeof(l_vpdSPDXRecordVersion)); - const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_VD; - const uint32_t & RETURNED_SIZE = l_bufSize; - const fapi::Target & CHIP_TARGET = i_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc,RC_MBVPD_INSUFFICIENT_VPD_RETURNED); - break; // break out with fapirc - } - // return value - o_val = static_cast<uint32_t>(FAPI_BE16TOH(l_vpdSPDXRecordVersion)); - - FAPI_DBG("getMBvpdSPDXRecordVersion: SPDX Record version=0x%08x", - o_val); - - - } while (0); - - FAPI_DBG("getMBvpdSPDXRecordVersion: exit rc=0x%08x)", - static_cast<uint32_t>(l_fapirc)); - - return l_fapirc; -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSensorMap.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSensorMap.C deleted file mode 100644 index 020b3e281..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSensorMap.C +++ /dev/null @@ -1,129 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSensorMap.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* 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 */ -// $Id: getMBvpdSensorMap.C,v 1.2 2014/02/12 22:11:52 mjjones Exp $ - -/** - * @file getMBvpdSensorMap.C - * - * @brief Return primary and secondary sensor map from cvpd record VSPD - * keyword MW for attributes: - * - * ATTR_VPD_CDIMM_SENSOR_MAP_PRIMARY - * ATTR_VPD_CDIMM_SENSOR_MAP_SECONDARY - */ - -#include <stdint.h> - -// fapi support -#include <fapi.H> -#include <getMBvpdSensorMap.H> - -extern "C" -{ -using namespace fapi; - -fapi::ReturnCode getMBvpdSensorMap( - const fapi::Target &i_mbTarget, - const fapi::MBvpdSensorMap i_attr, - uint8_t &o_val) - -{ - fapi::ReturnCode l_fapirc; - - //MW keyword layout - struct mw_keyword - { - uint8_t MWKeywordVersion; - uint8_t masterPowerSlope_MSB; //big endian order - uint8_t masterPowerSlope_LSB; - uint8_t masterPowerIntercept_MSB; //big endian order - uint8_t masterPowerIntercept_LSB; - uint8_t reserved[4]; - uint8_t tempSensorPrimaryLayout; - uint8_t tempSensorSecondaryLayout; - }; - const uint32_t MW_KEYWORD_SIZE = sizeof(mw_keyword); // keyword size - - mw_keyword * l_pMwBuffer = NULL; // MBvpd MW keyword buffer - uint32_t l_MwBufsize = sizeof(mw_keyword); - - FAPI_DBG("getMBvpdSensorMap: entry "); - - do { - - l_pMwBuffer = new mw_keyword; - - // Read the MW keyword field - l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD, - fapi::MBVPD_KEYWORD_MW, - i_mbTarget, - reinterpret_cast<uint8_t *>(l_pMwBuffer), - l_MwBufsize); - if (l_fapirc) - { - FAPI_ERR("getMBvpdSensorMap: Read of MV keyword failed"); - break; // break out with fapirc - } - // Check that sufficient MW keyword was returned. - if (l_MwBufsize < MW_KEYWORD_SIZE ) - { - FAPI_ERR("getMBvpdSensorMap:" - " less MW keyword returned than expected %d < %d", - l_MwBufsize, MW_KEYWORD_SIZE); - const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_MW; - const uint32_t & RETURNED_SIZE = l_MwBufsize; - const fapi::Target & CHIP_TARGET = i_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INSUFFICIENT_VPD_RETURNED ); - break; // break out with fapirc - } - - // Return requested value - switch (i_attr) - { - case SENSOR_MAP_PRIMARY: - o_val = l_pMwBuffer->tempSensorPrimaryLayout; - break; - case SENSOR_MAP_SECONDARY: - o_val = l_pMwBuffer->tempSensorSecondaryLayout; - break; - default: // Hard to do, but needs to be caught - FAPI_ERR("getMBvpdSensorMap: invalid attribute ID 0x%02x", - i_attr); - const fapi::MBvpdSensorMap & ATTR_ID = i_attr; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INVALID_ATTRIBUTE_ID); - break; - } - - } while (0); - - delete l_pMwBuffer; - l_pMwBuffer = NULL; - - FAPI_DBG("getMBvpdSensorMap: exit rc=0x%08x", - static_cast<uint32_t>(l_fapirc)); - - return l_fapirc; - -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSlopeInterceptData.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSlopeInterceptData.C deleted file mode 100644 index e53e406cf..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSlopeInterceptData.C +++ /dev/null @@ -1,492 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSlopeInterceptData.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2013,2015 */ -/* [+] 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 */ -// $Id: getMBvpdSlopeInterceptData.C,v 1.5 2015/09/29 15:59:42 dcrowell Exp $ -/** - * @file getMBvpdSlopeInterceptData.C - * - * @brief get master and supplier power slope and intercept data - * from MBvpd MV and MW keywords - * - */ - -#include <stdint.h> - -// fapi support -#include <fapi.H> -#include <getMBvpdSlopeInterceptData.H> - -extern "C" -{ -using namespace fapi; - -// local function to get master power slope and intercept data -fapi::ReturnCode getMBvpdMasterData( - const fapi::Target &i_mbTarget, - const fapi::MBvpdSlopeIntercept i_attr, - uint32_t & o_val); - -// local function to get supplier power slope and intercept data -fapi::ReturnCode getMBvpdSupplierData( - const fapi::Target &i_mbTarget, - const fapi::MBvpdSlopeIntercept i_attr, - uint32_t & o_val); - -/** - * @brief get power slope and intercept data from cvpd record VSPD - * keyword MW and MV - * @param[in] i_mbTarget - mb target - * @param[in] i_attr - enumerator to select requested value - * @param[out] o_val - master/supplier slope/intercept value - * - * @return fapi::ReturnCode - FAPI_RC_SUCCESS if success, - * relevant error code for failure. - */ - -fapi::ReturnCode getMBvpdSlopeInterceptData( - const fapi::Target &i_mbTarget, - const fapi::MBvpdSlopeIntercept i_attr, - uint32_t & o_val) -{ - fapi::ReturnCode l_fapirc; - - FAPI_DBG("getMBvpdSlopeInterceptData: entry "); - - // get master values from MW keyword or supplier values from MV keyword - switch (i_attr) - { - case MASTER_POWER_SLOPE: - case MASTER_POWER_INTERCEPT: - case MASTER_TOTAL_POWER_SLOPE: - case MASTER_TOTAL_POWER_INTERCEPT: - l_fapirc = getMBvpdMasterData(i_mbTarget, i_attr, o_val); - break; - case SUPPLIER_POWER_SLOPE: - case SUPPLIER_POWER_INTERCEPT: - case SUPPLIER_TOTAL_POWER_SLOPE: - case SUPPLIER_TOTAL_POWER_INTERCEPT: - l_fapirc = getMBvpdSupplierData(i_mbTarget, i_attr, o_val); - break; - default: // Unlikely, but needs to be caught - FAPI_ERR("getMBvpdSlopeInterceptData: invalid attribute ID 0x%02x", - i_attr); - const fapi::MBvpdSlopeIntercept & ATTR_ID = i_attr; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INVALID_ATTRIBUTE_ID); - } - - FAPI_DBG("getMBvpdSlopeInterceptData: exit rc=0x%08x", - static_cast<uint32_t>(l_fapirc)); - return l_fapirc; -} - -// local function to get master power slope and intercept data -// -// the master power slope and intercept are in the MW keyword -// -fapi::ReturnCode getMBvpdMasterData( - const fapi::Target &i_mbTarget, - const fapi::MBvpdSlopeIntercept i_attr, - uint32_t & o_val) -{ - fapi::ReturnCode l_fapirc; - - //MW keyword layout - struct mw_keyword - { - uint8_t MWKeywordVersion; - uint8_t masterPowerSlope_MSB; //big endian order - uint8_t masterPowerSlope_LSB; - uint8_t masterPowerIntercept_MSB; //big endian order - uint8_t masterPowerIntercept_LSB; - uint8_t masterTotalPowerSlope_MSB; //big endian order - uint8_t masterTotalPowerSlope_LSB; - uint8_t masterTotalPowerIntercept_MSB; //big endian order - uint8_t masterTotalPowerIntercept_LSB; - uint8_t tempSensorPrimaryLayout; - uint8_t tempSensorSecondaryLayout; - }; - const uint32_t MW_KEYWORD_SIZE = sizeof(mw_keyword); // keyword size - - mw_keyword * l_pMwBuffer = NULL; // MBvpd MW keyword buffer - uint32_t l_MwBufsize = sizeof(mw_keyword); - - FAPI_DBG("getMBvpdMasterData: entry "); - - do { - - l_pMwBuffer = new mw_keyword; - - // Read the MW keyword field - l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD, - fapi::MBVPD_KEYWORD_MW, - i_mbTarget, - reinterpret_cast<uint8_t *>(l_pMwBuffer), - l_MwBufsize); - if (l_fapirc) - { - FAPI_ERR("getMBvpdMasterData: Read of MV keyword failed"); - break; // break out with fapirc - } - - // Check that sufficient MW keyword was returned. - if (l_MwBufsize < MW_KEYWORD_SIZE ) - { - FAPI_ERR("getMBvpdMasterData:" - " less MW keyword returned than expected %d < %d", - l_MwBufsize, MW_KEYWORD_SIZE); - const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_MW; - const uint32_t & RETURNED_SIZE = l_MwBufsize; - const fapi::Target & CHIP_TARGET = i_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INSUFFICIENT_VPD_RETURNED ); - break; // break out with fapirc - } - - // Return requested value - switch (i_attr) - { - case MASTER_POWER_SLOPE: //get each byte to perserve endian - o_val = l_pMwBuffer->masterPowerSlope_LSB; - o_val |= (l_pMwBuffer->masterPowerSlope_MSB << 8); - break; - case MASTER_POWER_INTERCEPT: //get each byte to perserve endian - o_val = l_pMwBuffer->masterPowerIntercept_LSB; - o_val |= (l_pMwBuffer->masterPowerIntercept_MSB << 8); - break; - case MASTER_TOTAL_POWER_SLOPE: //get each byte to perserve endian - o_val = l_pMwBuffer->masterTotalPowerSlope_LSB; - o_val |= (l_pMwBuffer->masterTotalPowerSlope_MSB << 8); - break; - case MASTER_TOTAL_POWER_INTERCEPT: //get each byte to perserve endian - o_val = l_pMwBuffer->masterTotalPowerIntercept_LSB; - o_val |= (l_pMwBuffer->masterTotalPowerIntercept_MSB << 8); - break; - default: //i_attr value was checked before call so should not get here - break; - } - - } while (0); - - delete l_pMwBuffer; - l_pMwBuffer = NULL; - - FAPI_DBG("getMBvpdMasterData: exit rc=0x%08x", - static_cast<uint32_t>(l_fapirc)); - - return l_fapirc; -} - -// local function to get supplier power slope and intercept data -// -// Read the #I keyword to get the module ID of this CDIMM -// Then read the #MV keyword which has all the vendor supplied info -// and search the list for the module ID found in the #I keyword -// -fapi::ReturnCode getMBvpdSupplierData( - const fapi::Target &i_mbTarget, - const fapi::MBvpdSlopeIntercept i_attr, - uint32_t & o_val) -{ - - //#I keyword layout - const uint32_t PDI_DDR3_KEYWORD_SIZE = 256; - const uint32_t PDI_DDR4_KEYWORD_SIZE = 384; // assumed size for DDR4 - const uint8_t SPD_DDR3 = 0xB; - const uint8_t SPD_DDR4 = 0xC; - struct pdI_keyword - { - union - { - struct // common - { - uint8_t filler1[2]; - uint8_t mem_type; - } common; - struct // DDR3 layout of #I - { - uint8_t filler1[117]; // other fields and reserved bytes - uint8_t moduleID_MSB; // at offset 117. Big endian order - uint8_t moduleID_LSB; // VPD data CCIN_31E1_v.5.3.ods - uint8_t filler2[PDI_DDR3_KEYWORD_SIZE-117-2]; //trailing space - } ddr3; - struct // DDR4 layout of #I - { - uint8_t filler1[350]; // other fields and reserved bytes - uint8_t moduleID_MSB; // at offset 320. Big endian order - uint8_t moduleID_LSB; // - uint8_t filler2[PDI_DDR4_KEYWORD_SIZE-350-2]; //trailing space - } ddr4; - } pdI; - }; - - //MV keyword layout - struct mv_vendorInfo - { - uint8_t supplierID_MSB; // Big endian order - uint8_t supplierID_LSB; - uint8_t supplierPowerSlope_MSB; // Big endian order - uint8_t supplierPowerSlope_LSB; - uint8_t supplierPowerIntercept_MSB; // Big endian order - uint8_t supplierPowerIntercept_LSB; - uint8_t supplierTotalPowerSlope_MSB; // Big endian order - uint8_t supplierTotalPowerSlope_LSB; - uint8_t supplierTotalPowerIntercept_MSB; // Big endian order - uint8_t supplierTotalPowerIntercept_LSB; - - }; - struct mv_keyword //variable length. Structure is size of 1 entry. - { - uint8_t version; - uint8_t numEntries; - mv_vendorInfo firstVendorInfo; - // variable number of vendor supplied entries - }; - - fapi::ReturnCode l_fapirc; - pdI_keyword * l_pPdIBuffer = NULL; // MBvpd #I keyword buffer - uint32_t l_pdIBufsize = sizeof(pdI_keyword); - uint8_t l_moduleID_LSB = 0; // module ID to look for - uint8_t l_moduleID_MSB = 0; - mv_keyword * l_pMvBuffer = NULL; // MBvpd MV keyword buffer - uint32_t l_mvBufsize = 0; // variable length - mv_vendorInfo * l_pVendorInfo = NULL; - uint32_t l_offset = 0; - bool l_found = false; - - do { - - l_pPdIBuffer = new pdI_keyword; - - // Read the #I keyword field to get the Module ID - l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD, - fapi::MBVPD_KEYWORD_PDI, - i_mbTarget, - reinterpret_cast<uint8_t *>(l_pPdIBuffer), - l_pdIBufsize); - if (l_fapirc) - { - FAPI_ERR("getMBvpdSupplierData: Read of pdI keyword failed"); - break; // break out with fapirc - } - - FAPI_DBG("getMBvpdSupplierData: #I mem type=0x%02x ", - l_pPdIBuffer->pdI.common.mem_type); - - // check for DDR3 or DDR4 - if (SPD_DDR3 == l_pPdIBuffer->pdI.common.mem_type ) - { - // Check that sufficient #I was returned. - if (l_pdIBufsize < PDI_DDR3_KEYWORD_SIZE ) - { - FAPI_ERR("getMBvpdSupplierData:" - " less DDR3 #I keyword returned than expected %d < %d", - l_pdIBufsize, PDI_DDR3_KEYWORD_SIZE); - const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_PDI; - const uint32_t & RETURNED_SIZE = l_pdIBufsize; - const fapi::Target & CHIP_TARGET = i_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc,RC_MBVPD_INSUFFICIENT_VPD_RETURNED); - break; // break out with fapirc - } - - // grab module ID - l_moduleID_LSB = l_pPdIBuffer->pdI.ddr3.moduleID_LSB; - l_moduleID_MSB = l_pPdIBuffer->pdI.ddr3.moduleID_MSB; - } - else if (SPD_DDR4 == l_pPdIBuffer->pdI.common.mem_type ) - { - // Check that sufficient #I was returned. - if (l_pdIBufsize < PDI_DDR4_KEYWORD_SIZE ) - { - FAPI_ERR("getMBvpdSupplierData:" - " less DDR4 #I keyword returned than expected %d < %d", - l_pdIBufsize, PDI_DDR4_KEYWORD_SIZE); - const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_PDI; - const uint32_t & RETURNED_SIZE = l_pdIBufsize; - const fapi::Target & CHIP_TARGET = i_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc,RC_MBVPD_INSUFFICIENT_VPD_RETURNED); - break; // break out with fapirc - } - - // grab module ID - l_moduleID_LSB = l_pPdIBuffer->pdI.ddr4.moduleID_LSB; - l_moduleID_MSB = l_pPdIBuffer->pdI.ddr4.moduleID_MSB; - } - else - { - FAPI_ERR("getMBvpdSupplierData:" - " unexpected memory type in #I"); - const uint8_t & MEM_TYPE = l_pPdIBuffer->pdI.common.mem_type; - const fapi::Target & MEMBUF_TARGET = i_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc,RC_MBVPD_UNEXPECTED_MEM_TYPE); - break; // break out with fapirc - } - - // Done with #I buffer. Error paths free buffer at end. - delete l_pPdIBuffer; - l_pPdIBuffer = NULL; - - FAPI_DBG("getMBvpdSupplierData: #I moduleID=0x%08x ", - l_moduleID_LSB+(l_moduleID_MSB<<8)); - - // see how big the MV keyword is as it is variable length - l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD, - fapi::MBVPD_KEYWORD_MV, - i_mbTarget, - NULL, //pass NULL buff pointer to get size - l_mvBufsize); - if (l_fapirc) - { - FAPI_ERR("getMBvpdSupplierData: Read of MV keyword failed"); - break; // break out with fapirc - } - - // read MV keyword - l_pMvBuffer = (mv_keyword *)new uint8_t[l_mvBufsize]; - - l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD, - fapi::MBVPD_KEYWORD_MV, - i_mbTarget, - reinterpret_cast<uint8_t *>(l_pMvBuffer), - l_mvBufsize); - if (l_fapirc) - { - FAPI_ERR("getMBvpdSupplierData: Read of MV keyword failed"); - break; // break out with fapirc - } - - // Check that sufficient MV was returned to get at least the count. - l_pVendorInfo = &(l_pMvBuffer->firstVendorInfo); - l_offset = (uint8_t *)l_pVendorInfo - (uint8_t *)l_pMvBuffer; - - if (l_mvBufsize < l_offset ) - { - FAPI_ERR("getMBvpdSupplierData:" - " less MV keyword returned than expected %d < %d", - l_mvBufsize, l_offset); - const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_MV; - const uint32_t & RETURNED_SIZE = l_mvBufsize; - const fapi::Target & CHIP_TARGET = i_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INSUFFICIENT_VPD_RETURNED ); - break; // break out with fapirc - } - - // look for matching module ID - for (uint32_t l_count=0;l_count < l_pMvBuffer->numEntries;l_count++) - { - // shouldn't run past end of buffer, checking to be sure - if (l_offset + sizeof (mv_vendorInfo) > l_mvBufsize) - { - break; - } - - FAPI_DBG("getMBvpdSupplierData: cnt=%d this supplier ID= 0x%08x ", - l_count, - l_pVendorInfo->supplierID_LSB+(l_pVendorInfo->supplierID_MSB<<8)); - - if ((l_pVendorInfo->supplierID_LSB == l_moduleID_LSB ) && - (l_pVendorInfo->supplierID_MSB == l_moduleID_MSB )) - { - l_found = true; - break; - } - l_offset += sizeof (mv_vendorInfo); - l_pVendorInfo++; - } - - // If not found, see if first supplier should be used - // and there is one (unlikely that there is not one). - if ( ! l_found && - 0 < l_pMvBuffer->numEntries && - sizeof (mv_keyword) <= l_mvBufsize) - { - uint8_t l_checkUseFirstSupplier = 0; - l_fapirc = FAPI_ATTR_GET( - ATTR_CENTAUR_EC_USE_FIRST_SUPPLIER_FOR_INVALID_MODULE_ID, - &i_mbTarget, - l_checkUseFirstSupplier); - if (l_fapirc) - { - FAPI_ERR("getMBvpdSupplierData:" - " get attr use first supplier failed"); - break; // break out with fapirc - } - FAPI_DBG("getMBvpdSupplierData: attr use first supplier = 0x%02x", - l_checkUseFirstSupplier); - if ( l_checkUseFirstSupplier) - { - l_pVendorInfo = &(l_pMvBuffer->firstVendorInfo); - l_found = true; - } - } - - // Return requested value if found - if ( l_found ) - { - switch (i_attr) - { - case SUPPLIER_POWER_SLOPE: //get each byte to perserve endian - o_val = l_pVendorInfo->supplierPowerSlope_LSB; - o_val |= (l_pVendorInfo->supplierPowerSlope_MSB << 8); - break; - case SUPPLIER_POWER_INTERCEPT: //get each byte to perserve endian - o_val = l_pVendorInfo->supplierPowerIntercept_LSB; - o_val |= (l_pVendorInfo->supplierPowerIntercept_MSB << 8); - break; - case SUPPLIER_TOTAL_POWER_SLOPE: //get each byte to perserve endian - o_val = l_pVendorInfo->supplierTotalPowerSlope_LSB; - o_val |= (l_pVendorInfo->supplierTotalPowerSlope_MSB << 8); - break; - case SUPPLIER_TOTAL_POWER_INTERCEPT: //get each byte to perserve endian - o_val = l_pVendorInfo->supplierTotalPowerIntercept_LSB; - o_val |= (l_pVendorInfo->supplierTotalPowerIntercept_MSB << 8); - break; - - default: //i_attr value was checked already so should not get here - break; - } - } - else - { - FAPI_ERR("getMBvpdSupplierData:" - " supplier ID not found 0x%04x", - l_moduleID_LSB+(l_moduleID_MSB<<8)); - const uint32_t & MODULE_ID = l_moduleID_LSB+(l_moduleID_MSB<<8); - const fapi::Target & MEMBUF_TARGET = i_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_SUPPLIER_ID_NOT_IN_MV_VPD ); - } - - } while (0); - - delete l_pPdIBuffer; - l_pPdIBuffer = NULL; - delete l_pMvBuffer; - l_pMvBuffer = NULL; - - FAPI_DBG("getMBvpdSupplierData: exit rc=0x%08x", - static_cast<uint32_t>(l_fapirc)); - - return l_fapirc; -} - - -} // extern "C" diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.C deleted file mode 100644 index 3e05baffc..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.C +++ /dev/null @@ -1,189 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* 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. */ -/* 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 */ -// $Id: getMBvpdSpareDramData.C,v 1.7 2014/10/23 21:00:12 eliner Exp $ -#include <stdint.h> - -// fapi support -#include <fapi.H> -#include <dimmConsts.H> -#include <getMBvpdSpareDramData.H> - -extern "C" -{ -using namespace fapi; - -fapi::ReturnCode getMBvpdSpareDramData(const fapi::Target &i_mba, - uint8_t (&o_data)[DIMM_DQ_MAX_MBA_PORTS] - [DIMM_DQ_MAX_MBAPORT_DIMMS] - [DIMM_DQ_MAX_DIMM_RANKS]) -{ - // AM keyword layout - const uint8_t NUM_MBAS = 2; // Two MBAs per Centaur - const uint8_t NUM_MIRR_BYTES = 4; // Size of address mirror data - - // Struct for AM Keyword buffer - // Contains a 1D array for the address mirror data and - // a 2D array for the spare DRAM data. - struct MirrorData - { - uint8_t iv_mirrorData[NUM_MIRR_BYTES]; - }; - struct DimmSpareData - { - // This contains information for all ranks and is returned in o_data - uint8_t iv_dimmSpareData; - }; - struct PortSpareData - { - DimmSpareData iv_dimmSpareData[DIMM_DQ_MAX_MBAPORT_DIMMS]; - }; - struct MbaSpareData - { - PortSpareData iv_portSpareData[DIMM_DQ_MAX_MBA_PORTS]; - }; - struct AmKeyword - { - MirrorData mirrorData; - MbaSpareData iv_mbaSpareData[NUM_MBAS]; - }; - - // AM keyword size - const uint32_t AM_KEYWORD_SIZE = sizeof(AmKeyword); - fapi::ReturnCode l_rc; - // Centaur memory buffer target - fapi::Target l_mbTarget; - // MBvpd AM keyword buffer - AmKeyword * l_pAmBuffer = NULL; - uint32_t l_AmBufSize = sizeof(AmKeyword); - - do - { - uint8_t l_customDimm = 0; - - l_rc = FAPI_ATTR_GET(ATTR_EFF_CUSTOM_DIMM,&i_mba,l_customDimm); - if(l_rc) - { - FAPI_ERR("getMBvpdSpareDramData: Read of Custom Dimm failed"); - break; - } - - //if custom_dimm = 0, use isdimm - if(fapi::ENUM_ATTR_EFF_CUSTOM_DIMM_NO == l_customDimm) - { - //ISDIMMs do not have any spare drams, - //return 0 for all ports and ranks. - for (uint8_t i = 0; i < DIMM_DQ_MAX_MBA_PORTS; i++) - { - for (uint8_t j = 0; j < DIMM_DQ_MAX_MBAPORT_DIMMS; j++) - { - for (uint8_t k = 0; k < DIMM_DQ_MAX_DIMM_RANKS; k++) - { - o_data[i][j][k] = 0; - } - } - } - //if custom_dimm = 1, use cdimm - }else - { - // find the Centaur memory buffer from the passed MBA - l_rc = fapiGetParentChip (i_mba, l_mbTarget); - if (l_rc) - { - FAPI_ERR("getMBvpdSpareDramData: Finding the parent mb failed "); - break; - } - - // Read AM keyword field - l_pAmBuffer = new AmKeyword(); - l_rc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD, - fapi::MBVPD_KEYWORD_AM, - l_mbTarget, - reinterpret_cast<uint8_t *>(l_pAmBuffer), - l_AmBufSize); - if (l_rc) - { - FAPI_ERR("getMBvpdSpareDramData: " - "Read of AM Keyword failed"); - break; - } - - // Check for error or incorrect amount of data returned - if (l_AmBufSize < AM_KEYWORD_SIZE) - { - FAPI_ERR("getMBvpdSpareDramData:" - " less AM keyword returned than expected %d < %d", - l_AmBufSize, AM_KEYWORD_SIZE); - const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_AM; - const uint32_t & RETURNED_SIZE = l_AmBufSize; - const fapi::Target & CHIP_TARGET = l_mbTarget; - FAPI_SET_HWP_ERROR(l_rc, RC_MBVPD_INSUFFICIENT_VPD_RETURNED ); - break; - } - - // Find the position of the passed mba on the centuar - uint8_t l_mba = 0; - l_rc = FAPI_ATTR_GET(ATTR_CHIP_UNIT_POS, &i_mba, l_mba); - - if (l_rc) - { - FAPI_ERR("getMBvpdSpareDramData: Get MBA position failed "); - break; - } - // Data in the AM Keyword contains information for both MBAs and - // is stored in [mba][port][dimm] ([2][2][2]) format, where the - // third (dimm) dimension contains a byte where each two bits of - // that byte are the spare status for a particular rank. - // The caller expects data returned for a particular MBA, - // and where the ranks for each dimm are separately indexed, - // so conversion to a [port][dimm][rank] ([2][2][4]) format - // is necessary. - for (uint8_t i = 0; i < DIMM_DQ_MAX_MBA_PORTS; i++) - { - for (uint8_t j = 0; j < DIMM_DQ_MAX_MBAPORT_DIMMS; j++) - { - // Mask to pull of two bits at a time from iv_dimmSpareData - uint8_t l_dimmMask = 0xC0; - // Shift amount decrements each time as l_dimmMask - // is shifted to the right - uint8_t l_rankBitShift = 6; - for (uint8_t k = 0; k < DIMM_DQ_MAX_DIMM_RANKS; k++) - { - o_data[i][j][k] =((l_pAmBuffer->iv_mbaSpareData[l_mba]. - iv_portSpareData[i].iv_dimmSpareData[j]. - iv_dimmSpareData & l_dimmMask) >> - l_rankBitShift); - l_dimmMask >>= 2; - l_rankBitShift -= 2; - } - } - } - } - }while(0); - delete l_pAmBuffer; - l_pAmBuffer = NULL; - return l_rc; -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdVersion.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdVersion.C deleted file mode 100644 index fda938c95..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdVersion.C +++ /dev/null @@ -1,105 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMBvpdVersion.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2013,2015 */ -/* [+] 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 */ -// $Id: getMBvpdVersion.C,v 1.3 2015/02/24 19:23:56 whs Exp $ -/** - * @file getMBvpdVersion.C - * - * @brief get the vpd version from MBvpd record VINI keyword VZ - * - */ - -#include <stdint.h> - -// fapi support -#include <fapi.H> -#include <fapiUtil.H> -#include <getMBvpdVersion.H> - -extern "C" -{ -using namespace fapi; - -fapi::ReturnCode getMBvpdVersion( - const fapi::Target &i_mbaTarget, - uint32_t & o_val) -{ - fapi::ReturnCode l_fapirc; - fapi::Target l_mbTarget; - uint16_t l_vpdVersion = 0; - uint32_t l_bufSize = sizeof(l_vpdVersion); - - FAPI_DBG("getMBvpdVersion: entry "); - - do { - // find the Centaur memory buffer from the passed MBA - l_fapirc = fapiGetParentChip (i_mbaTarget,l_mbTarget); - if (l_fapirc) - { - FAPI_ERR("getMBvpdVersion: Finding the parent mb failed "); - break; // break out with fapirc - } - FAPI_DBG("getMBvpdVersion: parent path=%s ", - l_mbTarget.toEcmdString() ); - - // get vpd version from record VINI keyword VZ - l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VINI, - fapi::MBVPD_KEYWORD_VZ, - l_mbTarget, - reinterpret_cast<uint8_t *>(&l_vpdVersion), - l_bufSize); - if (l_fapirc) - { - FAPI_ERR("getMBvpdVersion: Read of VZ keyword failed"); - break; // break out with fapirc - } - - // Check that sufficient size was returned. - if (l_bufSize < sizeof(l_vpdVersion) ) - { - FAPI_ERR("getMBvpdVersion:" - " less keyword data returned than expected %d < %d", - l_bufSize, sizeof(l_vpdVersion)); - const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_VZ; - const uint32_t & RETURNED_SIZE = l_bufSize; - const fapi::Target & CHIP_TARGET = l_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc,RC_MBVPD_INSUFFICIENT_VPD_RETURNED); - break; // break out with fapirc - } - // return value - o_val = static_cast<uint32_t>(FAPI_BE16TOH(l_vpdVersion)); - - FAPI_DBG("getMBvpdVersion: vpd version=0x%08x", - o_val); - - - } while (0); - - FAPI_DBG("getMBvpdVersion: exit rc=0x%08x)", - static_cast<uint32_t>(l_fapirc)); - - return l_fapirc; -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdVoltageSettingData.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdVoltageSettingData.C deleted file mode 100644 index 3985a403b..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdVoltageSettingData.C +++ /dev/null @@ -1,154 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMBvpdVoltageSettingData.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2015 */ -/* [+] 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 */ -// $Id: getMBvpdVoltageSettingData.C,v 1.2 2015/09/29 20:55:55 janssens Exp $ -/** - * @file getMBvpdVoltageSettingData.C - * - * @brief get the Voltage Setting Data from DW keyword of MBVPD SPDX record - * * - */ - -#include <stdint.h> - -// fapi support -#include <fapi.H> -#include <fapiUtil.H> -#include <getMBvpdVoltageSettingData.H> -#include <fapiSystemConfig.H> -#include <getMBvpdAttr.H> - -extern "C" -{ -using namespace fapi; -using namespace getAttrData; - -fapi::ReturnCode getMBvpdVoltageSettingData(const fapi::Target &i_mbTarget, - uint32_t & o_val) -{ - fapi::ReturnCode l_fapirc; - DimmType l_dimmType = ISDIMM; - fapi::MBvpdRecord l_record = fapi::MBVPD_RECORD_SPDX; - uint16_t l_vpdVoltageSettingData = DW_KEYWORD_DEFAULT_VALUE; - uint32_t l_bufSize = sizeof(l_vpdVoltageSettingData); - - FAPI_DBG("getMBvpdVoltageSettingData: entry "); - - do { - - FAPI_DBG("getMBvpdVoltageSettingData: Membuff path=%s ", - i_mbTarget.toEcmdString() ); - - // Find the dimm type - // Determine if ISDIMM or CDIMM - - // Find one mba target for passing it to fapiGetAssociatedDimms - std::vector<fapi::Target> l_mba_chiplets; - l_fapirc = fapiGetChildChiplets( i_mbTarget , - fapi::TARGET_TYPE_MBA_CHIPLET, l_mba_chiplets ); - if((l_fapirc) || (l_mba_chiplets.size() == 0)) - { - FAPI_ERR("getMBvpdVoltageSettingData: Problem getting MBA's of Membuff"); - break; //return error - } - - std::vector<fapi::Target> l_target_dimm_array; - l_fapirc = fapiGetAssociatedDimms(l_mba_chiplets[0], l_target_dimm_array); - if(l_fapirc) - { - FAPI_ERR("getMBvpdVoltageSettingData: Problem getting DIMMs of Membuf"); - break; //return error - } - if(l_target_dimm_array.size() != 0) - { - uint8_t l_customDimm=0; - l_fapirc = FAPI_ATTR_GET(ATTR_SPD_CUSTOM,&l_target_dimm_array[0], - l_customDimm); - if(l_fapirc) { - FAPI_ERR("getMBvpdVoltageSettingData: ATTR_SPD_CUSTOM failed "); - break; //return error - } - - if (l_customDimm == fapi::ENUM_ATTR_SPD_CUSTOM_YES) - { - l_dimmType = CDIMM; - FAPI_DBG("getMBvpdVoltageSettingData: CDIMM TYPE!!!"); - } - else - { - l_dimmType = ISDIMM; - FAPI_DBG("getMBvpdVoltageSettingData: ISDIMM TYPE!!!"); - } - } - else - { - l_dimmType = ISDIMM; - FAPI_DBG("getMBvpdVoltageSettingData: ISDIMM TYPE (dimm array size = 0)"); - } - - - if(l_dimmType == CDIMM) - { - l_record = fapi::MBVPD_RECORD_VSPD; - } - // get voltage setting data from record SPDX keyword DW - l_fapirc = fapiGetMBvpdField(l_record, - fapi::MBVPD_KEYWORD_DW, - i_mbTarget, - reinterpret_cast<uint8_t *>(&l_vpdVoltageSettingData), - l_bufSize); - if (l_fapirc) - { - FAPI_ERR("getMBvpdVersion: Read of DW keyword failed"); - break; // break out with fapirc - } - - // Check that sufficient size was returned. - if (l_bufSize < sizeof(l_vpdVoltageSettingData) ) - { - FAPI_ERR("getMBvpdVoltageSettingData:" - " less keyword data returned than expected %d < %d", - l_bufSize, sizeof(l_vpdVoltageSettingData)); - const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_DW; - const uint32_t & RETURNED_SIZE = l_bufSize; - const fapi::Target & CHIP_TARGET = i_mbTarget; - FAPI_SET_HWP_ERROR(l_fapirc,RC_MBVPD_INSUFFICIENT_VPD_RETURNED); - break; // break out with fapirc - } - // return value - o_val = static_cast<uint32_t>(FAPI_BE16TOH(l_vpdVoltageSettingData)); - - FAPI_DBG("getMBvpdVoltageSettingData: voltage setting Data=0x%08x", - o_val); - - - } while (0); - - FAPI_DBG("getMBvpdVoltageSettingData: exit rc=0x%08x)", - static_cast<uint32_t>(l_fapirc)); - - return l_fapirc; -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMvpdExL2SingleMemberEnable.C b/src/usr/hwpf/hwp/mvpd_accessors/getMvpdExL2SingleMemberEnable.C deleted file mode 100644 index 790731ec2..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMvpdExL2SingleMemberEnable.C +++ /dev/null @@ -1,124 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMvpdExL2SingleMemberEnable.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ -/* */ -/* 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 */ -// $Id: getMvpdExL2SingleMemberEnable.C,v 1.1 2013/04/10 22:02:33 mjjones Exp $ -/** - * @file getMvpdExL2SingleMemberEnable.C - * - * @brief MVPD Accessor for providing the ATTR_EX_L2_SINGLE_MEMBER_ENABLE - * attribute - */ - -/* - * Change Log ****************************************************************** - * Flag Defect/Feature User Date Description - * ------ -------------- ---------- ----------- ---------------------------- - * mjjones 04/10/2013 Created. - */ - -#include <getMvpdExL2SingleMemberEnable.H> - -extern "C" -{ - -fapi::ReturnCode getMvpdExL2SingleMemberEnable( - const fapi::Target & i_procTarget, - uint32_t & o_val) -{ - /** - * @brief Structure of the LWP4 record, IN keyword MVPD field - * for the retrieval of the Single Member Enable data - * - * This could move to a common header file if multiple VPD Accessors need - * to get data from the LWP4 record, IN keyword MVPD field - */ - struct MVPD_LWP4_IN - { - uint8_t iv_reserved0; - uint8_t iv_reserved1; - uint8_t iv_singleMemberEnable0_7; - uint8_t iv_singleMemberEnable8_15; - }; - - fapi::ReturnCode l_rc; - uint8_t * l_pField = NULL; - uint32_t l_fieldSize = 0; - - FAPI_INF("getMvpdExL2SingleMemberEnable: entry"); - - // Call fapiGetMvpdField with a NULL pointer to get the field size - l_rc = fapiGetMvpdField(fapi::MVPD_RECORD_LWP4, - fapi::MVPD_KEYWORD_IN, - i_procTarget, - l_pField, - l_fieldSize); - - if (l_rc) - { - FAPI_ERR("getMvpdExL2SingleMemberEnable: Error getting MVPD field size"); - } - else - { - if (l_fieldSize < sizeof(MVPD_LWP4_IN)) - { - FAPI_ERR("getMvpdExL2SingleMemberEnable: MVPD field too small (%d)", - l_fieldSize); - uint32_t & FIELD_SIZE = l_fieldSize; - FAPI_SET_HWP_ERROR(l_rc, - RC_MVPD_EX_L2_SINGLE_MEMBER_ENABLE_BAD_FIELD_SIZE); - } - else - { - // Allocate memory and call fapiGetMvpdField to get the field - l_pField = new uint8_t[l_fieldSize]; - - l_rc = fapiGetMvpdField(fapi::MVPD_RECORD_LWP4, - fapi::MVPD_KEYWORD_IN, - i_procTarget, - l_pField, - l_fieldSize); - - if (l_rc) - { - FAPI_ERR( - "getMvpdExL2SingleMemberEnable: Error getting MVPD field"); - } - else - { - MVPD_LWP4_IN * l_pData = - reinterpret_cast<MVPD_LWP4_IN *>(l_pField); - - o_val = l_pData->iv_singleMemberEnable0_7; - o_val <<= 8; - o_val += l_pData->iv_singleMemberEnable8_15; - - FAPI_INF("getMvpdExL2SingleMemberEnable: 0x%08x", o_val); - } - - delete [] l_pField; - } - } - - return l_rc; -} - -} diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMvpdRing.C b/src/usr/hwpf/hwp/mvpd_accessors/getMvpdRing.C deleted file mode 100644 index c3ccbdc1d..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMvpdRing.C +++ /dev/null @@ -1,76 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMvpdRing.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2012,2014 */ -/* */ -/* 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 */ -// $Id: getMvpdRing.C,v 1.1 2012/07/19 22:00:40 mjjones Exp $ -/** - * @file getMvpdRing.C - * - * @brief fetch repair rings from MVPD records - * - */ - -#include <stdint.h> - -// fapi support -#include <fapi.H> - -#include <getMvpdRing.H> -#include <mvpdRingFuncs.H> - -extern "C" -{ -using namespace fapi; - -// getMvpdRing: Wrapper to call common function mvpdRingFunc -fapi::ReturnCode getMvpdRing( fapi::MvpdRecord i_record, - fapi::MvpdKeyword i_keyword, - const fapi::Target &i_fapiTarget, - const uint8_t i_chipletId, - const uint8_t i_ringId, - uint8_t *i_pRingBuf, - uint32_t &io_rRingBufsize) -{ - fapi::ReturnCode l_fapirc; - - FAPI_DBG("getMvpdRing: entry ringId=0x%x, chipletId=0x%x, size=0x%x ", - i_ringId, - i_chipletId, - io_rRingBufsize ); - - // common get and set processing - l_fapirc = mvpdRingFunc(MVPD_RING_GET, - i_record, - i_keyword, - i_fapiTarget, - i_chipletId, - i_ringId, - i_pRingBuf, - io_rRingBufsize); - - - FAPI_DBG("getMvpdRing: exit rc=0x%x", - static_cast<uint32_t>(l_fapirc) ); - - return l_fapirc; -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMvpdRing.H b/src/usr/hwpf/hwp/mvpd_accessors/getMvpdRing.H deleted file mode 100644 index e89a9f051..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/getMvpdRing.H +++ /dev/null @@ -1,94 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMvpdRing.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2012,2014 */ -/* */ -/* 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 */ -// $Id: RepairRingFunc.H,v 1.1 2012/07/19 22:00:38 mjjones Exp $ -/** - * @file getMvpdRing.H - * - * @brief Prototype for getMvpdRing() - - * get a repair ring from a MVPD record - */ - - #ifndef _HWP_GETMVPDRING_ - #define _HWP_GETMVPDRING_ - - #include <fapi.H> - -// function pointer typedef definition for HWP call support -typedef fapi::ReturnCode (*getMvpdRing_FP_t) - (fapi::MvpdRecord,fapi::MvpdKeyword,const fapi::Target &, - const uint8_t, const uint8_t, uint8_t *, uint32_t &); - - -extern "C" -{ -/** - * @brief get specified ring from MVPD for the specified target CPU. - * - * A Ring Id Chiplet Id should be unique in the mvpd Record. - * The code does not validate. No assumption should be made on which would - * be returned if there are multiple. - * - * @param i_record - Record enumerator - * @param i_keyword - Keyword enumerator - * Supported Rings are: - * MVPD_RECORD_CP00 - MVPD_KEYWORD_PDR - * MVPD_RECORD_CP00 - MVPD_KEYWORD_PDG - * @param i_fapiTarget - cpu target - * @param i_chipletId - Chiplet ID - * @param i_ringId - Ring ID - * @param i_pRingBuf - pointer to a buffer allocated by the caller - * to receive the ring header and data. - * if NULL, the size of the min buffer required - * buffer will be returned in io_rRingBufsize - * with rc FAPI_RC_SUCCESS. - * @param io_rRingBufsize - in: size of ring buffer that caller has - * allocated - * out: number of BYTES that were copied to the - * output buffer. - * If the ring was not found, an error - * will be returned and this will be 0. - * If the output buffer is not big enough, - * an error will be returned and this will - * be the minimum size required. - * The buffer contains the CompressedScanData - * structure followed by compressed data. The - * caller does compression and decompression. - * Buffer: io_rRingBufsize returns xNN. - * byte x0 CompressedScanData structure (rs4 header) - * byte x18 compressed data (sizeof CompressedScanData is 0x18) - * byte xNN last byte of compressed data - * - * @return fapi::ReturnCode - FAPI_RC_SUCCESS if success, - * relevant error code for failure. - */ -fapi::ReturnCode getMvpdRing( fapi::MvpdRecord i_record, - fapi::MvpdKeyword i_keyword, - const fapi::Target &i_fapiTarget, - const uint8_t i_chipletId, - const uint8_t i_ringId, - uint8_t *io_pRingBuf, - uint32_t &io_rRingBufsize ); - -} - -#endif diff --git a/src/usr/hwpf/hwp/mvpd_accessors/makefile b/src/usr/hwpf/hwp/mvpd_accessors/makefile deleted file mode 100644 index 34bb8da52..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/makefile +++ /dev/null @@ -1,29 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/hwpf/hwp/mvpd_accessors/makefile $ -# -# OpenPOWER HostBoot Project -# -# Contributors Listed Below - COPYRIGHT 2015 -# [+] 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 -ROOTPATH = ../../../../.. - -SUBDIRS += compressionTool.d - -include ${ROOTPATH}/config.mk diff --git a/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk b/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk deleted file mode 100644 index e90063cc6..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk +++ /dev/null @@ -1,55 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk $ -# -# OpenPOWER HostBoot Project -# -# Contributors Listed Below - COPYRIGHT 2012,2015 -# [+] 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 -CFLAGS += -DDQCOMPRESSION_TEST=1 - -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/mvpd_accessors -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp/mvpd_accessors - -VPATH += ${HWPPATH}/mvpd_accessors -VPATH += ${HWPPATH}/mvpd_accessors/compressionTool -OBJS += getMvpdRing.o -OBJS += getMBvpdRing.o -OBJS += setMvpdRing.o -OBJS += mvpdRingFuncs.o -OBJS += getMvpdExL2SingleMemberEnable.o -OBJS += getMBvpdAddrMirrorData.o -OBJS += getMBvpdSlopeInterceptData.o -OBJS += getMBvpdSpareDramData.o -OBJS += getMBvpdVersion.o -OBJS += getMBvpdMemoryDataVersion.o -OBJS += getMBvpdSPDXRecordVersion.o -OBJS += getMBvpdVoltageSettingData.o -OBJS += getMBvpdDram2NModeEnabled.o -OBJS += getMBvpdSensorMap.o -OBJS += getControlCapableData.o -OBJS += accessMBvpdL4BankDelete.o -OBJS += getDecompressedISDIMMAttrs.o -OBJS += getDQAttrISDIMM.o -OBJS += getDQSAttrISDIMM.o -OBJS += getISDIMMTOC4DAttrs.o -OBJS += DQCompressionLib.o -OBJS += getMBvpdAttr.o -OBJS += getMBvpdAttrData.o - diff --git a/src/usr/hwpf/hwp/mvpd_accessors/mvpdRingFuncs.C b/src/usr/hwpf/hwp/mvpd_accessors/mvpdRingFuncs.C deleted file mode 100644 index 3a532a1dc..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/mvpdRingFuncs.C +++ /dev/null @@ -1,831 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/mvpdRingFuncs.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ -/* [+] 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 */ -// $Id: mvpdRingFuncs.C,v 1.12 2014/07/16 19:06:49 cswenson Exp $ -/** - * @file mvpdRingFuncs.C - * - * @brief common routines - * - */ - -#include <stdint.h> - -// fapi support -#include <fapi.H> -#include <fapiUtil.H> -#include <mvpdRingFuncs.H> - -// pull in CompressedScanData def from proc_slw_build HWP -#include <p8_scan_compression.H> - -extern "C" -{ -using namespace fapi; - -// functions internal to this file -// these functions are common for both mvpdRingFunc and mbvpdRingFunc -fapi::ReturnCode mvpdValidateRingHeader( CompressedScanData * i_pRing, - uint8_t i_chipletId, - uint8_t i_ringId, - uint32_t i_ringBufsize); - -fapi::ReturnCode mvpdRingFuncFind( const uint8_t i_chipletId, - const uint8_t i_ringId, - uint8_t * i_pRecordBuf, - uint32_t i_recordBufLen, - uint8_t * &o_rRingBuf, - uint32_t &o_rRingBufsize); - -fapi::ReturnCode mvpdRingFuncGet ( uint8_t *i_pRing, - uint32_t i_ringLen, - uint8_t *i_pCallerRingBuf, - uint32_t &io_rCallerRingBufLen); - -fapi::ReturnCode mvpdRingFuncSet ( uint8_t *i_pRecordBuf, - uint32_t i_recordLen, - uint8_t *i_pRing, - uint32_t i_ringLen, - uint8_t *i_pCallerRingBuf, - uint32_t i_callerRingBufLen); - -//****************************************************************************** -// mvpdValidateRecordKeyword & mbvpdValidateRecordKeyword -// Check for supported combinations of Record and Keyword. -// The record needs to contain rings of RS4 header (CompressedScanData) format -// note: "getting" data not in RS4 header format would likely just fail to find -// the ring harmlessly. "Setting" data could make a mess looking for the end -// to append a new ring. The result could be invalid vpd. -// note: place first in the file to make finding the supported list easier. -//****************************************************************************** -fapi::ReturnCode mvpdValidateRecordKeyword( fapi::MvpdRecord i_record, - fapi::MvpdKeyword i_keyword) -{ - // add record/keywords with rings with RS4 header here. - struct _supportedRecordKeywords { - fapi::MvpdRecord record; - fapi::MvpdKeyword keyword; - } supportedRecordKeywords [] = { - { MVPD_RECORD_CP00, MVPD_KEYWORD_PDR }, - { MVPD_RECORD_CP00, MVPD_KEYWORD_PDG }, - }; - fapi::ReturnCode l_fapirc; - bool l_validPair = false; - const uint32_t numPairs = - sizeof(supportedRecordKeywords)/sizeof(supportedRecordKeywords[0]); - - for (uint32_t curPair = 0; curPair < numPairs; curPair++ ) - { - if (supportedRecordKeywords[curPair].record == i_record && - supportedRecordKeywords[curPair].keyword == i_keyword) - { - l_validPair = true; - break; - } - } - if ( !l_validPair ) { - FAPI_SET_HWP_ERROR(l_fapirc, RC_MVPD_RING_FUNC_INVALID_PARAMETER ); - } - return l_fapirc; - -}; - - -#ifndef FAPI_NO_MBVPD -fapi::ReturnCode mbvpdValidateRecordKeyword(fapi::MBvpdRecord i_record, - fapi::MBvpdKeyword i_keyword) -{ - // add record/keywords with rings with RS4 header here. - struct _supportedRecordKeywords { - fapi::MBvpdRecord record; - fapi::MBvpdKeyword keyword; - } supportedRecordKeywords [] = { - { MBVPD_RECORD_VSPD, MBVPD_KEYWORD_PDD }, - }; - - fapi::ReturnCode l_fapirc; - bool l_validPair = false; - - const uint32_t numPairs = - sizeof(supportedRecordKeywords)/sizeof(supportedRecordKeywords[0]); - - for (uint32_t curPair = 0; curPair < numPairs; curPair++ ) - { - if (supportedRecordKeywords[curPair].record == i_record && - supportedRecordKeywords[curPair].keyword == i_keyword) - { - l_validPair = true; - break; - } - } - if (!l_validPair) - { - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_RING_FUNC_INVALID_PARAMETER ); - } - return l_fapirc; - -}; -#endif - - -//****************************************************************************** -// mvpdRingFunc: the getMvpdRing and setMvpdRing wrappers call this function -// to do all the processing. -// note: io_rRingBufsize is only 'output' for get. -//****************************************************************************** -fapi::ReturnCode mvpdRingFunc( const mvpdRingFuncOp i_mvpdRingFuncOp, - fapi::MvpdRecord i_record, - fapi::MvpdKeyword i_keyword, - const fapi::Target &i_fapiTarget, - const uint8_t i_chipletId, - const uint8_t i_ringId, - uint8_t *i_pRingBuf, - uint32_t &io_rRingBufsize) -{ - fapi::ReturnCode l_fapirc; - uint32_t l_recordLen = 0; - uint8_t *l_recordBuf = NULL; - uint8_t *l_pRing = NULL; - uint32_t l_ringLen = 0; - - FAPI_DBG("mvpdRingFunc:entry op=0x%x ringId=0x%x chipletId=0x%x size=0x%x ", - i_mvpdRingFuncOp, - i_ringId, - i_chipletId, - io_rRingBufsize ); - - do { - // do common get and set input parameter error checks - // check for supported combination of Record and Keyword - l_fapirc = mvpdValidateRecordKeyword( i_record, - i_keyword); - if ( l_fapirc ) - { - FAPI_ERR(" mvpdRingFunc: unsupported record keyword pair "); - - // break out with fapirc - break; - } - - // do set specific input parameter checks - if (i_mvpdRingFuncOp == MVPD_RING_SET ) - { - // passing NULL pointer to receive needed size is only for get. - if (i_pRingBuf == NULL ) - { - FAPI_SET_HWP_ERROR(l_fapirc, - RC_MVPD_RING_FUNC_INVALID_PARAMETER ); - // break out with fapirc - break; - } - - // Validate ring header to protect vpd - l_fapirc = mvpdValidateRingHeader( - reinterpret_cast<CompressedScanData *>(i_pRingBuf), - i_chipletId, - i_ringId, - io_rRingBufsize); - if ( l_fapirc ) - { - FAPI_ERR(" mvpdRingFunc: invalid ring header "); - // break out with fapirc - break; - } - - } - - // call fapiGetMvpdField once with a NULL pointer to get the buffer - // size no error should be returned. - l_fapirc = fapiGetMvpdField( i_record, - i_keyword, - i_fapiTarget, - NULL, - l_recordLen ); - if ( l_fapirc ) - { - FAPI_ERR("mvpdRingFunc:fapiGetMvpdField failed to get buffer size"); - - // break out with fapirc - break; - } - - FAPI_DBG( "mvpdRingFunc: fapiGetMvpdField returned record len=0x%x", - l_recordLen ); - - // allocate buffer for the record. Always works - l_recordBuf = static_cast<uint8_t*>(fapiMalloc((size_t)l_recordLen)); - - // load ring from MVPD for this target - l_fapirc = fapiGetMvpdField( i_record, - i_keyword, - i_fapiTarget, - l_recordBuf, - l_recordLen ); - if ( l_fapirc ) - { - FAPI_ERR("mvpdRingFunc: fapiGetMvpdField failed rc=0x%x", - static_cast<uint32_t>(l_fapirc)); - // break out with fapirc - break; - } - - // find ring in the record. It is an error if not there for a "get". - // Its ok if not there for a "set". The ring will be added. - // l_ringLen set to 0 if not there with l_pRing at the start of padding. - l_fapirc = mvpdRingFuncFind (i_chipletId, - i_ringId, - l_recordBuf, - l_recordLen, - l_pRing, - l_ringLen); - if ( l_fapirc ) - { - FAPI_ERR("mvpdRingFunc: mvpdRingFuncFind failed rc=0x%x", - static_cast<uint32_t>(l_fapirc)); - // break out with fapirc - break; - } - // do the get or set specific operations - if (i_mvpdRingFuncOp == MVPD_RING_GET ) // do the get operation - { - // ensure ring was found. Must be there for "get" - if (l_ringLen == 0) //not found - { - const uint8_t & RING_MODIFIER = i_ringId; - const uint8_t & CHIPLET_ID = i_chipletId; - const fapi::Target & CHIP_TARGET = i_fapiTarget; - FAPI_SET_HWP_ERROR(l_fapirc, RC_REPAIR_RING_NOT_FOUND ); - // break out with fapirc - break; - } - - // copy ring back to caller's buffer - l_fapirc = mvpdRingFuncGet ( l_pRing, - l_ringLen, - i_pRingBuf, - io_rRingBufsize); - if ( l_fapirc ) - { - FAPI_ERR("mvpdRingFunc: mvpdRingFuncGet failed rc=0x%x", - static_cast<uint32_t>(l_fapirc)); - // break out with fapirc - break; - } - - } else { // set operation - - // update record with caller's ring - l_fapirc = mvpdRingFuncSet ( l_recordBuf, - l_recordLen, - l_pRing, - l_ringLen, - i_pRingBuf, - io_rRingBufsize); - if ( l_fapirc ) - { - FAPI_ERR("mvpdRingFunc: mvpdRingFuncSet failed rc=0x%x", - static_cast<uint32_t>(l_fapirc)); - // break out with fapirc - break; - } - // update record back to the mvpd - l_fapirc = fapiSetMvpdField(i_record, - i_keyword, - i_fapiTarget, - l_recordBuf, - l_recordLen ); - if ( l_fapirc ) - { - FAPI_ERR("mvpdRingFunc: fapiSetMvpdField failed"); - - io_rRingBufsize = 0; - // break out with fapirc - break; - } - } - - - } while ( 0 ); - - // unload the repair ring - fapiFree((void*)l_recordBuf); - l_recordBuf = NULL; - - FAPI_DBG( "mvpdRingFunc: exit bufsize= 0x%x rc= 0x%x", - io_rRingBufsize, - static_cast<uint32_t>(l_fapirc) ); - return l_fapirc; -} - - -#ifndef FAPI_NO_MBVPD -//****************************************************************************** -// mbvpdRingFunc: getMBvpdRing calls this function to get repair ring -// note: io_rRingBufsize is only 'output' for get. -//****************************************************************************** -fapi::ReturnCode mbvpdRingFunc( const mbvpdRingFuncOp i_mbvpdRingFuncOp, - fapi::MBvpdRecord i_record, - fapi::MBvpdKeyword i_keyword, - const fapi::Target &i_fapiTarget, - const uint8_t i_chipletId, - const uint8_t i_ringId, - uint8_t *i_pRingBuf, - uint32_t &io_rRingBufsize) -{ - fapi::ReturnCode l_fapirc; - uint32_t l_recordLen = 0; - uint8_t *l_recordBuf = NULL; - uint8_t *l_pRing = NULL; - uint32_t l_ringLen = 0; - - FAPI_DBG("mbvpdRingFunc:entry op=0x%x ringId=0x%x chipletId=0x%x size=0x%x ", - i_mbvpdRingFuncOp, i_ringId, i_chipletId, io_rRingBufsize ); - - do { - // do input parameter error checks - // check for supported combination of Record and Keyword - l_fapirc = mbvpdValidateRecordKeyword( i_record, i_keyword); - - if (l_fapirc) - { - FAPI_ERR(" mbvpdRingFunc: unsupported record keyword pair "); - // break out with fapirc - break; - } - - // call fapiGetMBvpdField once with a NULL pointer to get the buffer - // size no error should be returned. - l_fapirc = fapiGetMBvpdField( i_record, - i_keyword, - i_fapiTarget, - NULL, - l_recordLen ); - if (l_fapirc) - { - FAPI_ERR("mbvpdRingFunc:fapiGetMBvpdField failed" - " to get buffer size"); - // break out with fapirc - break; - } - - FAPI_DBG("mbvpdRingFunc: fapiGetMBvpdField returned record len=0x%x", - l_recordLen ); - - // allocate buffer for the record. Always works - l_recordBuf = static_cast<uint8_t*>(fapiMalloc((size_t)l_recordLen)); - - // load ring from MBVPD for this target - l_fapirc = fapiGetMBvpdField( i_record, - i_keyword, - i_fapiTarget, - l_recordBuf, - l_recordLen ); - if (l_fapirc) - { - FAPI_ERR("mbvpdRingFunc: fapiGetMBvpdField failed rc=0x%x", - static_cast<uint32_t>(l_fapirc)); - // break out with fapirc - break; - } - - // find ring in the record. It is an error if not there for a "get". - l_fapirc = mvpdRingFuncFind ( i_chipletId, - i_ringId, - l_recordBuf, - l_recordLen, - l_pRing, - l_ringLen); - if (l_fapirc) - { - FAPI_ERR("mbvpdRingFunc: mvpdRingFuncFind failed rc=0x%x", - static_cast<uint32_t>(l_fapirc)); - // break out with fapirc - break; - } - // do the get operations - if (i_mbvpdRingFuncOp == MBVPD_RING_GET) // do the get operation - { - // ensure ring was found. Must be there for "get" - if (l_ringLen == 0) //not found - { - const uint8_t & RING_MODIFIER = i_ringId; - const uint8_t & CHIPLET_ID = i_chipletId; - const fapi::Target & CHIP_TARGET = i_fapiTarget; - FAPI_SET_HWP_ERROR(l_fapirc, RC_REPAIR_RING_NOT_FOUND ); - // break out with fapirc - break; - } - - // copy ring back to caller's buffer - l_fapirc = mvpdRingFuncGet ( l_pRing, - l_ringLen, - i_pRingBuf, - io_rRingBufsize); - if (l_fapirc) - { - FAPI_ERR("mbvpdRingFunc: mvpdRingFuncGet failed rc=0x%x", - static_cast<uint32_t>(l_fapirc)); - // break out with fapirc - break; - } - } - else - { - // Set operation has been removed, if need to be implemented - //copy over from mvpdRingFuncs - FAPI_ERR("mbvpdRingFunc: Invalid parameter function"); - FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_RING_FUNC_INVALID_PARAMETER); - } - - } while ( 0 ); - - // unload the repair ring - fapiFree((void*)l_recordBuf); - l_recordBuf = NULL; - - FAPI_DBG( "mbvpdRingFunc: exit bufsize= 0x%x rc= 0x%x", - io_rRingBufsize, - static_cast<uint32_t>(l_fapirc) ); - return l_fapirc; -} -#endif - - -//****************************************************************************** -// mvpdRingFuncFind: step through the record looking at rings for a match. -// o_rpRing returns a pointer to the ring if it is there in the record -// if not there, returns a pointer to the start of the padding after -// the last ring. -// o_rRingLen returns the number of bytes in the ring (header and data) -// Will be 0 if ring not found. -//****************************************************************************** -fapi::ReturnCode mvpdRingFuncFind( const uint8_t i_chipletId, - const uint8_t i_ringId, - uint8_t * i_pRecordBuf, - uint32_t i_recordBufLen, - uint8_t * &o_rpRing, - uint32_t &o_rRingLen) -{ - fapi::ReturnCode l_fapirc; - uint8_t *l_pRing = NULL; - uint32_t l_offset = 0; - CompressedScanData *l_pScanData = NULL; - bool l_foundflag = false; - - // initialize return fields in case of an error. - o_rpRing=NULL; - o_rRingLen=0; - - FAPI_DBG("mvpdRingFuncFind: entry chipletId=0x%x, ringId=0x%x ", - i_chipletId, - i_ringId ); - - do { - // point to #R record - l_pRing = i_pRecordBuf; - - // Find first RSA data block in ring (fixed offset defined by - // MVPD spec) - // - // First byte in record should be the version number, skip - // over this. - // - FAPI_DBG( "mvpdRingFuncFind: record version = 0x%x", *l_pRing ); - l_pRing++; - l_offset = 0; - - l_foundflag = false; - // be sure that data we will look at is within the passed buffer - while ( l_offset+sizeof(CompressedScanData) < i_recordBufLen ) - { - // point to header - l_pScanData = - reinterpret_cast<CompressedScanData *>( l_pRing+l_offset ); - - // Check magic key to make sure this is a valid record. - if ( FAPI_BE32TOH(l_pScanData->iv_magic) != RS4_MAGIC ) - { - FAPI_DBG("mvpdRingFuncFind:Header 0x%x offset 0x%x,end of list", - FAPI_BE32TOH(l_pScanData->iv_magic), - l_offset ); - break; - } - // dump record info for debug - FAPI_DBG("mvpdRingFuncFind:%d ringId=0x%x chipletId=0x%x" - " ringlen=0x%x size=0x%x", - l_offset, - l_pScanData->iv_ringId, - l_pScanData->iv_chipletId, - FAPI_BE32TOH(l_pScanData->iv_length), - FAPI_BE32TOH(l_pScanData->iv_size) ); - - - if ( (l_pScanData->iv_ringId == i_ringId) - && (l_pScanData->iv_chipletId == i_chipletId) ) - { - FAPI_DBG( "mvpdRingFuncFind: Found it: ring=0x%x, chiplet=0x%x," - " ringlen=0x%x", - i_ringId, - i_chipletId, - FAPI_BE32TOH(l_pScanData->iv_length) ); - - if (l_offset+FAPI_BE32TOH(l_pScanData->iv_size)>i_recordBufLen) - { - // shouldn't happen, but does not all fit - FAPI_SET_HWP_ERROR(l_fapirc, RC_REPAIR_RING_INVALID_SIZE ); - break; - } - l_foundflag = true; - o_rpRing = l_pRing+l_offset; - o_rRingLen=FAPI_BE32TOH(l_pScanData->iv_size); - // got it, break out of scan loop - break; - } - - // being defensive. - if (FAPI_BE32TOH(l_pScanData->iv_size) == 0) - { - // size of 0 is invalid, would loop forever. - break; - } - // bump to next ring - l_offset += FAPI_BE32TOH(l_pScanData->iv_size) ; - - } // end while scan loop - - // if no other error and not found, indicate with 0 size. - if ( !l_fapirc && ! l_foundflag ) - { - o_rpRing = l_pRing+l_offset; //return pointer to end of list - //incase needed for appending - o_rRingLen=0; //indicate not found - } - - } while ( 0 ); - - - FAPI_DBG("mvpdRingFuncFind: exit *ring= 0x%p", o_rpRing); - FAPI_IMP("mvpdRingFuncFind: exit chipletId=0x%x, ringId=0x%x size=0x%x" - " rc=0x%x", - i_chipletId, - i_ringId, - o_rRingLen, - static_cast<uint32_t>(l_fapirc) ); - - return l_fapirc; -} - -//****************************************************************************** -// mvpdValidateRingHeader -//****************************************************************************** -fapi::ReturnCode mvpdValidateRingHeader( CompressedScanData * i_pRingBuf, - uint8_t i_chipletId, - uint8_t i_ringId, - uint32_t i_ringBufsize) -{ - fapi::ReturnCode l_fapirc; - - if ( i_ringBufsize <= sizeof(CompressedScanData) || - FAPI_BE32TOH(i_pRingBuf->iv_magic) != RS4_MAGIC || - i_pRingBuf->iv_ringId != i_ringId || - i_pRingBuf->iv_chipletId != i_chipletId || - FAPI_BE32TOH(i_pRingBuf->iv_size) != i_ringBufsize) - { - FAPI_SET_HWP_ERROR(l_fapirc, RC_MVPD_RING_FUNC_INVALID_PARAMETER ); - } - return l_fapirc; -} - -//****************************************************************************** -// mvpdRingFuncGet: copy the ring back to the caller -//****************************************************************************** -fapi::ReturnCode mvpdRingFuncGet ( uint8_t *i_pRing, - uint32_t i_ringLen, - uint8_t *i_pCallerRingBuf, - uint32_t &io_rCallerRingBufLen) -{ - fapi::ReturnCode l_fapirc; - - do { - // return buffer pointer is NULL if just looking for the size - if ( i_pCallerRingBuf == NULL ) - { - io_rCallerRingBufLen = i_ringLen; - // break out of do block with success rc - break; - } - // check if we have enough space - if ( io_rCallerRingBufLen < i_ringLen ) - { - FAPI_ERR( "mvpdRingFuncGet: output buffer too small: 0x%x < 0x%x", - io_rCallerRingBufLen, - i_ringLen - ); - - // return actual size of data, so caller can re-try with - // the correct value - io_rCallerRingBufLen = i_ringLen; - FAPI_SET_HWP_ERROR(l_fapirc, RC_REPAIR_RING_INVALID_SIZE ); - - // break out of do block with fapi rc set - break; - } - // we're good, copy data into the passed-in buffer - FAPI_DBG( "mvpdRingFuncGet: memcpy 0x%p 0x%p 0x%x", - i_pCallerRingBuf, - i_pRing, - i_ringLen ); - memcpy( i_pCallerRingBuf, i_pRing, i_ringLen ); - io_rCallerRingBufLen = i_ringLen; - - } while (0); - - FAPI_DBG( "mvpdRingFuncGet: exit bufsize= 0x%x rc= 0x%x", - io_rCallerRingBufLen, - static_cast<uint32_t>(l_fapirc) ); - - return l_fapirc; -} - -//****************************************************************************** -// mvpdRingFuncSet: update the record with the caller's ring. -//****************************************************************************** -fapi::ReturnCode mvpdRingFuncSet ( uint8_t *i_pRecordBuf, - uint32_t i_recordLen, - uint8_t *i_pRing, - uint32_t i_ringLen, - uint8_t *i_pCallerRingBuf, - uint32_t i_callerRingBufLen) -{ - fapi::ReturnCode l_fapirc; - uint8_t *l_to = NULL; - uint8_t *l_fr = NULL; - uint32_t l_len = 0; - uint8_t *l_pRingEnd; // pointer into record to start of pad at end - - FAPI_DBG( "mvpdRingFuncSet: pRing=0x%p rLen=0x%x pCaller=0x%p cLen=0x%x", - i_pRing, - i_ringLen, - i_pCallerRingBuf, - i_callerRingBufLen); - - do { - // if exact fit, update in place - if (i_callerRingBufLen == i_ringLen) - { - l_to = i_pRing; - l_fr = i_pCallerRingBuf; - l_len = i_callerRingBufLen; - FAPI_DBG( "mvpdRingFuncSet: update in place-memcpy 0x%p 0x%p 0x%x", - l_to, - l_fr, - l_len); - memcpy (l_to, l_fr, l_len); - - // break out successful - break; - } - - // will need the end for shifting... look for something invalid - l_fapirc = mvpdRingFuncFind (0x00, - 0x00, - i_pRecordBuf, - i_recordLen, - l_pRingEnd, // find start of padding - l_len); - if ( l_fapirc ) - { - FAPI_ERR("mvpdRingFuncSet: mvpdRingFuncFind failed rc=0x%x", - static_cast<uint32_t>(l_fapirc)); - // break out with fapirc - break; - } - FAPI_DBG( "mvpdRingFuncSet: end= 0x%p", - l_pRingEnd); - - // if not there, then append if it fits - if (i_ringLen == 0 ) //is not currently in record (0 len from find) - { - if (l_pRingEnd+i_callerRingBufLen > i_pRecordBuf+i_recordLen) - { - FAPI_ERR( "mvpdRingFuncSet: not enough room to append "); - FAPI_SET_HWP_ERROR(l_fapirc, - RC_MVPD_RING_FUNC_INSUFFICIENT_RECORD_SPACE ); - // break out of do block with fapi rc set - break; - } - l_to = i_pRing; - l_fr = i_pCallerRingBuf; - l_len = i_callerRingBufLen; - FAPI_DBG( "mvpdRingFuncSet: append-memcpy 0x%p 0x%p 0x%x", - l_to, - l_fr, - l_len); - memcpy (l_to, l_fr, l_len); - - // break out successful - break; - } - - // if smaller, then shift left and zero fill - if (i_callerRingBufLen < i_ringLen) - { - l_to = i_pRing; - l_fr = i_pCallerRingBuf; - l_len = i_callerRingBufLen; - FAPI_DBG( "mvpdRingFuncSet: shrink-memcpy 0x%p 0x%p 0x%x", - l_to, - l_fr, - l_len); - memcpy (l_to, l_fr, l_len); - - l_to = i_pRing+i_callerRingBufLen; - l_fr = i_pRing+i_ringLen; - l_len = (l_pRingEnd)-(i_pRing+i_ringLen); - FAPI_DBG( "mvpdRingFuncSet: shrink-memmove 0x%p 0x%p 0x%x", - l_to, - l_fr, - l_len); - memmove (l_to, l_fr, l_len); //use memmove, always overlaps. - - l_to = (l_pRingEnd)-(i_ringLen-i_callerRingBufLen); - l_len = i_ringLen-i_callerRingBufLen; - FAPI_DBG( "mvpdRingFuncSet: shrink-memset 0x%p 0x%x 0x%x", - l_to, - 0x00, - l_len); - memset (l_to, 0x00, l_len); - - // break out successful - break; - - } - - // if larger, then shift right, if it fits - if (i_callerRingBufLen > i_ringLen) - { - // ensure the padding can contain the growth - if ((l_pRingEnd + (i_callerRingBufLen - i_ringLen)) > - (i_pRecordBuf + i_recordLen)) - { - FAPI_ERR( "mvpdRingFuncSet: not enough room to insert "); - FAPI_SET_HWP_ERROR(l_fapirc, - RC_MVPD_RING_FUNC_INSUFFICIENT_RECORD_SPACE ); - // break out of do block with fapi rc set - break; - } - - l_to = i_pRing+i_callerRingBufLen; - l_fr = i_pRing+i_ringLen; - l_len = l_pRingEnd-(i_pRing+i_ringLen); - FAPI_DBG( "mvpdRingFuncSet: insert-memmove 0x%p 0x%p 0x%x", - l_to, - l_fr, - l_len); - memmove (l_to, l_fr, l_len); - - l_to = i_pRing; - l_fr = i_pCallerRingBuf; - l_len = i_callerRingBufLen; - FAPI_DBG( "mvpdRingFuncSet: insert-memcpy 0x%p 0x%p 0x%x", - l_to, - l_fr, - l_len); - memcpy (l_to, l_fr, l_len); - - // break out successful - break; - } - FAPI_ERR( "mvpdRingFuncSet: shouldn't get to here" ); - - } while (0); - - FAPI_DBG( "mvpdRingFuncSet: exit rc= 0x%x", - static_cast<uint32_t>(l_fapirc) ); - - return l_fapirc; -} - - -} // extern "C" diff --git a/src/usr/hwpf/hwp/mvpd_accessors/mvpdRingFuncs.H b/src/usr/hwpf/hwp/mvpd_accessors/mvpdRingFuncs.H deleted file mode 100644 index 8c3d6bc1e..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/mvpdRingFuncs.H +++ /dev/null @@ -1,115 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/mvpdRingFuncs.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* 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. */ -/* 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 */ -// $Id: mvpdRingFuncs.H,v 1.4 2014/07/16 19:07:08 cswenson Exp $ -/** - * @file mvpdRingFuncs.H - * - * @brief Prototype for mvpdRingFuncs() - */ - - #ifndef _HWP_MVPDRINGFUNCS_ - #define _HWP_MVPDRINGFUNCS_ - - #include <fapi.H> - -// mvpdRingFunc can be used for get and set -enum mvpdRingFuncOp -{ - MVPD_RING_GET, - MVPD_RING_SET, -}; - -#ifndef FAPI_NO_MBVPD -// Only get operation for mbvpd Rings -enum mbvpdRingFuncOp -{ - MBVPD_RING_GET, -}; -#endif - -extern "C" -{ - -/** - * @brief get or set the requested ring for the record and keyword - * for the specified target CPU. - * - * detailed comments on get and set are in the - * getMvpdRing.H and setMvpdRing.H and apply here as well. - * - * @param i_mvpdRingFuncOp - indicate get or set via enum mvpdRingFuncOp - * @param i_record - Record enumerator - * @param i_keyword - Keyword enumerator - * @param i_fapiTarget - cpu target - * @param i_chipletId - Chiplet ID - * @param i_ringId - Ring ID - * @param i_pRingBuf - The buffer to receive or send the ring - * @param io_rRingBufsize - Size of ring / ring buffer - * - * @return fapi::ReturnCode - FAPI_RC_SUCCESS if success, - * relevant error code for failure. - */ -fapi::ReturnCode mvpdRingFunc( mvpdRingFuncOp i_mvpdRingFuncOp, - fapi::MvpdRecord i_record, - fapi::MvpdKeyword i_keyword, - const fapi::Target &i_fapiTarget, - const uint8_t i_chipletId, - const uint8_t i_ringId, - uint8_t *i_pRingBuf, - uint32_t &io_rRingBufsize); - -#ifndef FAPI_NO_MBVPD -/** - * @brief get the requested ring for the record and keyword - * for the specified target CPU. - * - * detailed comments on get are in getMbvpdRing.H - * and apply here as well. - * - * @param i_mbvpdRingFuncOp - indicate get or set via enum mbvpdRingFuncOp - * @param i_record - Record enumerator - * @param i_keyword - Keyword enumerator - * @param i_fapiTarget - cpu target - * @param i_chipletId - Chiplet ID - * @param i_ringId - Ring ID - * @param i_pRingBuf - The buffer to receive or send the ring - * @param io_rRingBufsize - Size of ring / ring buffer - * - * @return fapi::ReturnCode - FAPI_RC_SUCCESS if success, - * relevant error code for failure. - */ -fapi::ReturnCode mbvpdRingFunc( mbvpdRingFuncOp i_mbvpdRingFuncOp, - fapi::MBvpdRecord i_record, - fapi::MBvpdKeyword i_keyword, - const fapi::Target &i_fapiTarget, - const uint8_t i_chipletId, - const uint8_t i_ringId, - uint8_t *i_pRingBuf, - uint32_t &io_rRingBufsize); -#endif - -} // extern "C" - -#endif diff --git a/src/usr/hwpf/hwp/mvpd_accessors/setMvpdRing.C b/src/usr/hwpf/hwp/mvpd_accessors/setMvpdRing.C deleted file mode 100644 index d28a810c8..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/setMvpdRing.C +++ /dev/null @@ -1,78 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/setMvpdRing.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* 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. */ -/* 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 */ -// $Id: setMvpdRing.C,v 1.2 2014/06/27 19:24:02 thi Exp $ -/** - * @file setMvpdRing.C - * - * @brief update rings in MVPD records - * - */ - -#include <stdint.h> - -// fapi support -#include <fapi.H> - -#include <setMvpdRing.H> -#include <mvpdRingFuncs.H> - -extern "C" -{ -using namespace fapi; - -// setMvpdRing: Wrapper to call common function mvpdRingFunc -fapi::ReturnCode setMvpdRing( fapi::MvpdRecord i_record, - fapi::MvpdKeyword i_keyword, - const fapi::Target &i_fapiTarget, - const uint8_t i_chipletId, - const uint8_t i_ringId, - uint8_t *i_pRingBuf, - uint32_t i_rRingBufsize) -{ - fapi::ReturnCode l_fapirc; - - FAPI_DBG("setMvpdRing: entry ringId=0x%x, chipletId=0x%x, size=0x%x ", - i_ringId, - i_chipletId, - i_rRingBufsize ); - - // common get and set processing - l_fapirc = mvpdRingFunc(MVPD_RING_SET, - i_record, - i_keyword, - i_fapiTarget, - i_chipletId, - i_ringId, - i_pRingBuf, - i_rRingBufsize); //in and out for common code. - //in only for set. - - FAPI_DBG("setMvpdRing: exit rc=0x%x", - static_cast<uint32_t>(l_fapirc) ); - - return l_fapirc; -} - -} // extern "C" diff --git a/src/usr/hwpf/hwp/mvpd_accessors/setMvpdRing.H b/src/usr/hwpf/hwp/mvpd_accessors/setMvpdRing.H deleted file mode 100644 index 8e69d0b7b..000000000 --- a/src/usr/hwpf/hwp/mvpd_accessors/setMvpdRing.H +++ /dev/null @@ -1,94 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/hwpf/hwp/mvpd_accessors/setMvpdRing.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2012,2014 */ -/* */ -/* 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 */ -// $Id: setMvpdRing.H,v 1.2 2013/01/25 21:12:40 whs Exp $ -/** - * @file setMvpdRing.H - * - * @brief Prototype for setMvpdRing() - - * get a repair ring from a MVPD record - */ - - #ifndef _HWP_SETMVPDRING_ - #define _HWP_SETMVPDRING_ - - #include <fapi.H> - -// function pointer typedef definition for HWP call support -typedef fapi::ReturnCode (*setMvpdRing_FP_t) - (fapi::MvpdRecord,fapi::MvpdKeyword, const fapi::Target &, - const uint8_t, const uint8_t, uint8_t *, uint32_t); - -extern "C" -{ - -/** - * @brief set specified ring from MVPD for the specified target CPU. - * - * A Ring Id Chiplet Id should be unique in the mvpd Record. - * The code does not validate. No assumption should be made on which would - * be updated if there are multiple. - * - * The set ring can be the same size or smaller than an existing ring. - * The ring can be larger than the existing ring or can be added (was - * not there before) if there is room in the record. - * - * @param i_record - Record enumerator - * @param i_keyword - Keyword enumerator - * Supported Rings are: - * MVPD_RECORD_CP00 - MVPD_KEYWORD_PDR - * MVPD_RECORD_CP00 - MVPD_KEYWORD_PDG - * @param i_fapiTarget - cpu target - * @param i_chipletId - Chiplet ID - * @param i_ringId - Ring ID - * @param i_pRingBuf - pointer to a buffer allocated by the caller - * to with the ring header and data to set. - * Can not be NULL. - * @param i_rRingBufsize - size of ring buffer that the caller has - * allocated. - * The buffer contains the CompressedScanData - * structure followed by compressed data. The - * caller does compression and decompression. - * The header needs to include the RS4 magic - * number. The ring ID and chiplet ID must match - * the passed parameters. The size must match the - * parameter size. - * - * Buffer: io_rRingBufsize returns xNN. - * byte x0 CompressedScanData structure (rs4 header) - * byte x18 compressed data (sizeof CompressedScanData is 0x18) - * byte xNN last byte of compressed data* - * - * @return fapi::ReturnCode - FAPI_RC_SUCCESS if success, - * relevant error code for failure. - */ -fapi::ReturnCode setMvpdRing( fapi::MvpdRecord i_record, - fapi::MvpdKeyword i_keyword, - const fapi::Target &i_fapiTarget, - const uint8_t i_chipletId, - const uint8_t i_ringId, - uint8_t *i_pRingBuf, - uint32_t i_rRingBufsize ); - -} - -#endif |

