efi_guid struct gets equals, simplify EFI acpi_init
Change-Id: Id4bc985dc1e6f44b594f6ca5dabd3fdac8e1cac2 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3545 Reviewed-by: Alex von Gluck IV <[email protected]>
This commit is contained in:
committed by
Alex von Gluck IV
parent
e050005a07
commit
da93a24811
@@ -82,6 +82,14 @@ typedef struct efi_guid {
|
||||
uint16_t data2;
|
||||
uint16_t data3;
|
||||
uint8_t data4[8];
|
||||
|
||||
bool equals(const efi_guid& other) const {
|
||||
bool matches = data1 == other.data1 && data2 == other.data2
|
||||
&& data3 == other.data3;
|
||||
for (auto i = 0; matches && i < 8; i++)
|
||||
matches = data4[i] == other.data4[i];
|
||||
return matches;
|
||||
}
|
||||
} efi_guid;
|
||||
|
||||
typedef void* efi_handle;
|
||||
|
||||
@@ -205,22 +205,16 @@ acpi_init()
|
||||
|
||||
// Try to find the ACPI RSDP.
|
||||
for (uint32 i = 0; i < entries; i++) {
|
||||
acpi_rsdp *rsdp = NULL;
|
||||
if (!table[i].VendorGuid.equals(acpi))
|
||||
continue;
|
||||
|
||||
efi_guid vendor = table[i].VendorGuid;
|
||||
acpi_rsdp *rsdp = (acpi_rsdp *)(table[i].VendorTable);
|
||||
if (strncmp((char *)rsdp, ACPI_RSDP_SIGNATURE, 8) == 0)
|
||||
TRACE(("acpi_init: found ACPI RSDP signature at %p\n", rsdp));
|
||||
|
||||
if (vendor.data1 == acpi.data1
|
||||
&& vendor.data2 == acpi.data2
|
||||
&& vendor.data3 == acpi.data3
|
||||
&& strncmp((char *)vendor.data4, (char *)acpi.data4, 8) == 0) {
|
||||
rsdp = (acpi_rsdp *)(table[i].VendorTable);
|
||||
if (strncmp((char *)rsdp, ACPI_RSDP_SIGNATURE, 8) == 0)
|
||||
TRACE(("acpi_init: found ACPI RSDP signature at %p\n", rsdp));
|
||||
|
||||
if (rsdp != NULL && acpi_check_rsdt(rsdp) == B_OK) {
|
||||
gKernelArgs.arch_args.acpi_root = rsdp;
|
||||
break;
|
||||
}
|
||||
if (rsdp != NULL && acpi_check_rsdt(rsdp) == B_OK) {
|
||||
gKernelArgs.arch_args.acpi_root = rsdp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user