[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] acpi: always scan the BIOS region if searching the EBDA fails
From: |
David Michael |
Subject: |
[PATCH] acpi: always scan the BIOS region if searching the EBDA fails |
Date: |
Tue, 01 Jul 2014 17:08:18 -0400 |
---
This can be applied on top of the ACPI halt patches from Justus to test
powering off QEMU systems.
i386/i386at/acpi.c | 31 ++++++++++++++-----------------
1 file changed, 14 insertions(+), 17 deletions(-)
diff --git a/i386/i386at/acpi.c b/i386/i386at/acpi.c
index ec8aeb1..488aa6d 100644
--- a/i386/i386at/acpi.c
+++ b/i386/i386at/acpi.c
@@ -30,13 +30,12 @@ grub_machine_acpi_get_rsdpv1 (void)
grub_dprintf ("acpi", "Looking for RSDP. Scanning EBDA\n");
ebda = (grub_uint8_t *) phystokv ((* ((grub_uint16_t *) phystokv (0x40e)))
<< 4);
ebda_len = * (grub_uint16_t *) ebda;
- if (! ebda_len)
- return 0;
- for (ptr = ebda; ptr < ebda + 0x400; ptr += 16)
- if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
- && grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0
- && ((struct grub_acpi_rsdp_v10 *) ptr)->revision == 0)
- return (struct grub_acpi_rsdp_v10 *) ptr;
+ if (ebda_len)
+ for (ptr = ebda; ptr < ebda + 0x400; ptr += 16)
+ if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
+ && grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0
+ && ((struct grub_acpi_rsdp_v10 *) ptr)->revision == 0)
+ return (struct grub_acpi_rsdp_v10 *) ptr;
grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n");
for (ptr = (grub_uint8_t *) phystokv (0xe0000); ptr < (grub_uint8_t *)
phystokv (0x100000);
@@ -57,16 +56,14 @@ grub_machine_acpi_get_rsdpv2 (void)
grub_dprintf ("acpi", "Looking for RSDP. Scanning EBDA\n");
ebda = (grub_uint8_t *) phystokv ((* ((grub_uint16_t *) phystokv (0x40e)))
<< 4);
ebda_len = * (grub_uint16_t *) ebda;
- if (! ebda_len)
- return 0;
- for (ptr = ebda; ptr < ebda + 0x400; ptr += 16)
- if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
- && grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0
- && ((struct grub_acpi_rsdp_v10 *) ptr)->revision != 0
- && ((struct grub_acpi_rsdp_v20 *) ptr)->length < 1024
- && grub_byte_checksum (ptr, ((struct grub_acpi_rsdp_v20 *) ptr)->length)
- == 0)
- return (struct grub_acpi_rsdp_v20 *) ptr;
+ if (ebda_len)
+ for (ptr = ebda; ptr < ebda + 0x400; ptr += 16)
+ if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
+ && grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0
+ && ((struct grub_acpi_rsdp_v10 *) ptr)->revision != 0
+ && ((struct grub_acpi_rsdp_v20 *) ptr)->length < 1024
+ && grub_byte_checksum (ptr, ((struct grub_acpi_rsdp_v20 *)
ptr)->length) == 0)
+ return (struct grub_acpi_rsdp_v20 *) ptr;
grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n");
for (ptr = (grub_uint8_t *) phystokv (0xe0000); ptr < (grub_uint8_t *)
phystokv (0x100000);
--
1.9.3
- [PATCH] acpi: always scan the BIOS region if searching the EBDA fails,
David Michael <=