mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
smbios: Encode UUID according to SMBIOS specification
Differently from older versions, SMBIOS version 2.6 is explicit about
the encoding of UUID fields:
> Although RFC 4122 recommends network byte order for all fields, the PC
> industry (including the ACPI, UEFI, and Microsoft specifications) has
> consistently used little-endian byte encoding for the first three fields:
> time_low, time_mid, time_hi_and_version. The same encoding, also known as
> wire format, should also be used for the SMBIOS representation of the UUID.
>
> The UUID {00112233-4455-6677-8899-AABBCCDDEEFF} would thus be represented
> as 33 22 11 00 55 44 77 66 88 99 AA BB CC DD EE FF.
The dmidecode tool implements this and decodes the above "wire format"
when SMBIOS version >= 2.6. We moved from SMBIOS version 2.4 to 2.8 when
we started building the SMBIOS entry point inside QEMU, on commit
c97294ec1b
.
Change smbios_build_type_1_table() to encode the UUID as specified.
To make sure we won't change the guest-visible UUID when upgrading to a
newer QEMU version, keep the old behavior on pc-*-2.1 and older.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
2cad57c717
commit
caad057bb6
5 changed files with 48 additions and 7 deletions
|
@ -20,7 +20,8 @@
|
|||
void smbios_entry_add(QemuOpts *opts);
|
||||
void smbios_set_cpuid(uint32_t version, uint32_t features);
|
||||
void smbios_set_defaults(const char *manufacturer, const char *product,
|
||||
const char *version, bool legacy_mode);
|
||||
const char *version, bool legacy_mode,
|
||||
bool uuid_encoded);
|
||||
uint8_t *smbios_get_table_legacy(size_t *length);
|
||||
void smbios_get_tables(uint8_t **tables, size_t *tables_len,
|
||||
uint8_t **anchor, size_t *anchor_len);
|
||||
|
@ -72,6 +73,18 @@ struct smbios_type_0 {
|
|||
uint8_t embedded_controller_minor_release;
|
||||
} QEMU_PACKED;
|
||||
|
||||
/* UUID encoding. The time_* fields are little-endian, as specified by SMBIOS
|
||||
* version 2.6.
|
||||
*/
|
||||
struct smbios_uuid {
|
||||
uint32_t time_low;
|
||||
uint16_t time_mid;
|
||||
uint16_t time_hi_and_version;
|
||||
uint8_t clock_seq_hi_and_reserved;
|
||||
uint8_t clock_seq_low;
|
||||
uint8_t node[6];
|
||||
} QEMU_PACKED;
|
||||
|
||||
/* SMBIOS type 1 - System Information */
|
||||
struct smbios_type_1 {
|
||||
struct smbios_structure_header header;
|
||||
|
@ -79,7 +92,7 @@ struct smbios_type_1 {
|
|||
uint8_t product_name_str;
|
||||
uint8_t version_str;
|
||||
uint8_t serial_number_str;
|
||||
uint8_t uuid[16];
|
||||
struct smbios_uuid uuid;
|
||||
uint8_t wake_up_type;
|
||||
uint8_t sku_number_str;
|
||||
uint8_t family_str;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue