diff options
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/hwpf/hwp/mvpd_accessors/getDecompressedISDIMMAttrs.C | 267 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/mvpd_accessors/getISDIMMTOC4DAttrs.C | 364 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk | 2 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/mvpd_accessors/mvpd_errors.xml | 26 | ||||
-rw-r--r-- | src/usr/hwpf/plat/fapiPlatAttributeService.C | 19 | ||||
-rw-r--r-- | src/usr/hwpf/test/hwpMBvpdAccessorTest.H | 252 | ||||
-rw-r--r-- | src/usr/targeting/common/xmltohb/attribute_types.xml | 53 | ||||
-rw-r--r-- | src/usr/targeting/common/xmltohb/target_types.xml | 3 |
8 files changed, 939 insertions, 47 deletions
diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getDecompressedISDIMMAttrs.C b/src/usr/hwpf/hwp/mvpd_accessors/getDecompressedISDIMMAttrs.C new file mode 100644 index 000000000..01960b845 --- /dev/null +++ b/src/usr/hwpf/hwp/mvpd_accessors/getDecompressedISDIMMAttrs.C @@ -0,0 +1,267 @@ +/* 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 */ +/* [+] 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> +#include <targeting/common/commontargeting.H> +#include <targeting/common/utilFilter.H> +#include <targeting/common/trace.H> +using namespace TARGETING; + +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 new file mode 100644 index 000000000..235263461 --- /dev/null +++ b/src/usr/hwpf/hwp/mvpd_accessors/getISDIMMTOC4DAttrs.C @@ -0,0 +1,364 @@ +/* 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 */ +/* [+] 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.1 2014/9/25 04:38:00 eliner 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; + +} + +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; + } + + uint32_t l_dimmPos = 0; + //@todo: RTC 116304 + l_fapirc = FAPI_ATTR_GET(ATTR_POS,&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; +} + +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; + } + + uint32_t l_dimmPos = 0; + //@todo: RTC 116304 + l_fapirc = FAPI_ATTR_GET(ATTR_POS,&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/mvpd.mk b/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk index 73e2281fd..447584e3c 100644 --- a/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk +++ b/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk @@ -42,4 +42,6 @@ OBJS += getMBvpdDram2NModeEnabled.o OBJS += getMBvpdSensorMap.o OBJS += getControlCapableData.o OBJS += accessMBvpdL4BankDelete.o +OBJS += getDecompressedISDIMMAttrs.o +OBJS += getISDIMMTOC4DAttrs.o diff --git a/src/usr/hwpf/hwp/mvpd_accessors/mvpd_errors.xml b/src/usr/hwpf/hwp/mvpd_accessors/mvpd_errors.xml index e912380b3..f3ad88b27 100644 --- a/src/usr/hwpf/hwp/mvpd_accessors/mvpd_errors.xml +++ b/src/usr/hwpf/hwp/mvpd_accessors/mvpd_errors.xml @@ -22,7 +22,7 @@ <!-- permissions and limitations under the License. --> <!-- --> <!-- IBM_PROLOG_END_TAG --> -<!-- $Id: mvpd_errors.xml,v 1.19 2014/10/27 16:13:41 eliner Exp $ --> +<!-- $Id: mvpd_errors.xml,v 1.21 2014/11/03 17:56:17 eliner Exp $ --> <hwpErrors> <!-- ********************************************************************* --> <hwpError> @@ -258,6 +258,18 @@ </callout> </hwpError> <hwpError> + <rc>RC_MBVPD_INVALID_DQ_DATA</rc> + <description> + To get the proper DQ data, we have to be given + a valid copy to collect. + </description> + <ffdc>DQ_COPY</ffdc> + <callout> + <procedure>CODE</procedure> + <priority>HIGH</priority> + </callout> + </hwpError> + <hwpError> <rc>RC_MBVPD_DIMMS_NOT_FOUND</rc> <description> To get the proper MT data, we need to find the @@ -306,4 +318,16 @@ <priority>HIGH</priority> </callout> </hwpError> + <hwpError> + <rc>RC_MBVPD_INVALID_DQS_DATA</rc> + <description> + To get the proper DQS data, we have to be given + a valid copy to collect. + </description> + <ffdc>DQS_COPY</ffdc> + <callout> + <procedure>CODE</procedure> + <priority>HIGH</priority> + </callout> + </hwpError> </hwpErrors> diff --git a/src/usr/hwpf/plat/fapiPlatAttributeService.C b/src/usr/hwpf/plat/fapiPlatAttributeService.C index 05fbc9413..ba97abd63 100644 --- a/src/usr/hwpf/plat/fapiPlatAttributeService.C +++ b/src/usr/hwpf/plat/fapiPlatAttributeService.C @@ -1584,6 +1584,25 @@ fapi::ReturnCode fapiPlatGetControlCapable(const fapi::Target * i_pTarget, } +fapi::ReturnCode getIsDimmToC4DQ + (const fapi::Target * i_pTarget, + uint8_t (&o_val) [4][80]) +{ + fapi::ReturnCode l_rc; + FAPI_EXEC_HWP(l_rc,getDQAttrISDIMM,*i_pTarget,o_val); + return FAPI_RC_SUCCESS; +} + +fapi::ReturnCode getIsDimmToC4DQS + (const fapi::Target * i_pTarget, + uint8_t (&o_val) [4][20]) +{ + fapi::ReturnCode l_rc; + FAPI_EXEC_HWP(l_rc,getDQSAttrISDIMM,*i_pTarget,o_val); + return FAPI_RC_SUCCESS; +} + + } // End platAttrSvc namespace } // End fapi namespace diff --git a/src/usr/hwpf/test/hwpMBvpdAccessorTest.H b/src/usr/hwpf/test/hwpMBvpdAccessorTest.H index 7b686a2f9..386a383b1 100644 --- a/src/usr/hwpf/test/hwpMBvpdAccessorTest.H +++ b/src/usr/hwpf/test/hwpMBvpdAccessorTest.H @@ -60,12 +60,13 @@ #include <mvpd_accessors/getMBvpdSensorMap.H> #include <mvpd_accessors/getControlCapableData.H> #include <mvpd_accessors/accessMBvpdL4BankDelete.H> +#include <mvpd_accessors/getDecompressedISDIMMAttrs.H> #include <errl/errlmanager.H> #include <errl/errlentry.H> #include <devicefw/driverif.H> #include <trace/interface.H> - +#include <config.h> using namespace fapi; using namespace TARGETING; @@ -205,6 +206,255 @@ public: } + void testGetDQAttrISDIMM() + { + fapi::ReturnCode l_fapirc; + + TS_TRACE("DQ Attributes ISDIMM entry"); + + TARGETING::TargetHandleList l_memBufList; + getAllChips(l_memBufList, TYPE_MEMBUF); + + for(uint8_t l_mbNum = 0; l_mbNum < l_memBufList.size(); l_mbNum++) + { + TARGETING::TargetHandleList l_mbaList; + getChildAffinityTargets(l_mbaList,l_memBufList[l_mbNum], + CLASS_UNIT,TYPE_MBA,false); + + for(uint8_t l_mbaNum = 0; l_mbaNum < l_mbaList.size(); l_mbaNum++) + { + //dump physical path to target + EntityPath l_mbaPath; + l_mbaPath = l_mbaList[l_mbaNum] ->getAttr<ATTR_PHYS_PATH>(); + l_mbaPath.dump(); + + //cast out type of target to a FAPI type of target. + fapi::Target l_fapi_mba_target(TARGET_TYPE_MBA_CHIPLET, + (const_cast<TARGETING::Target*>(l_mbaList[l_mbaNum]))); + + uint8_t l_customDimm = 0; + l_fapirc = FAPI_ATTR_GET(ATTR_EFF_CUSTOM_DIMM, + &l_fapi_mba_target,l_customDimm); + if(l_fapirc) + { + FAPI_ERR("hwpMBvpdAccessorTest: Read of custom dimm failed"); + break; + } + + //if custom_dimm = 0, use isdimm otherwise this test is useless + if(fapi::ENUM_ATTR_EFF_CUSTOM_DIMM_NO == l_customDimm) + { + + // make a local copy of the memory buffer target + TARGETING::Target* l_mb_target = l_memBufList[l_mbNum]; + + // dump physical path to target + EntityPath l_path; + l_path = l_mb_target->getAttr<ATTR_PHYS_PATH>(); + l_path.dump(); + + // cast OUR type of target to a FAPI type of target. + fapi::Target l_fapi_mb_target( + TARGET_TYPE_MEMBUF_CHIP, + (const_cast<TARGETING::Target*>(l_mb_target))); + uint8_t l_valDQ[4][80]; + l_fapirc = FAPI_ATTR_GET(ATTR_VPD_ISDIMMTOC4DQ, + &l_fapi_mb_target,l_valDQ); + + if(l_fapirc) break; + TS_TRACE("DQ Attributes ISDIMM Accessor" + "first element=0x%08x",l_valDQ[0][0]); + } + } + } + if (l_fapirc) + { + TS_FAIL("getDQAttrISDIMM: FAPI_ATTR_GET fail rc=0x%x", + static_cast<uint32_t>(l_fapirc)); + fapiLogError(l_fapirc); + } + TS_TRACE("testGetDQAttrISDIMM exit"); + } + + void testGetDQSAttrISDIMM() + { + fapi::ReturnCode l_fapirc; + + TS_TRACE("DQS Attributes ISDIMM entry"); + + TARGETING::TargetHandleList l_memBufList; + getAllChips(l_memBufList, TYPE_MEMBUF); + + for(uint8_t l_mbNum = 0; l_mbNum < l_memBufList.size(); l_mbNum++) + { + TARGETING::TargetHandleList l_mbaList; + getChildAffinityTargets(l_mbaList,l_memBufList[l_mbNum], + CLASS_UNIT,TYPE_MBA,false); + + for(uint8_t l_mbaNum = 0; l_mbaNum < l_mbaList.size(); l_mbaNum++) + { + //dump physical path to target + EntityPath l_mbaPath; + l_mbaPath = l_mbaList[l_mbaNum]->getAttr<ATTR_PHYS_PATH>(); + l_mbaPath.dump(); + + //cast our type of target to a FAPI type of target + fapi::Target l_fapi_mba_target(TARGET_TYPE_MBA_CHIPLET, + (const_cast<TARGETING::Target*>(l_mbaList[l_mbaNum]))); + + uint8_t l_customDimm = 0; + l_fapirc = FAPI_ATTR_GET(ATTR_EFF_CUSTOM_DIMM, + &l_fapi_mba_target,l_customDimm); + if(l_fapirc) + { + FAPI_ERR("hwpMBvpdAccessorTest: Read of custom dimm failed"); + break; + } + + //if custom_dimm = 0, use isdimm otherwise this test is useless + if(fapi::ENUM_ATTR_EFF_CUSTOM_DIMM_NO == l_customDimm) + { + + // make a local copy of the memory buffer target + TARGETING::Target* l_mb_target = l_memBufList[l_mbNum]; + + // dump physical path to target + EntityPath l_path; + l_path = l_mb_target->getAttr<ATTR_PHYS_PATH>(); + l_path.dump(); + + // cast OUR type of target to a FAPI type of target. + fapi::Target l_fapi_mb_target( + TARGET_TYPE_MEMBUF_CHIP, + (const_cast<TARGETING::Target*>(l_mb_target))); + + uint8_t l_valDQS[4][20]; + l_fapirc = FAPI_ATTR_GET(ATTR_VPD_ISDIMMTOC4DQS, + &l_fapi_mb_target,l_valDQS); + + if(l_fapirc) break; + TS_TRACE("DQS Attributes ISDIMM Accessor" + "first element=0x%08x",l_valDQS[0][0]); + } + } + } + if (l_fapirc) + { + TS_FAIL("getDQSAttrISDIMM: FAPI_ATTR_GET fail rc=0x%x", + static_cast<uint32_t>(l_fapirc)); + fapiLogError(l_fapirc); + } + TS_TRACE("testGetDQSAttrISDIMM exit"); + + } + + void testDQandDQSISDIMMAttrs() + { + + TS_TRACE("testDQandDQSISDIMMAttrs entry"); + //first testing the 0 test case; + ecmdDataBufferBase l_data_buffer_DQ1(136); //17 bits, just one DQ + ecmdDataBufferBase l_data_buffer_DQS1(16); //2 bits, just one DQS + for(int l_index =0;l_index<136; l_index++) + { + l_data_buffer_DQ1.writeBit(l_index,0); + if(l_index<16) l_data_buffer_DQS1.writeBit(l_index,0); + } + uint8_t l_finalDQArray[80]; + uint8_t l_finalDQSArray[20]; + + decodeISDIMMAttrs(l_data_buffer_DQ1, l_data_buffer_DQS1, + l_finalDQArray, l_finalDQSArray); + + uint8_t l_DQOutput1[80] = {0,1,2,3,4,5,6,7, + 8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23, + 24,25,26,27,28,29,30,31, + 32,33,34,35,36,37,38,39, + 40,41,42,43,44,45,46,47, + 48,49,50,51,52,53,54,55, + 56,57,58,59,60,61,62,63, + 64,65,66,67,68,69,70,71, + 255,255,255,255,255,255,255,255}; + uint8_t l_DQSOutput1[20] = {0,1,2,3,4,5,6,7, + 8,9,10,11,12,13,14, + 15,16,17,255,255}; + + + for(int l_zeroFinalIndex = 0; l_zeroFinalIndex<80;l_zeroFinalIndex++) + { + if(l_finalDQArray[l_zeroFinalIndex] != + l_DQOutput1[l_zeroFinalIndex]) + { + TS_TRACE("testDQandDQSISDIMMAttrs failed, DQ is wrong"); + break; + } + if(l_zeroFinalIndex<20 && (l_finalDQSArray[l_zeroFinalIndex] != + l_DQSOutput1[l_zeroFinalIndex])) + { + TS_TRACE("testDQandDQSISDIMMAttrs failed, DQS is wrong"); + break; + } + if(l_zeroFinalIndex == 79) + { + TS_TRACE("testDQandDQSISDIMMAttrs passed the all zero test"); + } + } + //and now for actual data + uint32_t l_byteOrder = 0b000000001001111111111001; + uint32_t l_nibSwap = 0b0000000111110000; + uint32_t l_nibToNib1 = 0b00000010101011110000000000000000; + uint32_t l_nibToNib2 = 0b00000000000000000000000010101000; + uint32_t l_nibToNib3 = 0b00000000000000000000000000000000; + uint32_t l_nibSwapDQS = 0b0000000100010000; + + l_data_buffer_DQ1.insertFromRight(l_byteOrder,0,24); + l_data_buffer_DQ1.insertFromRight(l_nibSwap,24,16); + l_data_buffer_DQ1.insertFromRight(l_nibToNib1,40,32); + l_data_buffer_DQ1.insertFromRight(l_nibToNib2,72,32); + l_data_buffer_DQ1.insertFromRight(l_nibToNib3,104,32); + + l_data_buffer_DQS1.insertFromRight(l_nibSwapDQS,0,16); + + decodeISDIMMAttrs(l_data_buffer_DQ1, l_data_buffer_DQS1, + l_finalDQArray, l_finalDQSArray); + + uint8_t l_DQOutput2[80] = {15,13,14,12,10,9,11,8, + 4,5,6,7,0,1,2,3, + 20,21,22,23,16,17,18,19, + 68,69,70,71,64,65,66,67, + 36,37,38,39,32,33,34,35, + 43,41,42,40,44,45,46,47, + 48,49,50,51,52,53,54,55, + 56,57,58,59,60,61,62,63, + 24,25,26,27,28,29,30,31, + 255,255,255,255,255,255,255,255}; + uint8_t l_DQSOutput2[20] = {3,2,0,1,4,5,16,17, + 9,8,10,11,12,13,14,15, + 6,7,255,255}; + + for(int l_finalIndex = 0; l_finalIndex<80;l_finalIndex++) + { + if(l_finalDQArray[l_finalIndex] != l_DQOutput2[l_finalIndex]) + { + TS_TRACE("testDQandDQSISDIMMAttrs failed, DQ is wrong"); + break; + } + if(l_finalIndex<20 && (l_finalDQSArray[l_finalIndex] != + l_DQSOutput2[l_finalIndex])) + { + TS_TRACE("testDQandDQSISDIMMAttrs failed, DQS is wrong"); + break; + } + if(l_finalIndex == 79) + { + TS_TRACE("testDQandDQSISDIMMAttrs passed the actual data test"); + } + } + TS_TRACE("testDQandDQSISDIMMAttrs exit"); + + } + /** * @brief call getControlCapableData to ensure that it's getting the MR * keyword correctly, and getting the right data diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml index 942a581a1..236cd88d2 100644 --- a/src/usr/targeting/common/xmltohb/attribute_types.xml +++ b/src/usr/targeting/common/xmltohb/attribute_types.xml @@ -13231,11 +13231,12 @@ firmware notes: Platforms should initialize this attribute to AUTO (0)</descript <attribute> <id>MRW_DIMM_POWER_CURVE_PERCENT_UPLIFT_IDLE</id> - <description>Machine Readable Workbook DIMM power curve percent uplift for this system at idle utilization.</description> + <description> + Machine Readable Workbook DIMM power + curve percent uplife idle for this system + </description> <simpleType> - <uint8_t> - <default>0x0</default> - </uint8_t> + <uint8_t></uint8_t> </simpleType> <persistency>non-volatile</persistency> <readable/> @@ -14505,47 +14506,9 @@ firmware notes: Platforms should initialize this attribute to AUTO (0)</descript </hwpfToHbAttrMap> </attribute> -<!-- TODO RTC: 113491 ISDIMM DQ data decompression --> -<attribute> - <id>VPD_ISDIMMTOC4DQ</id> - <description> - ISDIMM DQ mapping that comes from QX keyword on the CDIMM VPD. - </description> - <simpleType> - <uint8_t> - </uint8_t> - <array>4, 80</array> - </simpleType> - <persistency>volatile-zeroed</persistency> - <readable/> - <hwpfToHbAttrMap> - <id>ATTR_VPD_ISDIMMTOC4DQ</id> - <macro>DIRECT</macro> - </hwpfToHbAttrMap> -</attribute> - -<!-- TODO RTC: 113491 ISDIMM DQ data decompression --> -<attribute> - <id>VPD_ISDIMMTOC4DQS</id> - <description> - ISDIMM DQQ mapping that comes from QS keyword on the CDIMM VPD. - </description> - <simpleType> - <uint8_t> - </uint8_t> - <array>4, 20</array> - </simpleType> - <persistency>volatile-zeroed</persistency> - <readable/> - <hwpfToHbAttrMap> - <id>ATTR_VPD_ISDIMMTOC4DQS</id> - <macro>DIRECT</macro> - </hwpfToHbAttrMap> -</attribute> - <attribute> <id>ISDIMM_POWER_CURVE_ALGORITHM_VERSION</id> - <description>Version of algorithm used to calculate ISDIMM power curves + <description>version of algorithm used to calculate ISDIMM power curves </description> <simpleType> <uint32_t><default>0</default></uint32_t> @@ -14893,3 +14856,7 @@ firmware notes: Platforms should initialize this attribute to AUTO (0)</descript </attributes> + + + + diff --git a/src/usr/targeting/common/xmltohb/target_types.xml b/src/usr/targeting/common/xmltohb/target_types.xml index c87243b19..a160b38a1 100644 --- a/src/usr/targeting/common/xmltohb/target_types.xml +++ b/src/usr/targeting/common/xmltohb/target_types.xml @@ -1408,8 +1408,7 @@ <field><id>reserved</id><value>0</value></field> </default> </attribute> - <attribute><id>VPD_ISDIMMTOC4DQ</id></attribute> - <attribute><id>VPD_ISDIMMTOC4DQS</id></attribute> + <attribute><id>MSS_POWER_CONTROL_REQUESTED</id></attribute> <attribute><id>CDM_DOMAIN</id><default>MEM</default></attribute> <!-- IPMI Sensor numbers for reporting Centaur status to the BMC --> <attribute><id>IPMI_SENSORS</id></attribute> |