diff mbox series

[v3,2/2] smbios: fill wake-up type

Message ID 20240210110648.21977-3-heinrich.schuchardt@canonical.com
State Accepted, archived
Commit 6eca28b61af1835e70a6feb86f86a0b18b1708c6
Delegated to: Tom Rini
Headers show
Series smbios: fill wake-up type | expand

Commit Message

Heinrich Schuchardt Feb. 10, 2024, 11:06 a.m. UTC
We should not use the reserved value 0x00 for the wake up type but
use 0x02 (Unknown).

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
v3:
	use an enum for the constants
v2:
	use wake-up type 'Unknown' as our default
	add more SMBIOS wake-up type constants
---
 include/smbios.h | 27 +++++++++++++++++++++++++++
 lib/smbios.c     |  1 +
 2 files changed, 28 insertions(+)
diff mbox series

Patch

diff --git a/include/smbios.h b/include/smbios.h
index 3df8827b60..a4fda9df7b 100644
--- a/include/smbios.h
+++ b/include/smbios.h
@@ -108,6 +108,33 @@  struct __packed smbios_type0 {
 	char eos[SMBIOS_STRUCT_EOS_BYTES];
 };
 
+/**
+ * enum smbios_wakeup_type - wake-up type
+ *
+ * These constants are used for the Wake-Up Type field in the SMBIOS
+ * System Information (Type 1) structure.
+ */
+enum smbios_wakeup_type {
+	/** @SMBIOS_WAKEUP_TYPE_RESERVED: Reserved */
+	SMBIOS_WAKEUP_TYPE_RESERVED,
+	/** @SMBIOS_WAKEUP_TYPE_OTHER: Other */
+	SMBIOS_WAKEUP_TYPE_OTHER,
+	/** @SMBIOS_WAKEUP_TYPE_UNKNOWN: Unknown */
+	SMBIOS_WAKEUP_TYPE_UNKNOWN,
+	/** @SMBIOS_WAKEUP_TYPE_APM_TIMER: APM Timer */
+	SMBIOS_WAKEUP_TYPE_APM_TIMER,
+	/** @SMBIOS_WAKEUP_TYPE_MODEM_RING: Modem Ring */
+	SMBIOS_WAKEUP_TYPE_MODEM_RING,
+	/** @SMBIOS_WAKEUP_TYPE_LAN_REMOTE: LAN Remote */
+	SMBIOS_WAKEUP_TYPE_LAN_REMOTE,
+	/** @SMBIOS_WAKEUP_TYPE_POWER_SWITCH: Power Switch */
+	SMBIOS_WAKEUP_TYPE_POWER_SWITCH,
+	/** @SMBIOS_WAKEUP_TYPE_PCI_PME: PCI PME# */
+	SMBIOS_WAKEUP_TYPE_PCI_PME,
+	/** @SMBIOS_WAKEUP_TYPE_AC_POWER_RESTORED: AC Power Restored */
+	SMBIOS_WAKEUP_TYPE_AC_POWER_RESTORED,
+};
+
 struct __packed smbios_type1 {
 	u8 type;
 	u8 length;
diff --git a/lib/smbios.c b/lib/smbios.c
index c83af730a9..b190b010f3 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -394,6 +394,7 @@  static int smbios_write_type1(ulong *current, int handle,
 	} else {
 		t->serial_number = smbios_add_prop(ctx, "serial", NULL);
 	}
+	t->wakeup_type = SMBIOS_WAKEUP_TYPE_UNKNOWN;
 	t->sku_number = smbios_add_prop(ctx, "sku", NULL);
 	t->family = smbios_add_prop(ctx, "family", NULL);