blob: e7a902b1f4b7be1264a0d9a9e3cfa4943fb56552 [file] [log] [blame]
Brian Horton82e0f0d2015-03-31 13:49:02 -05001From c474b26291b009f7a9c97e2bf94ad2917f11b1b9 Mon Sep 17 00:00:00 2001
2From: Dan Crowell <dcrowell@us.ibm.com>
3Date: Sun, 22 Mar 2015 23:03:57 -0500
4Subject: [PATCH] Add support for POWER_CONTROL_CAPABLE to ISDIMMs
5
6Change-Id: If9de980385cac7706b321a9fefc1158dc540b7e0
7---
8 .../usr/hwpf/hwp/mvpd_accessors/getMBvpdAttr.H | 11 +++-
9 .../hwp/mvpd_accessors/getControlCapableData.C | 54 ++++++++++----------
10 src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttr.C | 16 ++++++
11 src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttrData.C | 3 +
12 4 files changed, 55 insertions(+), 29 deletions(-)
13
14diff --git a/src/include/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttr.H b/src/include/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttr.H
15index 07ea5fc..810cb40 100644
16--- a/src/include/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttr.H
17+++ b/src/include/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttr.H
18@@ -46,11 +46,14 @@ namespace getAttrData
19 const uint8_t NUM_PORTS = 2; //Each MBA has 2 ports
20 const uint8_t NUM_DIMMS = 2; //Each port has 2 DIMMs
21 const uint8_t NUM_RANKS = 4; //Number of ranks
22- const uint8_t PORT_SECTION_SIZE = 64; //Each port has 64 bytes
23+ //Each port has 64 bytes of space, but only 62 bytes is useable
24+ const uint8_t PORT_SECTION_SIZE = 64;
25+ const uint8_t PORT_SECTION_USED = 62;
26
27 struct port_attributes
28 {
29- uint8_t port_attr[PORT_SECTION_SIZE];
30+ uint8_t port_attr[PORT_SECTION_USED];
31+ uint8_t nonport_data[PORT_SECTION_SIZE-PORT_SECTION_USED];
32 };
33 struct mba_attributes
34 {
35@@ -102,6 +105,7 @@ namespace getAttrData
36 UINT32_BY2 =0x0004, // uint32_t [2]
37 UINT32_BY2_BY2 =0x0005, // uint32_t [2][2]
38 UINT64 =0x0006, // uint64_t
39+ UINT8 =0x0007, // uint8_t
40 };
41 const uint16_t OUTPUT_TYPE_MASK = 0x00FF;
42
43@@ -111,6 +115,7 @@ namespace getAttrData
44 typedef uint32_t UINT32_BY2_t [2];
45 typedef uint32_t UINT32_BY2_BY2_t [2][2];
46 typedef uint64_t UINT64_t;
47+ typedef uint8_t UINT8_t;
48
49 // Special processing
50 // Rules:
51@@ -343,6 +348,8 @@ template<>class MBvpdAttrDataType<fapi::ATTR_VPD_TSYS_ADR>
52 { public: typedef fapi::ATTR_VPD_TSYS_ADR_Type Type; };
53 template<>class MBvpdAttrDataType<fapi::ATTR_VPD_TSYS_DP18>
54 { public: typedef fapi::ATTR_VPD_TSYS_DP18_Type Type; };
55+template<>class MBvpdAttrDataType<fapi::ATTR_VPD_POWER_CONTROL_CAPABLE>
56+ { public: typedef fapi::ATTR_VPD_POWER_CONTROL_CAPABLE_Type Type; };
57
58
59 // Template function that checks that the type is as expected.
60diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getControlCapableData.C b/src/usr/hwpf/hwp/mvpd_accessors/getControlCapableData.C
61index 4e4fe02..90afda6 100644
62--- a/src/usr/hwpf/hwp/mvpd_accessors/getControlCapableData.C
63+++ b/src/usr/hwpf/hwp/mvpd_accessors/getControlCapableData.C
64@@ -5,7 +5,7 @@
65 /* */
66 /* OpenPOWER HostBoot Project */
67 /* */
68-/* Contributors Listed Below - COPYRIGHT 2014 */
69+/* Contributors Listed Below - COPYRIGHT 2014,2015 */
70 /* [+] International Business Machines Corp. */
71 /* */
72 /* */
73@@ -40,38 +40,38 @@ fapi::ReturnCode getControlCapableData(
74 const fapi::Target &i_mbTarget,
75 uint8_t & o_val)
76 {
77- //Record:VSPD, Keyword:MR, offset: 253, 1 byte.
78- const uint32_t MR_KEYWORD_SIZE = 255;
79+ fapi::ReturnCode l_rc;
80
81- struct mr_keyword
82- {
83- uint8_t filler[253];
84- uint8_t position; //offset 253
85- uint8_t extraFiller[MR_KEYWORD_SIZE-sizeof(filler)-sizeof(position)];
86- };
87-
88- fapi::ReturnCode l_fapirc;
89- mr_keyword * l_pMrBuffer = new mr_keyword;
90- uint32_t l_MrBufsize = MR_KEYWORD_SIZE;
91- do{
92-
93- l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD,
94- fapi::MBVPD_KEYWORD_MR,
95- i_mbTarget,
96- reinterpret_cast<uint8_t *>(l_pMrBuffer),
97- l_MrBufsize);
98- if(l_fapirc)
99+ FAPI_DBG("getControlCapableData: start");
100+ do {
101+ // ATTR_VPD_POWER_CONTROL_CAPABLE is at the membuf level, but the
102+ // getMBvpdAttr() function takes a mba, so need to do a
103+ // conversion
104+ std::vector<fapi::Target> l_mbas;
105+ l_rc = fapiGetChildChiplets( i_mbTarget,
106+ fapi::TARGET_TYPE_MBA_CHIPLET,
107+ l_mbas );
108+ if( l_rc )
109 {
110- FAPI_ERR("getControlCapableData: Read of MR Keyword failed");
111+ FAPI_ERR("getControlCapableData: fapiGetChildChiplets failed");
112 break;
113 }
114- o_val = l_pMrBuffer->position;
115
116- }while(0);
117+ // If we don't have any functional MBAs then we will fail in
118+ // the other function so just return a default value here
119+ if( l_mbas.empty() )
120+ {
121+ o_val = fapi::ENUM_ATTR_VPD_POWER_CONTROL_CAPABLE_NONE;
122+ break;
123+ }
124
125- delete l_pMrBuffer;
126- l_pMrBuffer = NULL;
127+ // Call a VPD Accessor HWP to get the data
128+ FAPI_EXEC_HWP(l_rc, getMBvpdAttr,
129+ l_mbas[0], ATTR_VPD_POWER_CONTROL_CAPABLE,
130+ &o_val, sizeof(ATTR_VPD_POWER_CONTROL_CAPABLE_Type));
131+ } while(0);
132+ FAPI_ERR("getControlCapableData: end");
133
134- return l_fapirc;
135+ return l_rc;
136 }
137 }
138diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttr.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttr.C
139index b13e4f9..7be8ed2 100644
140--- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttr.C
141+++ b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttr.C
142@@ -976,6 +976,22 @@ fapi::ReturnCode returnValue (const MBvpdAttrDef* i_pAttrDef,
143 (*(UINT64_t*)o_pVal) = l_value;
144 break ;
145 }
146+ case UINT8: // uint8_t
147+ {
148+ // make sure return value size is correct
149+ if (sizeof(UINT8_t) != i_valSize)
150+ {
151+ l_fapirc = sizeMismatch(sizeof(UINT8_t),
152+ i_valSize,
153+ i_pAttrDef->iv_attrId);
154+ break; //return with error
155+ }
156+
157+ // only 1 value is present, it isn't stored per mba/port
158+ uint8_t l_value = (reinterpret_cast<uint8_t*>(i_pBuffer))[l_attrOffset];
159+ (*(UINT8_t*)o_pVal) = l_value;
160+ break ;
161+ }
162 default: // Hard to do, but needs to be caught
163 FAPI_ERR("returnValue: invalid output type 0x%04x for"
164 " attribute ID 0x%08x",
165diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttrData.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttrData.C
166index 4b18e40..5a599b5 100644
167--- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttrData.C
168+++ b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdAttrData.C
169@@ -178,6 +178,9 @@ const MBvpdAttrDef g_MBVPD_ATTR_DEF_array [] =
170 {ATTR_VPD_DRAM_2N_MODE_ENABLED,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,48,UINT8_BY2,0},
171 {ATTR_VPD_TSYS_ADR,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,49,UINT8_BY2|PORT00,0},
172 {ATTR_VPD_TSYS_DP18,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,49,UINT8_BY2|PORT11,0},
173+
174+// Membuf-level data that is stored within MR
175+ {ATTR_VPD_POWER_CONTROL_CAPABLE,ALL_DIMM,ALL_VER,MBVPD_KEYWORD_MR,253,UINT8,0},
176 };
177
178 const uint32_t g_MBVPD_ATTR_DEF_array_size =
179--
1801.7.4.1
181