diff options
author | Cole Robinson <crobinso@redhat.com> | 2016-01-15 10:49:32 -0500 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2016-01-18 11:13:20 +0100 |
commit | b3ef39f532db52bf17457ba931da758eeb38d6b4 (patch) | |
tree | db007137b6dc389af2375bc71293e64173bf362c | |
parent | 73f00bcf5a32cab610c41fe343b232d521694c56 (diff) | |
download | seabios-hppa-rel-1.9.1.zip seabios-hppa-rel-1.9.1.tar.gz seabios-hppa-rel-1.9.1.tar.bz2 |
biostables: Support SMBIOS 2.6+ UUID formatrel-1.9.1
SMBIOS 2.6+ stores the UUID in a different format, with the first 3
fields in little endian format. This is what modern qemu delivers
and what dmidecode also handles, so let's follow suit too.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 2e11d582b5e14759b3c1482d7e317b4a7257e77d)
-rw-r--r-- | src/fw/biostables.c | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/src/fw/biostables.c b/src/fw/biostables.c index cb74396..9fb9ff9 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -306,17 +306,42 @@ display_uuid(void) if (memcmp(uuid, empty_uuid, sizeof(empty_uuid)) == 0) return; - printf("Machine UUID" - " %02x%02x%02x%02x" - "-%02x%02x" - "-%02x%02x" - "-%02x%02x" - "-%02x%02x%02x%02x%02x%02x\n" - , uuid[ 0], uuid[ 1], uuid[ 2], uuid[ 3] - , uuid[ 4], uuid[ 5] - , uuid[ 6], uuid[ 7] - , uuid[ 8], uuid[ 9] - , uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]); + /* + * According to SMBIOS v2.6 the first three fields are encoded in + * little-endian format. Versions prior to v2.6 did not specify + * the encoding, but we follow dmidecode and assume big-endian + * encoding. + */ + if (SMBiosAddr->smbios_major_version > 2 || + (SMBiosAddr->smbios_major_version == 2 && + SMBiosAddr->smbios_minor_version >= 6)) { + printf("Machine UUID" + " %02x%02x%02x%02x" + "-%02x%02x" + "-%02x%02x" + "-%02x%02x" + "-%02x%02x%02x%02x%02x%02x\n" + , uuid[ 3], uuid[ 2], uuid[ 1], uuid[ 0] + , uuid[ 5], uuid[ 4] + , uuid[ 7], uuid[ 6] + , uuid[ 8], uuid[ 9] + , uuid[10], uuid[11], uuid[12] + , uuid[13], uuid[14], uuid[15]); + } else { + printf("Machine UUID" + " %02x%02x%02x%02x" + "-%02x%02x" + "-%02x%02x" + "-%02x%02x" + "-%02x%02x%02x%02x%02x%02x\n" + , uuid[ 0], uuid[ 1], uuid[ 2], uuid[ 3] + , uuid[ 4], uuid[ 5] + , uuid[ 6], uuid[ 7] + , uuid[ 8], uuid[ 9] + , uuid[10], uuid[11], uuid[12] + , uuid[13], uuid[14], uuid[15]); + } + return; } } |