grub2/0003-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch
Marcus Meissner 3ded5cdd6f Accepting request 355366 from home:michael-chang:branches:Base:System
- Backport upstream patches for HyperV gen2 TSC timer calbration without
  RTC (bsc#904647)
  * added 0001-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch
  * added 0002-i386-tsc-Fix-unused-function-warning-on-xen.patch
  * added 0003-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch
  * added 0004-tsc-Use-alternative-delay-sources-whenever-appropria.patch
  * added 0005-i386-fix-TSC-calibration-using-PIT.patch

OBS-URL: https://build.opensuse.org/request/show/355366
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=200
2016-01-22 15:15:45 +00:00

81 lines
3.2 KiB
Diff

From 07258815e96aab2c72593d0129d17051cbf68d27 Mon Sep 17 00:00:00 2001
From: Andrei Borzenkov <arvidjaar@gmail.com>
Date: Fri, 8 May 2015 06:15:16 +0300
Subject: [PATCH] acpi: do not skip BIOS scan if EBDA length is zero
EBDA layout is not standardized so we cannot assume first two bytes
are length. Neither is it required by ACPI standard. HP 8710W is known
to contain zeroes here.
Closes: 45002
---
grub-core/commands/acpi.c | 4 ++++
grub-core/commands/i386/pc/acpi.c | 10 ++++++----
2 files changed, 10 insertions(+), 4 deletions(-)
Index: grub-2.02~beta2/grub-core/commands/acpi.c
===================================================================
--- grub-2.02~beta2.orig/grub-core/commands/acpi.c
+++ grub-2.02~beta2/grub-core/commands/acpi.c
@@ -179,8 +179,10 @@ grub_acpi_create_ebda (void)
struct grub_acpi_rsdp_v20 *v2;
ebda = (grub_uint8_t *) (grub_addr_t) ((*((grub_uint16_t *)0x40e)) << 4);
+ grub_dprintf ("acpi", "EBDA @%p\n", ebda);
if (ebda)
ebda_kb_len = *(grub_uint16_t *) ebda;
+ grub_dprintf ("acpi", "EBDA length 0x%x\n", ebda_kb_len);
if (ebda_kb_len > 16)
ebda_kb_len = 0;
ctx.ebda_len = (ebda_kb_len + 1) << 10;
@@ -494,6 +496,8 @@ grub_cmd_acpi (struct grub_extcmd_contex
if (! rsdp)
rsdp = grub_machine_acpi_get_rsdpv1 ();
+ grub_dprintf ("acpi", "RSDP @%p\n", rsdp);
+
if (rsdp)
{
grub_uint32_t *entry_ptr;
Index: grub-2.02~beta2/grub-core/commands/i386/pc/acpi.c
===================================================================
--- grub-2.02~beta2.orig/grub-core/commands/i386/pc/acpi.c
+++ grub-2.02~beta2/grub-core/commands/i386/pc/acpi.c
@@ -29,14 +29,15 @@ grub_machine_acpi_get_rsdpv1 (void)
grub_dprintf ("acpi", "Looking for RSDP. Scanning EBDA\n");
ebda = (grub_uint8_t *) ((* ((grub_uint16_t *) 0x40e)) << 4);
ebda_len = * (grub_uint16_t *) ebda;
- if (! ebda_len)
- return 0;
+ if (! ebda_len) /* FIXME do we really need this check? */
+ goto scan_bios;
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;
+scan_bios:
grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n");
for (ptr = (grub_uint8_t *) 0xe0000; ptr < (grub_uint8_t *) 0x100000;
ptr += 16)
@@ -56,8 +57,8 @@ grub_machine_acpi_get_rsdpv2 (void)
grub_dprintf ("acpi", "Looking for RSDP. Scanning EBDA\n");
ebda = (grub_uint8_t *) ((* ((grub_uint16_t *) 0x40e)) << 4);
ebda_len = * (grub_uint16_t *) ebda;
- if (! ebda_len)
- return 0;
+ if (! ebda_len) /* FIXME do we really need this check? */
+ goto scan_bios;
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
@@ -67,6 +68,7 @@ grub_machine_acpi_get_rsdpv2 (void)
== 0)
return (struct grub_acpi_rsdp_v20 *) ptr;
+scan_bios:
grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n");
for (ptr = (grub_uint8_t *) 0xe0000; ptr < (grub_uint8_t *) 0x100000;
ptr += 16)