Bill Hoffa | 56382a8 | 2017-05-08 13:48:03 -0500 | [diff] [blame] | 1 | From 7a4142d229ddd0554684664df8d7fa9bd402abc7 Mon Sep 17 00:00:00 2001 |
| 2 | From: Bill Hoffa <wghoffa@us.ibm.com> |
| 3 | Date: Mon, 8 May 2017 13:03:51 -0500 |
| 4 | Subject: [PATCH] Revert "ProcessMRW changes for dynamic i2c devices" |
| 5 | |
| 6 | - Do this temporarily while the attribute dependencies are sorted out |
| 7 | (HDAT_I2C_DEVICE_TYPE + HDAT_I2C_DEVICE_PURPOSE) |
| 8 | |
| 9 | This reverts commit 651ed35f1c045ea0c52ac659f9c27d757a351877. |
| 10 | --- |
| 11 | src/usr/i2c/i2c.C | 12 +- |
| 12 | src/usr/targeting/common/Targets.pm | 16 -- |
| 13 | src/usr/targeting/common/processMrw.pl | 190 --------------------- |
| 14 | .../common/xmltohb/attribute_types_openpower.xml | 4 +- |
| 15 | .../common/xmltohb/target_types_openpower.xml | 6 +- |
| 16 | 5 files changed, 12 insertions(+), 216 deletions(-) |
| 17 | |
| 18 | diff --git a/src/usr/i2c/i2c.C b/src/usr/i2c/i2c.C |
| 19 | index 3892497..835d9ea 100755 |
| 20 | --- a/src/usr/i2c/i2c.C |
| 21 | +++ b/src/usr/i2c/i2c.C |
| 22 | @@ -3854,6 +3854,9 @@ void getDeviceInfo( TARGETING::Target* i_i2cMaster, |
| 23 | case EEPROM::VPD_BACKUP: |
| 24 | l_currentDI.devicePurpose = |
| 25 | TARGETING::HDAT_I2C_DEVICE_PURPOSE_MODULE_VPD; |
| 26 | + //TODO RTC:165485 this isn't currently right. we'll need |
| 27 | + //to add the changes in the enum and possibly the other |
| 28 | + //struct/attribute. |
| 29 | break; |
| 30 | case EEPROM::SBE_PRIMARY: |
| 31 | case EEPROM::SBE_BACKUP: |
| 32 | @@ -3938,8 +3941,8 @@ void getDeviceInfo( TARGETING::Target* i_i2cMaster, |
| 33 | TARGETING::ATTR_HDAT_I2C_MASTER_PORT_type l_i2cMasterPort; |
| 34 | (*childItr)->tryGetAttr<TARGETING::ATTR_HDAT_I2C_MASTER_PORT>( |
| 35 | l_i2cMasterPort); |
| 36 | - TARGETING::ATTR_HDAT_I2C_DEVICE_TYPE_type l_i2cDevType; |
| 37 | - (*childItr)->tryGetAttr<TARGETING::ATTR_HDAT_I2C_DEVICE_TYPE>( |
| 38 | + TARGETING::ATTR_HDAT_I2C_DEVTYPE_type l_i2cDevType; |
| 39 | + (*childItr)->tryGetAttr<TARGETING::ATTR_HDAT_I2C_DEVTYPE>( |
| 40 | l_i2cDevType); |
| 41 | TARGETING::ATTR_HDAT_I2C_ADDR_type l_i2cAddr; |
| 42 | (*childItr)->tryGetAttr<TARGETING::ATTR_HDAT_I2C_ADDR>(l_i2cAddr); |
| 43 | @@ -3949,8 +3952,8 @@ void getDeviceInfo( TARGETING::Target* i_i2cMaster, |
| 44 | TARGETING::ATTR_HDAT_I2C_BUS_FREQ_type l_i2cBusFreq; |
| 45 | (*childItr)->tryGetAttr<TARGETING::ATTR_HDAT_I2C_BUS_FREQ>( |
| 46 | l_i2cBusFreq); |
| 47 | - TARGETING::ATTR_HDAT_I2C_DEVICE_PURPOSE_type l_i2cDevPurpose; |
| 48 | - (*childItr)->tryGetAttr<TARGETING::ATTR_HDAT_I2C_DEVICE_PURPOSE>( |
| 49 | + TARGETING::ATTR_HDAT_I2C_DEV_PURPOSE_type l_i2cDevPurpose; |
| 50 | + (*childItr)->tryGetAttr<TARGETING::ATTR_HDAT_I2C_DEV_PURPOSE>( |
| 51 | l_i2cDevPurpose); |
| 52 | |
| 53 | uint8_t l_arrayLength = |
| 54 | @@ -3966,7 +3969,6 @@ void getDeviceInfo( TARGETING::Target* i_i2cMaster, |
| 55 | l_idx++) |
| 56 | { |
| 57 | DeviceInfo_t l_currentDevice; |
| 58 | - l_currentDevice.masterChip = (*childItr); |
| 59 | l_currentDevice.engine = l_i2cEngine[l_idx]; |
| 60 | l_currentDevice.masterPort = l_i2cMasterPort[l_idx]; |
| 61 | l_currentDevice.addr = l_i2cAddr[l_idx]; |
| 62 | diff --git a/src/usr/targeting/common/Targets.pm b/src/usr/targeting/common/Targets.pm |
| 63 | index 44b24bb..9009b4d 100644 |
| 64 | --- a/src/usr/targeting/common/Targets.pm |
| 65 | +++ b/src/usr/targeting/common/Targets.pm |
| 66 | @@ -1708,18 +1708,6 @@ sub getBusAttribute |
| 67 | ->{default}; |
| 68 | } |
| 69 | |
| 70 | -## returns a boolean for if a given bus attribute is defined |
| 71 | -sub isBusAttributeDefined |
| 72 | -{ |
| 73 | - my $self = shift; |
| 74 | - my $target = shift; |
| 75 | - my $busnum = shift; |
| 76 | - my $attr = shift; |
| 77 | - my $target_ptr = $self->getTarget($target); |
| 78 | - |
| 79 | - return defined($target_ptr->{CONNECTION}->{BUS}->[$busnum]->{bus_attribute} |
| 80 | - ->{$attr}->{default}); |
| 81 | -} |
| 82 | |
| 83 | ## returns a pointer to an array of children target names |
| 84 | sub getTargetChildren |
| 85 | @@ -2059,10 +2047,6 @@ to value C<VALUE>. This is for complex attributes. |
| 86 | Gets the attribute C<ATTRIBUTE_NAME> from bus C<TARGET_STRING> bus number |
| 87 | C<INDEX>. |
| 88 | |
| 89 | -=item isBusAttributeDefined(C<TARGET_STRING>,C<INDEX>.C<ATTRIBUTE_NAME>) |
| 90 | - |
| 91 | -Looks for a specific attribute and returns if it exists or not |
| 92 | - |
| 93 | =item getTargetChildren(C<TARGET_STRING>) |
| 94 | |
| 95 | Returns an array of target strings representing all the children of target |
| 96 | diff --git a/src/usr/targeting/common/processMrw.pl b/src/usr/targeting/common/processMrw.pl |
| 97 | index 97d9901..fd6fbad 100644 |
| 98 | --- a/src/usr/targeting/common/processMrw.pl |
| 99 | +++ b/src/usr/targeting/common/processMrw.pl |
| 100 | @@ -477,15 +477,6 @@ sub processProcessor |
| 101 | $targetObj->setMasterProc($target); |
| 102 | } |
| 103 | |
| 104 | - # I2C arrays |
| 105 | - my @engine = (); |
| 106 | - my @port = (); |
| 107 | - my @slavePort = (); |
| 108 | - my @addr = (); |
| 109 | - my @speed = (); |
| 110 | - my @type = (); |
| 111 | - my @purpose = (); |
| 112 | - |
| 113 | $targetObj->log($target, "Processing PROC"); |
| 114 | foreach my $child (@{ $targetObj->getTargetChildren($target) }) |
| 115 | { |
| 116 | @@ -537,58 +528,8 @@ sub processProcessor |
| 117 | { |
| 118 | processOcc($targetObj, $child, $target); |
| 119 | } |
| 120 | - # Ideally this should be $child_type eq "I2C", but we need a change |
| 121 | - # in serverwiz and the witherspoon.xml first |
| 122 | - elsif (index($child,"i2c-master") != -1) |
| 123 | - { |
| 124 | - my ($i2cEngine, $i2cPort, $i2cSlavePort, $i2cAddr, |
| 125 | - $i2cSpeed, $i2cType, $i2cPurpose) = |
| 126 | - processI2C($targetObj, $child, $target); |
| 127 | - |
| 128 | - # Add this I2C device's information to the proc array |
| 129 | - push(@engine,@$i2cEngine); |
| 130 | - push(@port,@$i2cPort); |
| 131 | - push(@slavePort,@$i2cSlavePort); |
| 132 | - push(@addr,@$i2cAddr); |
| 133 | - push(@speed,@$i2cSpeed); |
| 134 | - push(@type,@$i2cType); |
| 135 | - push(@purpose,@$i2cPurpose); |
| 136 | - |
| 137 | - } |
| 138 | } |
| 139 | |
| 140 | - # Add final I2C arrays to processor |
| 141 | - my $size = scalar @engine; |
| 142 | - my $engine_attr = $engine[0]; |
| 143 | - my $port_attr = $port[0]; |
| 144 | - my $slave_attr = $slavePort[0]; |
| 145 | - my $addr_attr = $addr[0]; |
| 146 | - my $speed_attr = $speed[0]; |
| 147 | - my $type_attr = "0x".$type[0]; |
| 148 | - my $purpose_attr = "0x".$purpose[0]; |
| 149 | - |
| 150 | - # Parse out array to print as a string |
| 151 | - foreach my $n (1..($size-1)) |
| 152 | - { |
| 153 | - $engine_attr .= ",".$engine[$n]; |
| 154 | - $port_attr .= ",".$port[$n]; |
| 155 | - $slave_attr .= ",".$slavePort[$n]; |
| 156 | - $addr_attr .= ",".$addr[$n]; |
| 157 | - $speed_attr .= ",".$speed[$n]; |
| 158 | - $type_attr .= ",0x".$type[$n]; |
| 159 | - $purpose_attr .= ",0x".$purpose[$n]; |
| 160 | - } |
| 161 | - |
| 162 | - # Set the arrays to the corresponding attribute on the proc |
| 163 | - $targetObj->setAttribute($target,"HDAT_I2C_ENGINE",$engine_attr); |
| 164 | - $targetObj->setAttribute($target,"HDAT_I2C_MASTER_PORT",$port_attr); |
| 165 | - $targetObj->setAttribute($target,"HDAT_I2C_SLAVE_PORT",$slave_attr); |
| 166 | - $targetObj->setAttribute($target,"HDAT_I2C_ADDR",$addr_attr); |
| 167 | - $targetObj->setAttribute($target,"HDAT_I2C_BUS_FREQ",$speed_attr); |
| 168 | - $targetObj->setAttribute($target,"HDAT_I2C_DEVICE_TYPE",$type_attr); |
| 169 | - $targetObj->setAttribute($target,"HDAT_I2C_DEVICE_PURPOSE",$purpose_attr); |
| 170 | - $targetObj->setAttribute($target,"HDAT_I2C_ELEMENTS",$size); |
| 171 | - |
| 172 | ## update path for mvpd's and sbe's |
| 173 | my $path = $targetObj->getAttribute($target, "PHYS_PATH"); |
| 174 | my $model = $targetObj->getAttribute($target, "MODEL"); |
| 175 | @@ -1290,137 +1231,6 @@ sub getI2cMapField |
| 176 | return $hexfield; |
| 177 | } |
| 178 | |
| 179 | -#------------------------------------------------------------------------------ |
| 180 | -# I2C |
| 181 | -# |
| 182 | -sub processI2C |
| 183 | -{ |
| 184 | - my $targetObj = shift; # Top Hierarchy of targeting structure |
| 185 | - my $target = shift; # I2C targetInstance |
| 186 | - my $parentTarget = shift; # Processor target |
| 187 | - |
| 188 | - # Initialize output arrays |
| 189 | - my @i2cEngine = (); |
| 190 | - my @i2cPort = (); |
| 191 | - my @i2cSlave = (); |
| 192 | - my @i2cAddr = (); |
| 193 | - my @i2cSpeed = (); |
| 194 | - my @i2cType = (); |
| 195 | - my @i2cPurpose = (); |
| 196 | - |
| 197 | - # Step 1: get I2C_ENGINE and PORT from <targetInstance> |
| 198 | - |
| 199 | - my $engine = $targetObj->getAttribute($target, "I2C_ENGINE"); |
| 200 | - if($engine eq "") {$engine = "0xFF";} |
| 201 | - |
| 202 | - my $port = $targetObj->getAttribute($target, "I2C_PORT"); |
| 203 | - if($port eq "") {$port = "0xFF";} |
| 204 | - |
| 205 | - # Step 2: get I2C_ADDRESS and I2C_SPEED from <bus> |
| 206 | - # This is different for each connection. |
| 207 | - |
| 208 | - my $i2cs = $targetObj->findConnections($parentTarget, "I2C",""); |
| 209 | - if ($i2cs ne "") |
| 210 | - { |
| 211 | - # This gives all i2c connections |
| 212 | - foreach my $i2c (@{$i2cs->{CONN}}) |
| 213 | - { |
| 214 | - # Here we are checking that the i2c source matches our target |
| 215 | - my $source = $i2c->{SOURCE}; |
| 216 | - if ($source ne $target) |
| 217 | - { |
| 218 | - next; |
| 219 | - } |
| 220 | - |
| 221 | - # Most I2C devices will default the slave port, it is only valid |
| 222 | - # for gpio expanders. |
| 223 | - my $slavePort = "0xFF"; |
| 224 | - |
| 225 | - my @source_array = split(/-/,$source); |
| 226 | - my $source_idx = scalar @source_array; |
| 227 | - |
| 228 | - # If the last part of the source only includes numbers |
| 229 | - if($source_array[$source_idx-1] =~ /^[0-9,.E]+$/) |
| 230 | - { |
| 231 | - $slavePort = $source_array[$source_idx-1]; |
| 232 | - } |
| 233 | - |
| 234 | - my $addr; |
| 235 | - my $speed; |
| 236 | - my $type; |
| 237 | - my $purpose; |
| 238 | - |
| 239 | - # For all these attributes, we need to check if they're defined, |
| 240 | - # and if not we set them to a default value. |
| 241 | - if ($targetObj->isBusAttributeDefined( |
| 242 | - $i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_ADDRESS")) |
| 243 | - { |
| 244 | - $addr = $targetObj->getBusAttribute( |
| 245 | - $i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_ADDRESS"); |
| 246 | - } |
| 247 | - |
| 248 | - if ($addr eq "") {$addr = "0xFF";} |
| 249 | - |
| 250 | - if ($targetObj->isBusAttributeDefined( |
| 251 | - $i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_SPEED")) |
| 252 | - { |
| 253 | - $speed = $targetObj->getBusAttribute( |
| 254 | - $i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_SPEED"); |
| 255 | - } |
| 256 | - |
| 257 | - if ($speed eq "") {$speed = "0";} |
| 258 | - |
| 259 | - if ($targetObj->isBusAttributeDefined( |
| 260 | - $i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_TYPE")) |
| 261 | - { |
| 262 | - $type = $targetObj->getBusAttribute( |
| 263 | - $i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_TYPE"); |
| 264 | - } |
| 265 | - |
| 266 | - if ($type eq "") |
| 267 | - { |
| 268 | - $type = "FF"; |
| 269 | - } |
| 270 | - else |
| 271 | - { |
| 272 | - $type = $targetObj->getEnumValue("HDAT_I2C_DEVICE_TYPE",$type); |
| 273 | - } |
| 274 | - |
| 275 | - if ($targetObj->isBusAttributeDefined( |
| 276 | - $i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_PURPOSE")) |
| 277 | - { |
| 278 | - $purpose = $targetObj->getBusAttribute( |
| 279 | - $i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_PURPOSE"); |
| 280 | - } |
| 281 | - |
| 282 | - if ($purpose eq "") |
| 283 | - { |
| 284 | - $purpose = "FF"; |
| 285 | - } |
| 286 | - else |
| 287 | - { |
| 288 | - $purpose = $targetObj->getEnumValue("HDAT_I2C_DEVICE_PURPOSE", |
| 289 | - $purpose); |
| 290 | - } |
| 291 | - |
| 292 | - # Step 3: For each connection, create an instance in the array |
| 293 | - # for the DeviceInfo_t struct. |
| 294 | - push @i2cEngine, $engine; |
| 295 | - push @i2cPort, $port; |
| 296 | - push @i2cSlave, $slavePort; |
| 297 | - push @i2cAddr, $addr; |
| 298 | - push @i2cSpeed, $speed; |
| 299 | - push @i2cType, $type; |
| 300 | - push @i2cPurpose, $purpose; |
| 301 | - |
| 302 | - } |
| 303 | - } |
| 304 | - |
| 305 | - # Return this i2c device's information back to the processor |
| 306 | - return (\@i2cEngine, \@i2cPort, \@i2cSlave, \@i2cAddr, |
| 307 | - \@i2cSpeed, \@i2cType, \@i2cPurpose); |
| 308 | -} |
| 309 | - |
| 310 | |
| 311 | sub setEepromAttributes |
| 312 | { |
| 313 | diff --git a/src/usr/targeting/common/xmltohb/attribute_types_openpower.xml b/src/usr/targeting/common/xmltohb/attribute_types_openpower.xml |
| 314 | index e40f8eb..841d3d2 100644 |
| 315 | --- a/src/usr/targeting/common/xmltohb/attribute_types_openpower.xml |
| 316 | +++ b/src/usr/targeting/common/xmltohb/attribute_types_openpower.xml |
| 317 | @@ -191,7 +191,7 @@ |
| 318 | </attribute> |
| 319 | |
| 320 | <attribute> |
| 321 | - <id>HDAT_I2C_DEVICE_TYPE</id> |
| 322 | + <id>HDAT_I2C_DEVTYPE</id> |
| 323 | <description> |
| 324 | This attribute holds the values of the I2C device type from the i2c |
| 325 | device connections as defined in the MRW. It is parsed into a |
| 326 | @@ -255,7 +255,7 @@ |
| 327 | </attribute> |
| 328 | |
| 329 | <attribute> |
| 330 | - <id>HDAT_I2C_DEVICE_PURPOSE</id> |
| 331 | + <id>HDAT_I2C_DEV_PURPOSE</id> |
| 332 | <description> |
| 333 | This attribute holds the values of the I2C device purpose from the i2c |
| 334 | device connections as defined in the MRW. It is parsed into a |
| 335 | diff --git a/src/usr/targeting/common/xmltohb/target_types_openpower.xml b/src/usr/targeting/common/xmltohb/target_types_openpower.xml |
| 336 | index 6efbbd1..548c559 100644 |
| 337 | --- a/src/usr/targeting/common/xmltohb/target_types_openpower.xml |
| 338 | +++ b/src/usr/targeting/common/xmltohb/target_types_openpower.xml |
| 339 | @@ -32,14 +32,14 @@ |
| 340 | ===================================================================== |
| 341 | --> |
| 342 | <targetTypeExtension> |
| 343 | - <id>chip-processor</id> |
| 344 | + <id>base</id> |
| 345 | <attribute><id>HDAT_I2C_ENGINE</id></attribute> |
| 346 | <attribute><id>HDAT_I2C_MASTER_PORT</id></attribute> |
| 347 | - <attribute><id>HDAT_I2C_DEVICE_TYPE</id></attribute> |
| 348 | + <attribute><id>HDAT_I2C_DEVTYPE</id></attribute> |
| 349 | <attribute><id>HDAT_I2C_ADDR</id></attribute> |
| 350 | <attribute><id>HDAT_I2C_SLAVE_PORT</id></attribute> |
| 351 | <attribute><id>HDAT_I2C_BUS_FREQ</id></attribute> |
| 352 | - <attribute><id>HDAT_I2C_DEVICE_PURPOSE</id></attribute> |
| 353 | + <attribute><id>HDAT_I2C_DEV_PURPOSE</id></attribute> |
| 354 | <attribute><id>HDAT_I2C_ELEMENTS</id></attribute> |
| 355 | <attribute> |
| 356 | <id>IPMI_INSTANCE</id> |
| 357 | -- |
| 358 | 1.8.2.2 |
| 359 | |