diff options
author | Cédric Le Goater <clg@fr.ibm.com> | 2015-12-11 17:59:12 +0100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-03-08 21:12:48 +1100 |
commit | 1303a6ae1c9812e6c48f6e6a6ae93dcc3ad5b62c (patch) | |
tree | 16629a8a350ed61a7793ec0851a81a0c8b5b775c | |
parent | bef1de4659c8a1463a0a7f3868d9c80c3ebbc29c (diff) | |
download | blackbird-skiboot-1303a6ae1c9812e6c48f6e6a6ae93dcc3ad5b62c.tar.gz blackbird-skiboot-1303a6ae1c9812e6c48f6e6a6ae93dcc3ad5b62c.zip |
spcn: add definitions for the PRS command and modifiers
The structures and values from the SPCN specification document plus
the new PRS modifier 0x1C to retrieve the power supplies watts.
Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | include/spcn.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/include/spcn.h b/include/spcn.h index 1945e8d4..2f317281 100644 --- a/include/spcn.h +++ b/include/spcn.h @@ -90,4 +90,98 @@ enum { SENSOR_FRC_IO_BP, }; +/* + * Common to all PRS modifiers (subcommands) + */ +struct sensor_header { + uint16_t frc; /* Frame resource class */ + uint16_t rid; /* Resource ID */ +} __packed; + +/* + * Data layout for PRS modifier PRS_STATUS 0x01, 0x02 + */ +struct sensor_prs { + struct sensor_header header; + uint16_t src; /* unused */ + uint16_t status; +} __packed; + +#define PRS_STATUS_ON_SUPPORTED 0x0010 +#define PRS_STATUS_ON 0x0008 +#define PRS_STATUS_AC_FAULTED 0x0004 +#define PRS_STATUS_FAULTED 0x0002 +#define PRS_STATUS_PRESENT 0x0001 + +/* + * Data layout for PRS modifier SENSOR_PARAM 0x10, 0x11 + */ +struct sensor_param { + struct sensor_header header; + char location[4]; + char __reserved[4]; + uint16_t threshold; + uint16_t status; +} __packed; + +/* + * Data layout for PRS modifier SENSOR_DATA 0x12, 0x13 + */ +struct sensor_data { + struct sensor_header header; + uint16_t data; + uint16_t status; +} __packed; + +#define SENSOR_STATUS_EM_ALERT 0x0004 +#define SENSOR_STATUS_FAULTED 0x0002 +#define SENSOR_STATUS_PRESENT 0x0001 + +/* Power sensor is retrieved thru a new PRS modifier 0x1C, data + * response is as follows: + * + * Byte 0: + * + * Bit 7: Data valid + * Bit 4-6: reserved + * Bit 0-3: Number of power supply or data records + * + * Each data record is 5 Bytes following above byte 0: + * + * Data Record: Byte 0: Power supply ID {00, 01, 02, 03, ...} + * Byte 1-4: Power sensor value in milli-watts + * + * Example Power Sensor data: (Tuleta) + * 84 00 00 00 00 00 + * 01 00 00 00 00 + * 02 00 02 5d 78 + * 03 00 02 0f 58 + * 00 00 00 00 00 + * + * 0x84: Bit 7 is valid bit and there are 4 power supplies + * 0x00 00 00 00 00 + * | ^^^^^^^^^^^ Power in milli-watts + * \-- Power supply ID + * + * Ox03 00 02 0f 58 + * | ^^^^^^^^^^^ Power in milli-watts (135000 mW) + * \-- Power supply ID + */ + +#define POWER_SUPPLY_MAX 8 + +struct sensor_power_supply { + uint8_t rid; /* Power supply ID */ + uint32_t milliwatts; +} __packed; + +struct sensor_power { + uint8_t status; + struct sensor_power_supply supplies[POWER_SUPPLY_MAX]; +} __packed; + +#define sensor_power_is_valid(s) ((s)->status & 0x80) +#define sensor_power_count(s) ((s)->status & 0x0f) + + #endif /* __SPCN_H */ |