zefi: Expose EFI configuration lookup function
This will be useful to get various information such as ACPI table pointer etc... Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
27df16ea8e
commit
c7090c5ee6
2 changed files with 47 additions and 4 deletions
|
@ -30,10 +30,20 @@
|
|||
typedef uintptr_t efi_status_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t Data1;
|
||||
uint16_t Data2;
|
||||
uint16_t Data3;
|
||||
uint8_t Data4[8];
|
||||
union {
|
||||
struct {
|
||||
uint32_t Data1;
|
||||
uint16_t Data2;
|
||||
uint16_t Data3;
|
||||
uint8_t Data4[8];
|
||||
};
|
||||
|
||||
/* Easier for comparison */
|
||||
struct {
|
||||
uint64_t Part1;
|
||||
uint64_t Part2;
|
||||
};
|
||||
};
|
||||
} efi_guid_t;
|
||||
|
||||
struct efi_input_key {
|
||||
|
@ -547,7 +557,9 @@ struct efi_boot_services {
|
|||
};
|
||||
|
||||
struct efi_configuration_table {
|
||||
/** Vendor EFI GUID Identifier */
|
||||
efi_guid_t VendorGuid;
|
||||
/** Vendor table pointer */
|
||||
void *VendorTable;
|
||||
};
|
||||
|
||||
|
@ -563,7 +575,9 @@ struct efi_system_table {
|
|||
struct efi_simple_text_output *StdErr;
|
||||
struct efi_runtime_services *RuntimeServices;
|
||||
struct efi_boot_services *BootServices;
|
||||
/** The amount of entries to expect in the next attribute */
|
||||
uint64_t NumberOfTableEntries;
|
||||
/** A pointer to the configuration table(s) */
|
||||
struct efi_configuration_table *ConfigurationTable;
|
||||
};
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include "efi.h"
|
||||
#include "printf.h"
|
||||
#include <zefi-segments.h>
|
||||
|
@ -42,6 +44,33 @@ static void efi_putchar(int c)
|
|||
}
|
||||
}
|
||||
|
||||
static inline bool efi_guid_compare(efi_guid_t *s1, efi_guid_t *s2)
|
||||
{
|
||||
return ((s1->Part1 == s2->Part1) && (s1->Part2 == s2->Part2));
|
||||
}
|
||||
|
||||
static void *efi_config_get_vendor_table_by_guid(efi_guid_t *guid)
|
||||
{
|
||||
struct efi_configuration_table *ect_tmp;
|
||||
int n_ct;
|
||||
|
||||
if (efi == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ect_tmp = efi->ConfigurationTable;
|
||||
|
||||
for (n_ct = 0; n_ct < efi->NumberOfTableEntries; n_ct++) {
|
||||
if (efi_guid_compare(&ect_tmp->VendorGuid, guid)) {
|
||||
return ect_tmp->VendorTable;
|
||||
}
|
||||
|
||||
ect_tmp++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Existing x86_64 EFI environments have a bad habit of leaving the
|
||||
* HPET timer running. This then fires later on, once the OS has
|
||||
* started. If the timing isn't right, it can happen before the OS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue