diff --git a/sys/dev/efidev/efidev.c b/sys/dev/efidev/efidev.c --- a/sys/dev/efidev/efidev.c +++ b/sys/dev/efidev/efidev.c @@ -56,7 +56,7 @@ (struct efi_get_table_ioc *)addr; void *buf = NULL; - error = efi_copy_table(&egtioc->uuid, egtioc->buf ? &buf : NULL, + error = efi_copy_table((efi_guid_t *)&egtioc->uuid, egtioc->buf ? &buf : NULL, egtioc->buf_len, &egtioc->table_len); if (error != 0 || egtioc->buf == NULL) diff --git a/sys/dev/efidev/efirt.c b/sys/dev/efidev/efirt.c --- a/sys/dev/efidev/efirt.c +++ b/sys/dev/efidev/efirt.c @@ -340,7 +340,7 @@ } static int -get_table(struct uuid *uuid, void **ptr) +get_table(efi_guid_t *guid, void **ptr) { struct efi_cfgtbl *ct; u_long count; @@ -354,7 +354,7 @@ count = efi_systbl->st_entries; ct = efi_cfgtbl; while (count--) { - if (!bcmp(&ct->ct_uuid, uuid, sizeof(*uuid))) { + if (!bcmp(&ct->ct_guid, guid, sizeof(*guid))) { *ptr = ct->ct_data; efi_leave(); return (0); @@ -373,13 +373,13 @@ case TYPE_ESRT: { struct efi_esrt_table *esrt = NULL; - struct uuid uuid = EFI_TABLE_ESRT; + efi_guid_t guid = EFI_TABLE_ESRT; uint32_t fw_resource_count = 0; size_t len = sizeof(*esrt); int error; void *buf; - error = efi_get_table(&uuid, (void **)&esrt); + error = efi_get_table(&guid, (void **)&esrt); if (error != 0) return (error); @@ -415,14 +415,14 @@ } case TYPE_PROP: { - struct uuid uuid = EFI_PROPERTIES_TABLE; + efi_guid_t guid = EFI_PROPERTIES_TABLE; struct efi_prop_table *prop; size_t len = sizeof(*prop); uint32_t prop_len; int error; void *buf; - error = efi_get_table(&uuid, (void **)&prop); + error = efi_get_table(&guid, (void **)&prop); if (error != 0) return (error); @@ -450,10 +450,10 @@ } static int -copy_table(struct uuid *uuid, void **buf, size_t buf_len, size_t *table_len) +copy_table(efi_guid_t *guid, void **buf, size_t buf_len, size_t *table_len) { static const struct known_table { - struct uuid uuid; + efi_guid_t guid; enum efi_table_type type; } tables[] = { { EFI_TABLE_ESRT, TYPE_ESRT }, @@ -464,7 +464,7 @@ int rc; for (table_idx = 0; table_idx < nitems(tables); table_idx++) { - if (!bcmp(&tables[table_idx].uuid, uuid, sizeof(*uuid))) + if (!bcmp(&tables[table_idx].guid, guid, sizeof(*guid))) break; } diff --git a/sys/dev/ipmi/ipmi_smbios.c b/sys/dev/ipmi/ipmi_smbios.c --- a/sys/dev/ipmi/ipmi_smbios.c +++ b/sys/dev/ipmi/ipmi_smbios.c @@ -150,7 +150,7 @@ ipmi_smbios_probe(struct ipmi_get_info *info) { #ifdef ARCH_MAY_USE_EFI - struct uuid efi_smbios; + efi_guid_t efi_smbios = EFI_TABLE_SMBIOS; void *addr_efi; #endif struct smbios_eps *header; @@ -161,7 +161,6 @@ bzero(info, sizeof(struct ipmi_get_info)); #ifdef ARCH_MAY_USE_EFI - efi_smbios = (struct uuid)EFI_TABLE_SMBIOS; if (!efi_get_table(&efi_smbios, &addr_efi)) addr = (vm_paddr_t)addr_efi; #endif diff --git a/sys/dev/smbios/smbios.c b/sys/dev/smbios/smbios.c --- a/sys/dev/smbios/smbios.c +++ b/sys/dev/smbios/smbios.c @@ -76,8 +76,8 @@ smbios_identify (driver_t *driver, device_t parent) { #ifdef ARCH_MAY_USE_EFI - struct uuid efi_smbios = EFI_TABLE_SMBIOS; - struct uuid efi_smbios3 = EFI_TABLE_SMBIOS3; + efi_guid_t efi_smbios = EFI_TABLE_SMBIOS; + efi_guid_t efi_smbios3 = EFI_TABLE_SMBIOS3; void *addr_efi; #endif struct smbios_eps *eps; diff --git a/sys/sys/efi.h b/sys/sys/efi.h --- a/sys/sys/efi.h +++ b/sys/sys/efi.h @@ -35,15 +35,15 @@ #define EFI_PAGE_MASK (EFI_PAGE_SIZE - 1) #define EFI_TABLE_SMBIOS \ - {0xeb9d2d31,0x2d88,0x11d3,0x9a,0x16,{0x00,0x90,0x27,0x3f,0xc1,0x4d}} + {0xeb9d2d31,0x2d88,0x11d3,{0x9a,0x16,0x00,0x90,0x27,0x3f,0xc1,0x4d}} #define EFI_TABLE_SMBIOS3 \ - {0xf2fd1544,0x9794,0x4a2c,0x99,0x2e,{0xe5,0xbb,0xcf,0x20,0xe3,0x94}} + {0xf2fd1544,0x9794,0x4a2c,{0x99,0x2e,0xe5,0xbb,0xcf,0x20,0xe3,0x94}} #define EFI_TABLE_ESRT \ - {0xb122a263,0x3661,0x4f68,0x99,0x29,{0x78,0xf8,0xb0,0xd6,0x21,0x80}} + {0xb122a263,0x3661,0x4f68,{0x99,0x29,0x78,0xf8,0xb0,0xd6,0x21,0x80}} #define EFI_PROPERTIES_TABLE \ - {0x880aaca3,0x4adc,0x4a04,0x90,0x79,{0xb7,0x47,0x34,0x08,0x25,0xe5}} + {0x880aaca3,0x4adc,0x4a04,{0x90,0x79,0xb7,0x47,0x34,0x08,0x25,0xe5}} #define LINUX_EFI_MEMRESERVE_TABLE \ - {0x888eb0c6,0x8ede,0x4ff5,0xa8,0xf0,{0x9a,0xee,0x5c,0xb9,0x77,0xc2}} + {0x888eb0c6,0x8ede,0x4ff5,{0xa8,0xf0,0x9a,0xee,0x5c,0xb9,0x77,0xc2}} enum efi_reset { EFI_RESET_COLD = 0, @@ -54,8 +54,20 @@ typedef uint16_t efi_char; typedef unsigned long efi_status; +/* + * This type-puns to a struct uuid, but all the EDK2 headers use this variation, + * and we use it in the loader to specify GUIDs. We define it here so that we + * can use EDK2 definitions both places. + */ +typedef struct efi_guid { + uint32_t Data1; + uint16_t Data2; + uint16_t Data3; + uint8_t Data4[8]; +} efi_guid_t; /* Type puns with GUID and EFI_GUID */ + struct efi_cfgtbl { - struct uuid ct_uuid; + efi_guid_t ct_guid; void *ct_data; }; @@ -246,8 +258,8 @@ * access them. */ int (*rt_ok)(void); - int (*get_table)(struct uuid *, void **); - int (*copy_table)(struct uuid *, void **, size_t, size_t *); + int (*get_table)(efi_guid_t *, void **); + int (*copy_table)(efi_guid_t *, void **, size_t, size_t *); int (*get_time)(struct efi_tm *); int (*get_time_capabilities)(struct efi_tmcap *); int (*reset_system)(enum efi_reset); @@ -271,21 +283,21 @@ return (active_efi_ops->rt_ok()); } -static inline int efi_get_table(struct uuid *uuid, void **ptr) +static inline int efi_get_table(efi_guid_t *guid, void **ptr) { if (active_efi_ops->get_table == NULL) return (ENXIO); - return (active_efi_ops->get_table(uuid, ptr)); + return (active_efi_ops->get_table(guid, ptr)); } -static inline int efi_copy_table(struct uuid *uuid, void **buf, +static inline int efi_copy_table(efi_guid_t *guid, void **buf, size_t buf_len, size_t *table_len) { if (active_efi_ops->copy_table == NULL) return (ENXIO); - return (active_efi_ops->copy_table(uuid, buf, buf_len, table_len)); + return (active_efi_ops->copy_table(guid, buf, buf_len, table_len)); } static inline int efi_get_time(struct efi_tm *tm) diff --git a/usr.sbin/efitable/efitable.c b/usr.sbin/efitable/efitable.c --- a/usr.sbin/efitable/efitable.c +++ b/usr.sbin/efitable/efitable.c @@ -46,8 +46,6 @@ static void efi_table_print_prop(const void *data); static void usage(void) __dead2; -typedef uuid_t efi_guid_t; /* Typedef for future efi_guid_t */ - struct efi_table_op { char name[TABLE_MAX_LEN]; void (*parse) (const void *);