2009-11-21 Samuel Thibault <samuel.thibault@ens-lyon.org>
[grub2.git] / commands / efi / acpi.c
blob93a560d9c52a40294d47bb9c13b51b3f4c26ba47
1 /* acpi.c - get acpi tables. */
2 /*
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2009 Free Software Foundation, Inc.
6 * GRUB is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * GRUB is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
20 #include <grub/acpi.h>
21 #include <grub/misc.h>
22 #include <grub/efi/efi.h>
23 #include <grub/efi/api.h>
25 struct grub_acpi_rsdp_v10 *
26 grub_machine_acpi_get_rsdpv1 (void)
28 unsigned i;
29 static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
31 for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
33 grub_efi_guid_t *guid =
34 &grub_efi_system_table->configuration_table[i].vendor_guid;
36 if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_efi_guid_t)))
37 return (struct grub_acpi_rsdp_v10 *)
38 grub_efi_system_table->configuration_table[i].vendor_table;
40 return 0;
43 struct grub_acpi_rsdp_v20 *
44 grub_machine_acpi_get_rsdpv2 (void)
46 unsigned i;
47 static grub_efi_guid_t acpi20_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
49 for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
51 grub_efi_guid_t *guid =
52 &grub_efi_system_table->configuration_table[i].vendor_guid;
54 if (! grub_memcmp (guid, &acpi20_guid, sizeof (grub_efi_guid_t)))
55 return (struct grub_acpi_rsdp_v20 *)
56 grub_efi_system_table->configuration_table[i].vendor_table;
58 return 0;