aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2014-04-07 15:48:12 -0400
committerKevin O'Connor <kevin@koconnor.net>2014-04-07 15:48:12 -0400
commitd18c9f04e2725513a314446d4ddc18e10e19cdbe (patch)
treec4c0693865cda8ca068e4f755953817708b98f6e /src
parent836b4d8a3888307f8b5d6b02044bafcb29c245ed (diff)
downloadseabios-hppa-d18c9f04e2725513a314446d4ddc18e10e19cdbe.zip
seabios-hppa-d18c9f04e2725513a314446d4ddc18e10e19cdbe.tar.gz
seabios-hppa-d18c9f04e2725513a314446d4ddc18e10e19cdbe.tar.bz2
smbios: Move smbios parsing logic from smbios.c to biostables.c.
After this change, src/fw/smbios.c only contains the legacy code for generating SMBIOS tables. This change only contains code movement - no logic is changed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r--src/fw/biostables.c71
-rw-r--r--src/fw/smbios.c70
-rw-r--r--src/util.h4
3 files changed, 73 insertions, 72 deletions
diff --git a/src/fw/biostables.c b/src/fw/biostables.c
index b2a7231..48325a4 100644
--- a/src/fw/biostables.c
+++ b/src/fw/biostables.c
@@ -231,6 +231,8 @@ find_acpi_features(void)
* SMBIOS
****************************************************************/
+struct smbios_entry_point *SMBiosAddr;
+
void
copy_smbios(void *pos)
{
@@ -256,6 +258,75 @@ copy_smbios(void *pos)
}
void
+display_uuid(void)
+{
+ u32 addr, end;
+ u8 *uuid;
+ u8 empty_uuid[16] = { 0 };
+
+ if (SMBiosAddr == NULL)
+ return;
+
+ addr = SMBiosAddr->structure_table_address;
+ end = addr + SMBiosAddr->structure_table_length;
+
+ /* the following takes care of any initial wraparound too */
+ while (addr < end) {
+ const struct smbios_structure_header *hdr;
+
+ /* partial structure header */
+ if (end - addr < sizeof(struct smbios_structure_header))
+ return;
+
+ hdr = (struct smbios_structure_header *)addr;
+
+ /* partial structure */
+ if (end - addr < hdr->length)
+ return;
+
+ /* any Type 1 structure version will do that has the UUID */
+ if (hdr->type == 1 &&
+ hdr->length >= offsetof(struct smbios_type_1, uuid) + 16)
+ break;
+
+ /* done with formatted area, skip string-set */
+ addr += hdr->length;
+
+ while (end - addr >= 2 &&
+ (*(u8 *)addr != '\0' ||
+ *(u8 *)(addr+1) != '\0'))
+ ++addr;
+
+ /* structure terminator not found */
+ if (end - addr < 2)
+ return;
+
+ addr += 2;
+ }
+
+ /* parsing finished or skipped entirely, UUID not found */
+ if (addr >= end)
+ return;
+
+ uuid = (u8 *)(addr + offsetof(struct smbios_type_1, uuid));
+ 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]);
+}
+
+
+void
copy_table(void *pos)
{
copy_pir(pos);
diff --git a/src/fw/smbios.c b/src/fw/smbios.c
index 0c6a5b2..902e8ab 100644
--- a/src/fw/smbios.c
+++ b/src/fw/smbios.c
@@ -15,8 +15,6 @@
#include "util.h" // MaxCountCPUs
#include "x86.h" // cpuid
-struct smbios_entry_point *SMBiosAddr;
-
static void
smbios_entry_point_setup(u16 max_structure_size,
u16 structure_table_length,
@@ -589,71 +587,3 @@ smbios_setup(void)
smbios_entry_point_setup(max_struct_size, p - start, start, nr_structs);
free(start);
}
-
-void
-display_uuid(void)
-{
- u32 addr, end;
- u8 *uuid;
- u8 empty_uuid[16] = { 0 };
-
- if (SMBiosAddr == NULL)
- return;
-
- addr = SMBiosAddr->structure_table_address;
- end = addr + SMBiosAddr->structure_table_length;
-
- /* the following takes care of any initial wraparound too */
- while (addr < end) {
- const struct smbios_structure_header *hdr;
-
- /* partial structure header */
- if (end - addr < sizeof(struct smbios_structure_header))
- return;
-
- hdr = (struct smbios_structure_header *)addr;
-
- /* partial structure */
- if (end - addr < hdr->length)
- return;
-
- /* any Type 1 structure version will do that has the UUID */
- if (hdr->type == 1 &&
- hdr->length >= offsetof(struct smbios_type_1, uuid) + 16)
- break;
-
- /* done with formatted area, skip string-set */
- addr += hdr->length;
-
- while (end - addr >= 2 &&
- (*(u8 *)addr != '\0' ||
- *(u8 *)(addr+1) != '\0'))
- ++addr;
-
- /* structure terminator not found */
- if (end - addr < 2)
- return;
-
- addr += 2;
- }
-
- /* parsing finished or skipped entirely, UUID not found */
- if (addr >= end)
- return;
-
- uuid = (u8 *)(addr + offsetof(struct smbios_type_1, uuid));
- 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]);
-}
diff --git a/src/util.h b/src/util.h
index 2201da2..088437b 100644
--- a/src/util.h
+++ b/src/util.h
@@ -70,7 +70,9 @@ void *find_acpi_rsdp(void);
u32 find_resume_vector(void);
void acpi_reboot(void);
void find_acpi_features(void);
+extern struct smbios_entry_point *SMBiosAddr;
void copy_smbios(void *pos);
+void display_uuid(void);
void copy_table(void *pos);
// fw/coreboot.c
@@ -109,9 +111,7 @@ void make_bios_readonly(void);
void qemu_prep_reset(void);
// fw/smbios.c
-extern struct smbios_entry_point *SMBiosAddr;
void smbios_setup(void);
-void display_uuid(void);
// fw/smm.c
void smm_device_setup(void);