grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Leif Lindholm <leif.lindholm@linaro.org>
To: grub-devel@gnu.org
Cc: Alexander Graf <agraf@suse.de>
Subject: [RFC 3/3] acpi: use grub_efi_find_config_table to find tables
Date: Tue,  1 Mar 2016 17:41:43 +0000	[thread overview]
Message-ID: <1456854103-12095-4-git-send-email-leif.lindholm@linaro.org> (raw)
In-Reply-To: <1456854103-12095-1-git-send-email-leif.lindholm@linaro.org>

Use new helper function rather than manually iterating through UEFI
system table.
---
 grub-core/kern/efi/acpi.c | 28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/grub-core/kern/efi/acpi.c b/grub-core/kern/efi/acpi.c
index 74f8cd1..523d682 100644
--- a/grub-core/kern/efi/acpi.c
+++ b/grub-core/kern/efi/acpi.c
@@ -25,35 +25,15 @@
 struct grub_acpi_rsdp_v10 *
 grub_machine_acpi_get_rsdpv1 (void)
 {
-  unsigned i;
-  static grub_efi_packed_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
+  static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
 
-  for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
-    {
-      grub_efi_packed_guid_t *guid =
-	&grub_efi_system_table->configuration_table[i].vendor_guid;
-
-      if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_efi_packed_guid_t)))
-	return (struct grub_acpi_rsdp_v10 *)
-	  grub_efi_system_table->configuration_table[i].vendor_table;
-    }
-  return 0;
+  return grub_efi_find_config_table (&acpi_guid);
 }
 
 struct grub_acpi_rsdp_v20 *
 grub_machine_acpi_get_rsdpv2 (void)
 {
-  unsigned i;
-  static grub_efi_packed_guid_t acpi20_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
-
-  for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
-    {
-      grub_efi_packed_guid_t *guid =
-	&grub_efi_system_table->configuration_table[i].vendor_guid;
+  static grub_efi_guid_t acpi20_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
 
-      if (! grub_memcmp (guid, &acpi20_guid, sizeof (grub_efi_packed_guid_t)))
-	return (struct grub_acpi_rsdp_v20 *)
-	  grub_efi_system_table->configuration_table[i].vendor_table;
-    }
-  return 0;
+  return grub_efi_find_config_table (&acpi20_guid);
 }
-- 
2.1.4



  parent reply	other threads:[~2016-03-01 17:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01 17:41 [RFC 0/3] Add/use helper functions for finding UEFI config tables Leif Lindholm
2016-03-01 17:41 ` [RFC 1/3] efi: add configuration table search function Leif Lindholm
2016-03-01 20:08   ` Andrei Borzenkov
2016-03-01 20:13     ` Vladimir 'phcoder' Serbinenko
2016-03-01 20:28       ` Leif Lindholm
2016-03-10 20:05         ` Vladimir 'phcoder' Serbinenko
2016-03-01 20:14     ` Leif Lindholm
2016-03-01 17:41 ` [RFC 2/3] arm64 linux loader: use grub_efi_find_config_table to find DT Leif Lindholm
2016-03-01 17:41 ` Leif Lindholm [this message]
2016-03-01 18:38 ` [RFC 0/3] Add/use helper functions for finding UEFI config tables Alexander Graf

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=1456854103-12095-4-git-send-email-leif.lindholm@linaro.org \
    --to=leif.lindholm@linaro.org \
    --cc=agraf@suse.de \
    --cc=grub-devel@gnu.org \
    /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).