summaryrefslogtreecommitdiffstats
path: root/openpower/patches/p8dtu-patches/hostboot-p8/0012-Set-OPAL_MODEL-to-p8dtu1u-or-p8dtu2u-for-1U-and-2U-s.patch
blob: bc4f4926636d46814b246e97f6a3fa73b17b6ae4 (plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
From 1e6bb450cf94fc3ade70f82703e6c57a30bbebaa Mon Sep 17 00:00:00 2001
From: Jim Yuan <jim.yuan@supermicro.com>
Date: Wed, 10 Aug 2016 10:41:32 -0700
Subject: [PATCH 12/14] Set OPAL_MODEL to p8dtu1u or p8dtu2u for 1U and 2U
 system.

Signed-off-by: Jim Yuan <jim.yuan@supermicro.com>
---
 src/usr/hwpf/hwp/start_payload/start_payload.C     | 66 +++++++++++++++++++++-
 .../common/xmltohb/attribute_types_hb.xml          |  1 +
 2 files changed, 66 insertions(+), 1 deletion(-)

diff --git a/src/usr/hwpf/hwp/start_payload/start_payload.C b/src/usr/hwpf/hwp/start_payload/start_payload.C
index ad155f19e..80e62a0b6 100644
--- a/src/usr/hwpf/hwp/start_payload/start_payload.C
+++ b/src/usr/hwpf/hwp/start_payload/start_payload.C
@@ -89,6 +89,8 @@
 #include    <config.h>
 #include    <ipmi/ipmiwatchdog.H>
 #include    <ipmi/ipmiif.H> //jim
+#include	<string.h> //jim
+
 #include    <vpd/vpd_if.H>
 
 #include    <hwpf/hwpf_reasoncodes.H>
@@ -487,6 +489,67 @@ void setAPSSGainOffsetFromPWSInfo(void)
 	assert(0);
 	}
 }
+
+
+void setOpalMode (void)
+{
+
+ uint8_t riser_id = 0 ;
+ errlHndl_t l_err = NULL; 
+ size_t len = 4;
+ 
+ //create request data buffer
+ uint8_t* data = new uint8_t[len];
+ 
+ IPMI::completion_code cc = IPMI::CC_UNKBAD;
+ 
+ data[0] = 0x3;  
+ data[1] = 0x70;  
+ data[2] = 0x1;  
+ data[3] = 0x2;  //offset 0x2 for UIO info
+ l_err = IPMI::sendrecv(IPMI::master_readwrite(), cc, len, data);
+ 
+ if( l_err == NULL )
+ {
+	 if( cc == IPMI::CC_OK )
+	 {
+	 riser_id = data[0];
+	 }
+	 
+	 delete[] data;
+ }
+
+ATTR_OPAL_MODEL_type l_model = {0};
+
+TARGETING::Target* sys = NULL;
+targetService().getTopLevelTarget(sys);
+
+sys->tryGetAttr<TARGETING::ATTR_OPAL_MODEL>(l_model);
+TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "OPAL Mode is %s", l_model);
+TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "Riser ID is %d", riser_id);
+
+if (riser_id == 0x9)
+	{
+	TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "1U OPAL Mode");
+	strcpy (l_model, "supermicro,p8dtu1u");
+
+	}
+else  //(riser_id == 0x19)
+	{
+	TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "2U OPAL Mode");
+	strcpy (l_model, "supermicro,p8dtu2u");
+	}
+
+if (!sys->trySetAttr<TARGETING::ATTR_OPAL_MODEL>(l_model))
+	{
+	TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "set OPAL Mode failed");
+	assert(0);
+	}
+
+sys->tryGetAttr<TARGETING::ATTR_OPAL_MODEL>(l_model);
+TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "after set, OPAL Mode is %s", l_model);
+
+}
 //
 //  Wrapper function to call host_runtime_setup
 //
@@ -529,7 +592,8 @@ void*    call_host_runtime_setup( void    *io_pArgs )
         }
 
 	setAPSSGainOffsetFromPWSInfo(); //jim add code before activate OCC. START_OCC_DURING_BOOT is defined in config.
-
+	setOpalMode(); //jim
+	
         bool l_activateOCC = is_avp_load();
 
 #ifdef CONFIG_START_OCC_DURING_BOOT
diff --git a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
index 64a0c9bae..3cfdb9aa0 100644
--- a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
+++ b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
@@ -966,6 +966,7 @@
     </simpleType>
     <persistency>non-volatile</persistency>
     <readable/>
+    <writeable/>
 </attribute>
 
 <attribute>
-- 
2.16.2.windows.1

OpenPOWER on IntegriCloud