diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/usr/ipmi/ipmisensor.H | 96 | ||||
-rw-r--r-- | src/usr/devtree/bld_devtree.C | 98 | ||||
-rw-r--r-- | src/usr/ipmi/ipmisensor.C | 75 | ||||
-rw-r--r-- | src/usr/targeting/common/Targets.pm | 2 | ||||
-rw-r--r-- | src/usr/targeting/common/xmltohb/attribute_types_hb.xml | 73 | ||||
-rw-r--r-- | src/usr/targeting/common/xmltohb/target_types_hb.xml | 12 |
6 files changed, 319 insertions, 37 deletions
diff --git a/src/include/usr/ipmi/ipmisensor.H b/src/include/usr/ipmi/ipmisensor.H index 7b4e3fab2..ef00bfa9e 100644 --- a/src/include/usr/ipmi/ipmisensor.H +++ b/src/include/usr/ipmi/ipmisensor.H @@ -48,6 +48,20 @@ namespace SENSOR const uint8_t INVALID_TYPE = 0xFF; /** + * @enum sensorReadingTypes + * Sensor specific completion codes, defined in IPMI Spec. + * + */ + enum sensorReadingType + { + THRESHOLD = 0x01, + DIGITAL_ASSERT_DEASSERT = 0x03, + DIGITAL_ENABLE_DISABLE = 0x09, + SENSOR_SPECIFIC = 0x6f, + }; + + + /** * @enum procStatusSensorOffsets * Sensor specific completion codes, defined in IPMI Spec. * @@ -90,6 +104,74 @@ namespace SENSOR CRITICAL_OVER_TEMP = 0x0A, }; + /** + * @enum firmwareBootProgressSensorOffsets + * Boot progress specific offsets defined in IPMI Spec. + * + */ + enum firmwareProgressSensorOffsets + { + // offset 02h + SYSTEM_FIRMWARE_PROGRESS = 0x02, + }; + + /** + * @enum discrete09_Offsets + * + * Offsets specific to IPMI sensor reading type 09 + * digital discrete senosrs. These offsets result in + * Device Enabled or Device Disabled events in the + * BMC event log. + * + */ + enum discrete09_Offsets + { + // offset 00h + DEVICE_DISABLED = 0x0, + + //offset 01h + DEVICE_ENABLED = 0x1, + }; + + /** + * @enum discrete03_Offsets + * + * Offsets specific to IPMI sensor reading type 03 + * digital discrete senosrs. These offsets result in generic + * State Asserted or State Deasserted events in the + * BMC event log. + * + */ + enum discrete03_Offsets + { + // offset 00h + DEASSERTED = 0x00, + + //offset 01h + ASSERTED = 0x01, + }; + + /** + * @enum acpiPowerState_Offsets + * + * Offsets specific to IPMI ACPI Power state + * senosrs. These offsets result in power + * state messages in the BMC event log. + * + */ + enum acpiPowerState_Offsets + { + // offset 0h + S0_G0_WORKING = 0x00, + + // offset 05h + G5_SOFT_OFF = 0x05, + + //offset 0Bh + LEGACY_ON = 0x0B, + + }; + //** Bit definition for set sensor reading cmd operation field // [7:6] 10b - write given values to event data bytes let BMC handle // offset in event data 1 when an external event is @@ -827,6 +909,20 @@ namespace SENSOR errlHndl_t getAPSSChannelSensorNumbers( const uint16_t (* &o_sensor_numbers)[16]); + /** + * Helper function to return a mask of the supported masks for the + * sensor passed in. + * + * @param[i] - sensor name to determine the offset for. + * @param[o] - sensor reading type, defined in IPMI spec for the + * passed in sensor number. + * + * + * @return sensor offsets + */ + uint16_t getSensorOffsets(TARGETING::SENSOR_NAME i_name, + sensorReadingType &o_readType ); + }; // end namespace diff --git a/src/usr/devtree/bld_devtree.C b/src/usr/devtree/bld_devtree.C index 571bab717..221d7db0e 100644 --- a/src/usr/devtree/bld_devtree.C +++ b/src/usr/devtree/bld_devtree.C @@ -1299,40 +1299,70 @@ errlHndl_t bld_fdt_mem(devTree * i_dt, bool i_smallTree) return errhdl; } + +#ifdef CONFIG_BMC_IPMI +enum +{ + ENTITY_ID_MASK = 0x00FF, + SENSOR_TYPE_MASK = 0xFF00, +}; + /* create a node for each IPMI sensor in the system, the sensor unit number corresponds to the BMC assigned sensor number */ uint32_t bld_sensor_node(devTree * i_dt, const dtOffset_t & i_parentNode, - const uint16_t sensorData[] ) + const uint16_t sensorData[], + uint32_t instance, uint32_t chipId ) { - const uint32_t sensorNumber = sensorData[ + SENSOR::sensorReadingType readType; + + // pass in the sensor name to get back the supported offsets and the event + // reading type for this sensor. + uint32_t offsets = SENSOR::getSensorOffsets( + static_cast<TARGETING::SENSOR_NAME>( + sensorData[TARGETING::IPMI_SENSOR_ARRAY_NAME_OFFSET]), + readType); + + const uint16_t sensorNumber = sensorData[ TARGETING::IPMI_SENSOR_ARRAY_NUMBER_OFFSET]; - const uint32_t sensorName = - sensorData[TARGETING::IPMI_SENSOR_ARRAY_NAME_OFFSET]; + // the sensor name is a combination of the sensor type + entity ID + const uint16_t sensorType = ( + sensorData[TARGETING::IPMI_SENSOR_ARRAY_NAME_OFFSET] + & SENSOR_TYPE_MASK) >> 8; + + const uint16_t entityId = + sensorData[TARGETING::IPMI_SENSOR_ARRAY_NAME_OFFSET] & ENTITY_ID_MASK; /* Build sensor node based on sensor number */ dtOffset_t sensorNode = i_dt->addNode(i_parentNode, "sensor", sensorNumber); + /* compatibility strings -- currently only one */ + const char* compatStr[] = {"ibm,ipmi-sensor", NULL}; + + i_dt->addPropertyStrings(sensorNode, "compatible", compatStr); + i_dt->addPropertyCell32(sensorNode, "reg", sensorNumber); // add sensor type - i_dt->addPropertyCell32(sensorNode, "ipmi-sensor-type", sensorName); - - // @TODO RTC:113902 - // get more info from Ben H. regarding what info he needs - // add the name of the sensor - //i_dt->addPropertyString(sensorNode, "name", sensorToString( sensorName )); - // i_dt->addPropertyCell32(sensorNode, "ipmi-entity-type", - // sensorData[ENTITY_TYPE_OFFSET]); - // i_dt->addPropertyCell32(sensorNode, "ipmi-reading-type", - // sensorData[READING_TYPE_OFFSET]); - - /* return the phandle for this sensor, might need to add it to the - cpus node per Ben H. proposal */ + i_dt->addPropertyCell32(sensorNode, "ipmi-sensor-type", sensorType); + i_dt->addPropertyCell32(sensorNode, "ipmi-entity-id", entityId); + i_dt->addPropertyCell32(sensorNode, "ipmi-entity-instance", instance); + i_dt->addPropertyCell32(sensorNode, "ipmi-sensor-offsets", offsets); + i_dt->addPropertyCell32(sensorNode, "ipmi-sensor-reading-type", readType); + + // currently we only add the chip ID to the OCC sensor + if(chipId != 0xFF ) + { + i_dt->addPropertyCell32(sensorNode, "ibm,chip-id", chipId); + } + + /* return the phandle for this sensor */ return i_dt->getPhandle(sensorNode); } + +// build the sensor node for a given target uint32_t bld_sensor_node(devTree * i_dt, const dtOffset_t & i_sensorNode, TARGETING::Target * i_pTarget ) { @@ -1344,6 +1374,21 @@ uint32_t bld_sensor_node(devTree * i_dt, const dtOffset_t & i_sensorNode, * for each sensor */ if ( i_pTarget->tryGetAttr<ATTR_IPMI_SENSORS>(l_sensors) ) { + uint32_t chipId = 0xFF; + + AttributeTraits<ATTR_IPMI_INSTANCE>::Type l_instance; + + l_instance = i_pTarget->getAttr<TARGETING::ATTR_IPMI_INSTANCE>(); + + // add the chip id to the OCC sensor since OPAL needs it to figure out + // which OCC it is. + if( TARGETING::TYPE_OCC == i_pTarget->getAttr<TARGETING::ATTR_TYPE>()) + { + ConstTargetHandle_t proc = getParentChip(i_pTarget); + + chipId = getProcChipId( proc ); + } + for(uint16_t i=0; i< array_rows; i++) { /* if the sensor number is 0xFF move on */ @@ -1351,7 +1396,8 @@ uint32_t bld_sensor_node(devTree * i_dt, const dtOffset_t & i_sensorNode, { /* use this row to create the next sensor node - ignoring * return value for now */ - bld_sensor_node(i_dt, i_sensorNode, l_sensors[i] ); + bld_sensor_node(i_dt, i_sensorNode, l_sensors[i], + l_instance , chipId ); } else { @@ -1385,19 +1431,10 @@ errlHndl_t bld_fdt_sensors(devTree * i_dt, const dtOffset_t & i_parentNode, i_dt->addPropertyString(sensorNode, "name", sensorNodeName ); - /* compatibility strings -- currently only one */ - const char* compatStr[] = {"ibm,ipmi-sensor", NULL}; - - i_dt->addPropertyStrings(sensorNode, "compatible", compatStr); - /* Add the # address & size cell properties to /sensors node. */ i_dt->addPropertyCell32(sensorNode, "#address-cells", 1); i_dt->addPropertyCell32(sensorNode, "#size-cells", 0); - // pass ALL IPMI_SENSORS to opal - // @TODO RTC:113902 - add remaining sensor info and limit sensors - // and adjust the sensors passed to opal to match their requirements - /* loop through all the targets and get the IPMI sensor data if it exists */ for (TargetIterator itr = TARGETING::targetService().begin(); @@ -1411,7 +1448,6 @@ errlHndl_t bld_fdt_sensors(devTree * i_dt, const dtOffset_t & i_parentNode, return errhdl; } - /* add the BMC node to the device tree, this node will hold any BMC info needed in the device tree */ errlHndl_t bld_fdt_bmc(devTree * i_dt, bool i_smallTree) @@ -1433,11 +1469,6 @@ errlHndl_t bld_fdt_bmc(devTree * i_dt, bool i_smallTree) i_dt->addPropertyCell32(bmcNode, "#address-cells", 1); i_dt->addPropertyCell32(bmcNode, "#size-cells", 0); - /* compatibility strings -- currently only one */ - const char* compatStr[] = {"ibm,ipmi-sensor", NULL}; - - i_dt->addPropertyStrings(bmcNode, "compatible", compatStr); - i_dt->addPropertyString(bmcNode, "name", bmcNodeName ); //Pass Opal their device string @@ -1454,6 +1485,7 @@ errlHndl_t bld_fdt_bmc(devTree * i_dt, bool i_smallTree) return errhdl; } +#endif errlHndl_t bld_fdt_vpd(devTree * i_dt, bool i_smallTree) { diff --git a/src/usr/ipmi/ipmisensor.C b/src/usr/ipmi/ipmisensor.C index 3e15e918e..fe1ace972 100644 --- a/src/usr/ipmi/ipmisensor.C +++ b/src/usr/ipmi/ipmisensor.C @@ -1121,4 +1121,79 @@ namespace SENSOR return NULL; } + uint16_t getSensorOffsets( TARGETING::SENSOR_NAME i_name, + sensorReadingType &o_readType ) + { + + uint16_t offsets = 0; + + // most of our sensors use generic sensor specific reading types + // so use that as the default value + o_readType = SENSOR_SPECIFIC; + + // sensor type is lower byte of sensor name, if we dont match + // based on name, then try the sensor type + uint16_t t = ( i_name >> 8 ) & 0x00FF; + + switch( i_name ) + { + case TARGETING::SENSOR_NAME_FW_BOOT_PROGRESS: + { + offsets = ( 1 << SYSTEM_FIRMWARE_PROGRESS ); + break; + } + case TARGETING::SENSOR_NAME_OCC_ACTIVE: + { + offsets = ( 1 << DEVICE_DISABLED ) | + ( 1 << DEVICE_ENABLED ); + o_readType = DIGITAL_ENABLE_DISABLE; + break; + } + case TARGETING::SENSOR_NAME_HOST_STATUS: + { + offsets = ( 1 << S0_G0_WORKING ) | + ( 1 << G5_SOFT_OFF ) | + ( 1 << LEGACY_ON ); + break; + } + case TARGETING::SENSOR_NAME_PCI_ACTIVE: + case TARGETING::SENSOR_NAME_OS_BOOT: + { + // default all offsets enabled + offsets = 0x7FFF; + break; + } + + default: + { + // try sensor type + switch (t) + { + case TARGETING::SENSOR_TYPE_FAULT: + offsets = ( 1 << ASSERTED ); + o_readType = DIGITAL_ASSERT_DEASSERT; + break; + + case TARGETING::SENSOR_TYPE_PROCESSOR: + offsets = ( 1 << PROC_PRESENCE_DETECTED ) | + ( 1 << PROC_DISABLED ) | + ( 1 << IERR ); + break; + + case TARGETING::SENSOR_TYPE_MEMORY: + offsets = ( 1 << MEMORY_DEVICE_DISABLED ) | + ( 1 << MEM_DEVICE_PRESENCE_DETECTED ); + break; + default: + offsets = 0; + o_readType = THRESHOLD; + break; + } + + } + } + + return offsets; + } + }; // end name space diff --git a/src/usr/targeting/common/Targets.pm b/src/usr/targeting/common/Targets.pm index eb1ea1f86..29f6bcb86 100644 --- a/src/usr/targeting/common/Targets.pm +++ b/src/usr/targeting/common/Targets.pm @@ -195,7 +195,7 @@ sub printAttribute $filter{ENTITY_ID_LOOKUP} = 1; $filter{ENTITY_INSTANCE} = 1; $filter{MBA_NUM} = 1; - $filter{IPMI_INSTANCE} = 1; + $filter{IPMI_INSTANCE} = 0; $filter{IPMI_NAME} = 1; $filter{INSTANCE_ID} = 1; #$filter{ADC_CHANNEL_SENSOR_NUMBERS} = 1; diff --git a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml index 3bb57e6a1..74fb49250 100644 --- a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml +++ b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml @@ -822,6 +822,16 @@ <writeable/> <hbOnly/> </attribute> +<attribute> + <id>IPMI_INSTANCE</id> + <description>Holds the IPMI instance number for this entity.</description> + <simpleType> + <uint32_t> + </uint32_t> + </simpleType> + <persistency>non-volatile</persistency> + <readable/> +</attribute> <enumerationType> <id>ENTITY_ID</id> <description>Enumeration indicating the IPMI entity ID, these values are @@ -1003,6 +1013,69 @@ </enumerator> </enumerationType> +<enumerationType> + <id>SENSOR_TYPE</id> + <description>Enumeration indicating the IPMI sensor type, these values + are defined in the IPMI specification. These values will be used when + sending sensor reading events to the BMC.</description> + <enumerator> + <name>NA</name> + <value>0</value> + </enumerator> + <enumerator> + <name>TEMPERATURE</name> + <value>0x01</value> + </enumerator> + <enumerator> + <name>PROCESSOR</name> + <value>0x07</value> + </enumerator> + <enumerator> + <name>MEMORY</name> + <value>0x0c</value> + </enumerator> + <enumerator> + <name>SYS_FW_PROGRESS</name> + <value>0x0F</value> + </enumerator> + <enumerator> + <name>SYS_EVENT</name> + <value>0x12</value> + </enumerator> + <enumerator> + <name>OS_BOOT</name> + <value>0x1F</value> + </enumerator> + <enumerator> + <name>APCI_POWER_STATE</name> + <value>0x22</value> + </enumerator> + <enumerator> + <name>FREQ</name> + <value>0xC1</value> + </enumerator> + <enumerator> + <name>POWER</name> + <value>0xC2</value> + </enumerator> + <enumerator> + <name>BOOT_COUNT</name> + <value>0xC3</value> + </enumerator> + <enumerator> + <name>PCI_LINK_PRES</name> + <value>0xC4</value> + </enumerator> + <enumerator> + <name>PWR_LIMIT_ACTIVE</name> + <value>0xC4</value> + </enumerator> + <enumerator> + <name>FAULT</name> + <value>0xC7</value> + </enumerator> +</enumerationType> + <!-- IPMI Sensor numbers are defined in the IPMI spec as 8 bit values. However in the hostboot code they will be defined as a uint16_t to allow us to add additonal information. An example relates to error logs returned by the OCC, diff --git a/src/usr/targeting/common/xmltohb/target_types_hb.xml b/src/usr/targeting/common/xmltohb/target_types_hb.xml index 8255b708c..b0429daf0 100644 --- a/src/usr/targeting/common/xmltohb/target_types_hb.xml +++ b/src/usr/targeting/common/xmltohb/target_types_hb.xml @@ -33,6 +33,14 @@ ================================================================= --> <targetTypeExtension> + <id>base</id> + <attribute> + <id>IPMI_INSTANCE</id> + <default>0xFF</default> + </attribute> +</targetTypeExtension> + +<targetTypeExtension> <id>sys-sys-power8</id> <attribute><id>IS_MPIPL_HB</id></attribute> <attribute><id>IBSCOM_ENABLE_OVERRIDE</id></attribute> @@ -182,9 +190,7 @@ <attribute> <id>PSTATE_TABLE</id> </attribute> - <attribute> - <id>IPMI_SENSORS</id> - </attribute> + <attribute><id>IPMI_SENSORS</id></attribute> </targetTypeExtension> <targetTypeExtension> |