grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: grub-devel@gnu.org
Cc: Nando Eva <nando4eva@ymail.com>,
	Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Subject: [PATCH] acpi: add missing efi_call wrapper to acpi command
Date: Sat,  1 Apr 2017 18:24:19 +0300	[thread overview]
Message-ID: <1491060259-3112-1-git-send-email-arvidjaar@gmail.com> (raw)
In-Reply-To: <d042fbf2-a614-a405-815b-73c7fe37af28@gmail.com>

Fixed loading of ACPI tables on EFI (side effect was apparent memory
corruption ranging from unpredictable behavior to system reset).

Reported by Nando Eva <nando4eva@ymail.com>

---

@Nando: please test this patch. It fixed loading for me at least on
QEMU/OVMF. It conflicts with lsacpi patch, but you can actually
verify that RSDP was updated by using "lsefisystab" in grub.

@Vladimir: this looks like 2.02 material as it was obviously wrong.
It does not fix weird behavior on physical system (loss of partitions
afetr loading table using "acpi"); unfortunately, I cannot reproduce
it in QEMU which makes it rather hard to debug. This smells like yet
another meory corruption.

Also our ACPI table mangling code is not clean (e.g. Linux reports
FACS two times). Note that ACPI says normal and extended addresses
(i.e. DSDT/XDSDT and FACS/XFACS) are mutually exclusive, while we
set both to non-zero. This strictly speaking violates specs.

 grub-core/commands/acpi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/grub-core/commands/acpi.c b/grub-core/commands/acpi.c
index b5c2f27..9f02f22 100644
--- a/grub-core/commands/acpi.c
+++ b/grub-core/commands/acpi.c
@@ -761,10 +761,10 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
     struct grub_efi_guid acpi = GRUB_EFI_ACPI_TABLE_GUID;
     struct grub_efi_guid acpi20 = GRUB_EFI_ACPI_20_TABLE_GUID;
 
-    grub_efi_system_table->boot_services->install_configuration_table
-      (&acpi20, grub_acpi_get_rsdpv2 ());
-    grub_efi_system_table->boot_services->install_configuration_table
-      (&acpi, grub_acpi_get_rsdpv1 ());
+    efi_call_2 (grub_efi_system_table->boot_services->install_configuration_table,
+      &acpi20, grub_acpi_get_rsdpv2 ());
+    efi_call_2 (grub_efi_system_table->boot_services->install_configuration_table,
+      &acpi, grub_acpi_get_rsdpv1 ());
   }
 #endif
 
-- 
tg: (8014b7b..) u/acpi-efi_call (depends on: master)


  reply	other threads:[~2017-04-01 15:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1736729449.4676062.1487865639993.ref@mail.yahoo.com>
2017-02-23 16:00 ` Loading DSDT table using 'acpi' or some memory write command? Nando Eva
2017-02-24 16:32   ` Andrei Borzenkov
2017-02-27 11:29   ` Nando Eva
2017-02-27 13:42     ` Andrei Borzenkov
2017-02-27 15:13       ` Vladimir 'phcoder' Serbinenko
2017-02-27 15:31         ` Vladimir 'phcoder' Serbinenko
2017-02-27 15:13     ` Nando Eva
2017-02-27 18:21       ` Nando Eva
2017-03-27 14:12         ` Nando Eva
2017-03-27 16:55           ` Andrei Borzenkov
2017-03-29 17:45           ` Nando Eva
2017-03-30  4:03             ` Andrei Borzenkov
2017-04-01  9:09             ` Andrei Borzenkov
2017-04-01 15:24               ` Andrei Borzenkov [this message]
2017-04-02  8:27                 ` [PATCH] acpi: add missing efi_call wrapper to acpi command Vladimir 'phcoder' Serbinenko
2017-04-04 18:18               ` [PATCH] acpi: do not attempt to create EBDA on EFI (was: Loading DSDT table using 'acpi' or some memory write command?) Andrei Borzenkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1491060259-3112-1-git-send-email-arvidjaar@gmail.com \
    --to=arvidjaar@gmail.com \
    --cc=grub-devel@gnu.org \
    --cc=nando4eva@ymail.com \
    --cc=phcoder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).