blob: ee27fc85006ebf3d457ecd89d1991470bcacfeb7 [file] [log] [blame]
Prachi Guptaa40a3ac2016-11-29 23:17:19 -06001From 06f2d36f5e7b7f48d85f93da974816d5b25dfaf1 Mon Sep 17 00:00:00 2001
2From: Prachi Gupta <pragupta@us.ibm.com>
3Date: Tue, 29 Nov 2016 09:46:43 -0600
4Subject: [PATCH 1/4] processMrw: fixes to work with latest witherspoon.xml
5
6- Fix logic to find lpc bus under the bmc target
7- Updated I2C_BUS_SPEED_ARRAY to be 4x4
8- Fixed XBUS HUID
9- Update all BAR attributes
10
11Change-Id: I82dcf21e28f77bcd1fb2391a5bd40d8ce1a6b172
12---
13 src/usr/targeting/common/Targets.pm | 81 +++++++++++++++++++--
14 src/usr/targeting/common/processMrw.pl | 83 ++++++++++++----------
15 .../targeting/common/xmltohb/attribute_types.xml | 2 +-
16 .../targeting/common/xmltohb/target_types_hb.xml | 4 +-
17 4 files changed, 123 insertions(+), 47 deletions(-)
18
19diff --git a/src/usr/targeting/common/Targets.pm b/src/usr/targeting/common/Targets.pm
20index fc18675..42780dd 100644
21--- a/src/usr/targeting/common/Targets.pm
22+++ b/src/usr/targeting/common/Targets.pm
23@@ -123,7 +123,8 @@ sub loadXML
24 print "Loading MRW XML: $filename\n";
25 $self->{xml} =
26 XMLin($filename,forcearray => [ 'child_id', 'hidden_child_id', 'bus',
27- 'property', 'field', 'attribute' ]);
28+ 'property', 'field', 'attribute',
29+ 'enumerator' ]);
30
31 if (defined($self->{xml}->{'enumerationTypes'}))
32 {
33@@ -462,7 +463,6 @@ sub buildHierarchy
34 {
35 $baseptr = $self->{xml}->{'targetInstances'}->{'targetInstance'};
36 }
37-
38 if ($target eq "")
39 {
40 ## find system target
41@@ -816,7 +816,11 @@ sub setCommonAttrForChiplet
42
43 my $fapi_name = getFapiName($tgt_type, $node, $proc, $pos);
44
45- $self->{huid_idx}->{$tgt_type} = $pos;
46+ if ($tgt_type ne "XBUS")
47+ {
48+ $self->{huid_idx}->{$tgt_type} = $pos;
49+ }
50+
51 $self->setHuid($target, $sys, $node);
52 $self->setAttribute($target, "FAPI_NAME", $fapi_name);
53 $self->setAttribute($target, "PHYS_PATH", $physical_path);
54@@ -1332,16 +1336,16 @@ sub findConnections
55 my $target = shift;
56 my $bus_type = shift;
57 my $end_type = shift;
58+
59 my %connections;
60 my $num=0;
61 my $target_children = $self->getTargetChildren($target);
62-
63 if ($target_children eq "")
64 {
65 return "";
66 }
67
68- foreach my $child (@{ $self->getTargetChildren($target) })
69+ foreach my $child ($self->getAllTargetChildren($target))
70 {
71 my $child_bus_type = $self->getBusType($child);
72 if ($child_bus_type eq $bus_type)
73@@ -1353,7 +1357,6 @@ sub findConnections
74 my $type = $self->getMrwType($dest_parent);
75 my $dest_type = $self->getType($dest_parent);
76 my $dest_class = $self->getAttribute($dest_parent,"CLASS");
77-
78 if ($type eq "NA")
79 {
80 $type = $dest_type;
81@@ -1361,6 +1364,29 @@ sub findConnections
82 if ($type eq "NA") {
83 $type = $dest_class;
84 }
85+
86+ if ($end_type ne "") {
87+ #Look for an end_type match on any ancestor, as
88+ #connections may have a destination unit with a hierarchy
89+ #like unit->pingroup->muxgroup->chip where the chip has
90+ #the interesting type.
91+ while ($type ne $end_type) {
92+
93+ $dest_parent = $self->getTargetParent($dest_parent);
94+ if ($dest_parent eq "") {
95+ last;
96+ }
97+
98+ $type = $self->getMrwType($dest_parent);
99+ if ($type eq "NA") {
100+ $type = $self->getType($dest_parent);
101+ }
102+ if ($type eq "NA") {
103+ $type = $self->getAttribute($dest_parent, "CLASS");
104+ }
105+ }
106+ }
107+
108 if ($type eq $end_type || $end_type eq "")
109 {
110 $connections{CONN}[$num]{SOURCE}=$child;
111@@ -1554,6 +1580,22 @@ sub renameAttribute
112 return 0;
113 }
114
115+## remove an attribute from a target
116+sub removeAttribute
117+{
118+ my $self = shift;
119+ my $target = shift;
120+ my $attribute = shift;
121+
122+ my $target_ptr = $self->{data}->{TARGETS}->{$target};
123+ if (!defined($target_ptr->{ATTRIBUTES}->{$attribute}))
124+ {
125+ return 1;
126+ }
127+ delete($target_ptr->{ATTRIBUTES}->{$attribute});
128+ $self->log($target, "Removing attribute: $attribute");
129+}
130+
131 ## copy an attribute between targets
132 sub copyAttribute
133 {
134@@ -1589,7 +1631,6 @@ sub setAttributeField
135 my $value = shift;
136 $self->{data}->{TARGETS}->{$target}->{ATTRIBUTES}->{$attribute}->{default}
137 ->{field}->{$field}->{value} = $value;
138-
139 $self->log($target, "Setting Attribute: $attribute ($field) =$value");
140 }
141 ## returns complex attribute value
142@@ -1652,6 +1693,27 @@ sub getTargetChildren
143 return $target_ptr->{CHILDREN};
144 }
145
146+## returns an array of all child (including grandchildren) target names
147+sub getAllTargetChildren
148+{
149+ my $self = shift;
150+ my $target = shift;
151+ my @children;
152+
153+ my $targets = $self->getTargetChildren($target);
154+ if ($targets ne "")
155+ {
156+ for my $child (@$targets)
157+ {
158+ push @children, $child;
159+ my @more = $self->getAllTargetChildren($child);
160+ push @children, @more;
161+ }
162+ }
163+
164+ return @children;
165+}
166+
167 sub getEnumValue
168 {
169 my $self = shift;
170@@ -1964,6 +2026,11 @@ C<INDEX>.
171 Returns an array of target strings representing all the children of target
172 C<TARGET_STRING>.
173
174+=item getAllTargetChildren(C<TARGET_STRING>)
175+
176+Returns an array of target strings representing all the children of target
177+C<TARGET_STRING>, including grandchildren and below as well.
178+
179 =item getEnumValue(C<ENUM_TYPE>,C<ENUM_NAME>)
180
181 Returns the enum value of type C<ENUM_TYPE> and name C<ENUM_NAME>. The
182diff --git a/src/usr/targeting/common/processMrw.pl b/src/usr/targeting/common/processMrw.pl
183index f898500..312582d 100644
184--- a/src/usr/targeting/common/processMrw.pl
185+++ b/src/usr/targeting/common/processMrw.pl
186@@ -112,7 +112,7 @@ foreach my $target (sort keys %{ $targetObj->getAllTargets() })
187 processApss($targetObj, $target);
188 }
189
190- processIpmiSensors($targetObj,$target);
191+ #processIpmiSensors($targetObj,$target);
192 }
193
194 ## check topology
195@@ -427,16 +427,6 @@ sub processProcessor
196 $targetObj->getTargetParent($target);
197 $targetObj->copyAttribute($module_target,$target,"LOCATION_CODE");
198
199- ## Copy all attributes from module
200- foreach my $attr (sort (keys
201- %{ $targetObj->getTarget($module_target)->{TARGET}->{attribute} }))
202- {
203- if (($attr ne "TYPE") && ($attr ne "PHYS_PATH"))
204- {
205- $targetObj->copyAttribute($module_target,$target,$attr);
206- }
207- }
208-
209 ## Copy PCIE attributes from socket
210 ## Copy Position attribute from socket
211 foreach my $attr (sort (keys
212@@ -453,7 +443,7 @@ sub processProcessor
213 }
214
215 $targetObj->log($target,"Finding master proc");
216- my $lpcs=$targetObj->findConnections($target,"LPC","FSP");
217+ my $lpcs=$targetObj->findConnections($target,"LPC","BMC");
218 if ($lpcs ne "")
219 {
220 $targetObj->log ($target, "Setting master proc to $target");
221@@ -522,9 +512,9 @@ sub processProcessor
222 {
223 $targetObj->setAttributeField($target, "FSI_OPTION_FLAGS", "reserved",
224 "0");
225- $targetObj->setAttribute($target, "FSI_MASTER_CHIP", "physical:sys");
226+ $targetObj->setAttribute($target, "FSI_MASTER_CHIP", "physical:sys-0");
227 $targetObj->setAttribute($target, "FSI_MASTER_PORT", "0xFF");
228- $targetObj->setAttribute($target, "ALTFSI_MASTER_CHIP", "physical:sys");
229+ $targetObj->setAttribute($target, "ALTFSI_MASTER_CHIP", "physical:sys-0");
230 $targetObj->setAttribute($target, "ALTFSI_MASTER_PORT", "0xFF");
231 $targetObj->setAttribute($target, "FSI_MASTER_TYPE", "NO_MASTER");
232 $targetObj->setAttribute($target, "FSI_SLAVE_CASCADE", "0");
233@@ -534,6 +524,7 @@ sub processProcessor
234 {
235 $targetObj->setAttribute($target, "PROC_MASTER_TYPE",
236 "NOT_MASTER");
237+ $targetObj->setAttribute($target, "ALTFSI_MASTER_CHIP", "physical:sys-0");
238 }
239 ## Update bus speeds
240 processI2cSpeeds($targetObj,$target);
241@@ -562,15 +553,19 @@ sub processI2cSpeeds
242 $bus_speeds[0][0] = $bus_speeds2[0];
243 $bus_speeds[0][1] = $bus_speeds2[1];
244 $bus_speeds[0][2] = $bus_speeds2[2];
245- $bus_speeds[1][0] = $bus_speeds2[3];
246- $bus_speeds[1][1] = $bus_speeds2[4];
247- $bus_speeds[1][2] = $bus_speeds2[5];
248- $bus_speeds[2][0] = $bus_speeds2[6];
249- $bus_speeds[2][1] = $bus_speeds2[7];
250- $bus_speeds[2][2] = $bus_speeds2[8];
251- $bus_speeds[3][0] = $bus_speeds2[9];
252- $bus_speeds[3][1] = $bus_speeds2[10];
253- $bus_speeds[3][2] = $bus_speeds2[11];
254+ $bus_speeds[0][3] = $bus_speeds2[3];
255+ $bus_speeds[1][0] = $bus_speeds2[4];
256+ $bus_speeds[1][1] = $bus_speeds2[5];
257+ $bus_speeds[1][2] = $bus_speeds2[6];
258+ $bus_speeds[1][3] = $bus_speeds2[7];
259+ $bus_speeds[2][0] = $bus_speeds2[8];
260+ $bus_speeds[2][1] = $bus_speeds2[9];
261+ $bus_speeds[2][2] = $bus_speeds2[10];
262+ $bus_speeds[2][3] = $bus_speeds2[11];
263+ $bus_speeds[3][0] = $bus_speeds2[12];
264+ $bus_speeds[3][1] = $bus_speeds2[13];
265+ $bus_speeds[3][2] = $bus_speeds2[14];
266+ $bus_speeds[3][3] = $bus_speeds2[15];
267
268 my $i2cs=$targetObj->findConnections($target,"I2C","");
269 if ($i2cs ne "") {
270@@ -581,13 +576,11 @@ sub processI2cSpeeds
271 my $bus_speed=$targetObj->getBusAttribute(
272 $i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_SPEED");
273
274- #@todo RTC:164224 > currently the bus_speed fields are empty in the xml
275-=begin
276 if ($bus_speed eq "" || $bus_speed==0) {
277 print "ERROR: I2C bus speed not defined for $i2c->{SOURCE}\n";
278 $targetObj->myExit(3);
279 }
280-=cut
281+
282 ## choose lowest bus speed
283 if ($bus_speeds[$engine][$port] eq "" ||
284 $bus_speeds[$engine][$port]==0 ||
285@@ -599,15 +592,19 @@ sub processI2cSpeeds
286 $bus_speed_attr = $bus_speeds[0][0].",".
287 $bus_speeds[0][1].",".
288 $bus_speeds[0][2].",".
289+ $bus_speeds[0][3].",".
290 $bus_speeds[1][0].",".
291 $bus_speeds[1][1].",".
292 $bus_speeds[1][2].",".
293+ $bus_speeds[1][3].",".
294 $bus_speeds[2][0].",".
295 $bus_speeds[2][1].",".
296 $bus_speeds[2][2].",".
297+ $bus_speeds[2][3].",".
298 $bus_speeds[3][0].",".
299 $bus_speeds[3][1].",".
300- $bus_speeds[3][2];
301+ $bus_speeds[3][2].",".
302+ $bus_speeds[3][3];
303
304 $targetObj->setAttribute($target,"I2C_BUS_SPEED_ARRAY",$bus_speed_attr);
305 }
306@@ -626,16 +623,28 @@ sub setupBars
307 my $proc = $targetObj->getAttribute($target, "FABRIC_CHIP_ID");
308 $targetObj->{TOPOLOGY}->{$group}->{$proc}++;
309
310- my @bars=("FSP_BASE_ADDR","PSI_BRIDGE_BASE_ADDR",
311- "INTP_BASE_ADDR","PHB_MMIO_ADDRS_64","PHB_MMIO_ADDRS_32",
312- "PHB_XIVE_ESB_ADDRS","PHB_REG_ADDRS","XIVE_ROUTING_ESB_ADDR",
313- "XIVE_ROUTING_END_ADDR","XIVE_PRESENTATION_NVT_ADDR",
314- "VAS_HYPERVISOR_WINDOW_CONTEXT_ADDR",
315- "VAS_USER_WINDOW_CONTEXT_ADDR","LPC_BUS_ADDR",
316- "NVIDIA_NPU_PRIVILEGED_ADDR","NVIDIA_NPU_USER_REG_ADDR",
317- "NVIDIA_PHY0_REG_ADDR","NVIDIA_PHY1_REG_ADDR",
318- "XIVE_CONTROLLER_BAR_ADDR","XIVE_PRESENTATION_BAR_ADDR",
319- "NX_RNG_ADDR");
320+ my @bars=( "FSP_BASE_ADDR", #
321+ "PSI_BRIDGE_BASE_ADDR", #
322+ "INTP_BASE_ADDR",
323+ "PHB_MMIO_ADDRS_64", #
324+ "PHB_MMIO_ADDRS_32", #
325+ "PHB_XIVE_ESB_ADDRS", #
326+ "PHB_REG_ADDRS", #
327+ "XIVE_ROUTING_ESB_ADDR", #
328+ "XIVE_ROUTING_END_ADDR", #
329+ "XIVE_PRESENTATION_NVT_ADDR", #
330+ "VAS_HYPERVISOR_WINDOW_CONTEXT_ADDR", #
331+ "VAS_USER_WINDOW_CONTEXT_ADDR", #
332+ "LPC_BUS_ADDR", #
333+ "NVIDIA_NPU_PRIVILEGED_ADDR", #
334+ "NVIDIA_NPU_USER_REG_ADDR", #
335+ "NVIDIA_PHY0_REG_ADDR", #
336+ "NVIDIA_PHY1_REG_ADDR", #
337+ "PSI_HB_ESB_ADDR", #
338+ "XIVE_CONTROLLER_BAR_ADDR", #
339+ "XIVE_PRESENTATION_BAR_ADDR", #
340+ "XSCOM_BASE_ADDRESS", #
341+ "NX_RNG_ADDR"); #
342
343 # Attribute only valid in naples-based systems
344 if (!$targetObj->isBadAttribute($target,"NPU_MMIO_BAR_BASE_ADDR") ) {
345diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml
346index 9fce73d..70342c5 100644
347--- a/src/usr/targeting/common/xmltohb/attribute_types.xml
348+++ b/src/usr/targeting/common/xmltohb/attribute_types.xml
349@@ -15548,7 +15548,7 @@ Measured in GB</description>
350 <attribute>
351 <id>REDUNDANT_CLOCKS</id>
352 <description>
353       1 = System has redundant clock oscillators
354+ 1 = System has redundant clock oscillators
355 0 = System does not have redundant clock oscillators
356 From the Machine Readable Workbook
357 </description>
358diff --git a/src/usr/targeting/common/xmltohb/target_types_hb.xml b/src/usr/targeting/common/xmltohb/target_types_hb.xml
359index aa941be..4e2447d 100755
360--- a/src/usr/targeting/common/xmltohb/target_types_hb.xml
361+++ b/src/usr/targeting/common/xmltohb/target_types_hb.xml
362@@ -258,10 +258,10 @@
363 <attribute><id>VPD_SWITCHES</id></attribute>
364 </targetTypeExtension>
365
366-<targetType>
367+<targetTypeExtension>
368 <id>unit-xbus-nimbus</id>
369 <attribute><id>HB_TARGET_SCOMABLE</id></attribute>
370-</targetType>
371+</targetTypeExtension>
372
373 <targetTypeExtension>
374 <id>occ</id>
375--
3761.8.2.2
377