Browse Source

[smbios] Expose board serial number as ${board-serial}

With blade servers, the chassis serial number (exposed via ${serial})
may not be unique.  Expose ${board-serial} as a named setting to
provide easy access to a more meaningful serial number.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Dale Hamel 10 years ago
parent
commit
7fe0735170
2 changed files with 29 additions and 0 deletions
  1. 17
    0
      src/include/ipxe/smbios.h
  2. 12
    0
      src/interface/smbios/smbios_settings.c

+ 17
- 0
src/include/ipxe/smbios.h View File

@@ -116,6 +116,23 @@ struct smbios_system_information {
116 116
 /** SMBIOS system information structure type */
117 117
 #define SMBIOS_TYPE_SYSTEM_INFORMATION 1
118 118
 
119
+/** SMBIOS base board information structure */
120
+struct smbios_base_board_information {
121
+	/** SMBIOS structure header */
122
+	struct smbios_header header;
123
+	/** Manufacturer string */
124
+	uint8_t manufacturer;
125
+	/** Product string */
126
+	uint8_t product;
127
+	/** Version string */
128
+	uint8_t version;
129
+	/** Serial number string */
130
+	uint8_t serial;
131
+} __attribute__ (( packed ));
132
+
133
+/** SMBIOS base board information structure type */
134
+#define SMBIOS_TYPE_BASE_BOARD_INFORMATION 2
135
+
119 136
 /** SMBIOS enclosure information structure */
120 137
 struct smbios_enclosure_information {
121 138
 	/** SMBIOS structure header */

+ 12
- 0
src/interface/smbios/smbios_settings.c View File

@@ -241,3 +241,15 @@ const struct setting asset_setting __setting ( SETTING_HOST_EXTRA, asset ) = {
241 241
 	.type = &setting_type_string,
242 242
 	.scope = &smbios_settings_scope,
243 243
 };
244
+
245
+/** Board serial number setting (may differ from chassis serial number) */
246
+const struct setting board_serial_setting __setting ( SETTING_HOST_EXTRA,
247
+						      board_serial ) = {
248
+	.name = "board-serial",
249
+	.description = "Base board serial",
250
+	.tag = SMBIOS_STRING_TAG ( SMBIOS_TYPE_BASE_BOARD_INFORMATION,
251
+				   struct smbios_base_board_information,
252
+				   serial ),
253
+	.type = &setting_type_string,
254
+	.scope = &smbios_settings_scope,
255
+};

Loading…
Cancel
Save