aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorJonathan Zhang <jonzhang@meta.com>2022-10-14 17:06:26 -0700
committerMartin Roth <martin.roth@amd.corp-partner.google.com>2022-11-17 21:17:49 +0000
commitd57b82111a87767184405cffc1bad3ef58925a6c (patch)
tree6ff54776c87861bee613d2af736238e8e71dac0b /src/include
parent0f5b87cf95992ffddb9bc9bd08ee4d6af046bd92 (diff)
arch/x86/smbios: Add SMBIOS Type 39
Read FRU product info of PSU to get Type 39 required information. Further development needed if multi-record info of PSU FRU is required. For now, the read_fru_areas() only read product chassis and board info. Signed-off-by: lichenchen.carl <lichenchen.carl@bytedance.com> Signed-off-by: ziang <ziang.wang@intel.com> Signed-off-by: Jonathan Zhang <jonzhang@meta.com> Change-Id: I18d056cba1a79b0775c8a42b3a879e819887adca Reviewed-on: https://review.coreboot.org/c/coreboot/+/68443 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Shuming Chu (Shuming) <s1218944@gmail.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Christian Walter <christian.walter@9elements.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/smbios.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/include/smbios.h b/src/include/smbios.h
index cb317b03a3..9217f5eaa0 100644
--- a/src/include/smbios.h
+++ b/src/include/smbios.h
@@ -270,6 +270,7 @@ typedef enum {
SMBIOS_TEMPERATURE_PROBE = 28,
SMBIOS_SYSTEM_BOOT_INFORMATION = 32,
SMBIOS_IPMI_DEVICE_INFORMATION = 38,
+ SMBIOS_SYSTEM_POWER_SUPPLY = 39,
SMBIOS_ONBOARD_DEVICES_EXTENDED_INFORMATION = 41,
SMBIOS_TPM_DEVICE = 43,
SMBIOS_END_OF_TABLE = 127,
@@ -1013,6 +1014,69 @@ enum smbios_bmc_interface_type {
};
typedef enum {
+ PowerSupplyTypeOther = 1,
+ PowerSupplyTypeUnknown = 2,
+ PowerSupplyTypeLinear = 3,
+ PowerSupplyTypeSwitching = 4,
+ PowerSupplyTypeBattery = 5,
+ PowerSupplyTypeUps = 6,
+ PowerSupplyTypeConverter = 7,
+ PowerSupplyTypeRegulator = 8
+} power_supply_type;
+
+typedef enum {
+ PowerSupplyStatusOther = 1,
+ PowerSupplyStatusUnknown = 2,
+ PowerSupplyStatusOk = 3,
+ PowerSupplyStatusNonCritical = 4,
+ PowerSupplyStatusCritical = 5
+} power_supply_status;
+
+typedef enum {
+ PowerSupplyInputVoltageRangeSwitchingOther = 1,
+ PowerSupplyInputVoltageRangeSwitchingUnknown = 2,
+ PowerSupplyInputVoltageRangeSwitchingManual = 3,
+ PowerSupplyInputVoltageRangeSwitchingAutoSwitch = 4,
+ PowerSupplyInputVoltageRangeSwitchingWideRange = 5,
+ PowerSupplyInputVoltageRangeSwitchingNotApplicable = 6
+} power_supply_input_voltage_range_switching;
+
+struct power_supply_ch {
+ u16 reserved :2;
+ u16 power_supply_type :4;
+ u16 power_supply_status :3;
+ u16 input_voltage_range_switch :4;
+ u16 power_supply_unplugged :1;
+ u16 power_supply_present :1;
+ u16 power_supply_hot_replaceble :1;
+};
+
+struct smbios_type39 {
+ struct smbios_header header;
+ u8 power_unit_group;
+ u8 location;
+ u8 device_name;
+ u8 manufacturer;
+ u8 serial_number;
+ u8 asset_tag_number;
+ u8 model_part_number;
+ u8 revision_level;
+ u16 max_power_capacity;
+ u16 power_supply_characteristics;
+ u16 input_voltage_probe_handle;
+ u16 cooling_device_handle;
+ u16 input_current_probe_handle;
+ u8 eos[2];
+} __packed;
+
+int smbios_write_type39(unsigned long *current, int *handle,
+ u8 unit_group, const char *loc, const char *dev_name,
+ const char *man, const char *serial_num,
+ const char *tag_num, const char *part_num,
+ const char *rev_lvl, u16 max_pow_cap,
+ const struct power_supply_ch *ps_ch);
+
+typedef enum {
SMBIOS_DEVICE_TYPE_OTHER = 0x01,
SMBIOS_DEVICE_TYPE_UNKNOWN,
SMBIOS_DEVICE_TYPE_VIDEO,