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 data2;
|
||||||
uint16_t data3;
|
uint16_t data3;
|
||||||
uint8_t data4[8];
|
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;
|
} efi_guid;
|
||||||
|
|
||||||
typedef void* efi_handle;
|
typedef void* efi_handle;
|
||||||
|
|||||||
@@ -205,15 +205,10 @@ acpi_init()
|
|||||||
|
|
||||||
// Try to find the ACPI RSDP.
|
// Try to find the ACPI RSDP.
|
||||||
for (uint32 i = 0; i < entries; i++) {
|
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 (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)
|
if (strncmp((char *)rsdp, ACPI_RSDP_SIGNATURE, 8) == 0)
|
||||||
TRACE(("acpi_init: found ACPI RSDP signature at %p\n", rsdp));
|
TRACE(("acpi_init: found ACPI RSDP signature at %p\n", rsdp));
|
||||||
|
|
||||||
@@ -222,5 +217,4 @@ acpi_init()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user