]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Provide access to ACPI tables
authorMichael Brown <mcb30@ipxe.org>
Tue, 23 May 2017 17:32:31 +0000 (18:32 +0100)
committerMichael Brown <mcb30@ipxe.org>
Tue, 23 May 2017 17:48:02 +0000 (18:48 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/config/defaults/efi.h
src/include/ipxe/acpi.h
src/include/ipxe/efi/Guid/Acpi.h [new file with mode: 0644]
src/include/ipxe/efi/efi_acpi.h [new file with mode: 0644]
src/interface/efi/efi_acpi.c [new file with mode: 0644]

index 5e1eed79a41c84b3af71d3e768919faadd964259..74effa42530470b5349ca3bb64b5ec5849f09f58 100644 (file)
@@ -21,7 +21,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 #define ENTROPY_EFI
 #define TIME_EFI
 #define REBOOT_EFI
-#define ACPI_NULL
+#define ACPI_EFI
 
 #define DOWNLOAD_PROTO_FILE    /* Local filesystem access */
 
index e7ca35da95deebd8b52fa9ae4c31d70f3420278b..68131e73ac2df63d98a345c973b22bb15fd1e20e 100644 (file)
@@ -215,6 +215,7 @@ struct acpi_model {
 
 /* Include all architecture-independent ACPI API headers */
 #include <ipxe/null_acpi.h>
+#include <ipxe/efi/efi_acpi.h>
 
 /* Include all architecture-dependent ACPI API headers */
 #include <bits/acpi.h>
diff --git a/src/include/ipxe/efi/Guid/Acpi.h b/src/include/ipxe/efi/Guid/Acpi.h
new file mode 100644 (file)
index 0000000..c4169c5
--- /dev/null
@@ -0,0 +1,48 @@
+/** @file
+  GUIDs used for ACPI entries in the EFI system table
+
+  These GUIDs point the ACPI tables as defined in the ACPI specifications.
+  ACPI 2.0 specification defines the ACPI 2.0 GUID. UEFI 2.0 defines the
+  ACPI 2.0 Table GUID and ACPI Table GUID.
+
+  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+  GUIDs defined in UEFI 2.0 spec.
+
+**/
+
+#ifndef __ACPI_GUID_H__
+#define __ACPI_GUID_H__
+
+FILE_LICENCE ( BSD3 );
+
+#define ACPI_TABLE_GUID \
+  { \
+    0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
+  }
+
+#define EFI_ACPI_TABLE_GUID \
+  { \
+    0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
+  }
+
+#define ACPI_10_TABLE_GUID     ACPI_TABLE_GUID
+
+//
+// ACPI 2.0 or newer tables should use EFI_ACPI_TABLE_GUID.
+//
+#define EFI_ACPI_20_TABLE_GUID EFI_ACPI_TABLE_GUID
+
+extern EFI_GUID gEfiAcpiTableGuid;
+extern EFI_GUID gEfiAcpi10TableGuid;
+extern EFI_GUID gEfiAcpi20TableGuid;
+
+#endif
diff --git a/src/include/ipxe/efi/efi_acpi.h b/src/include/ipxe/efi/efi_acpi.h
new file mode 100644 (file)
index 0000000..01456f1
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef _IPXE_EFI_ACPI_H
+#define _IPXE_EFI_ACPI_H
+
+/** @file
+ *
+ * iPXE ACPI API for EFI
+ *
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
+#ifdef ACPI_EFI
+#define ACPI_PREFIX_efi
+#else
+#define ACPI_PREFIX_efi __efi_
+#endif
+
+#endif /* _IPXE_EFI_ACPI_H */
diff --git a/src/interface/efi/efi_acpi.c b/src/interface/efi/efi_acpi.c
new file mode 100644 (file)
index 0000000..a347eaf
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2017 Michael Brown <mbrown@fensystems.co.uk>.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
+/**
+ * @file
+ *
+ * iPXE ACPI API for EFI
+ *
+ */
+
+#include <ipxe/acpi.h>
+#include <ipxe/efi/efi.h>
+#include <ipxe/efi/Guid/Acpi.h>
+#include <ipxe/efi/efi_acpi.h>
+
+/** ACPI configuration table */
+static EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER *rsdp;
+EFI_USE_TABLE ( ACPI_10_TABLE, &rsdp, 0 );
+
+/**
+ * Locate ACPI root system description table
+ *
+ * @ret rsdt           ACPI root system description table, or UNULL
+ */
+static userptr_t efi_find_rsdt ( void ) {
+
+       /* Locate RSDT via ACPI configuration table, if available */
+       if ( rsdp )
+               return phys_to_user ( rsdp->RsdtAddress );
+
+       return UNULL;
+}
+
+PROVIDE_ACPI ( efi, acpi_find_rsdt, efi_find_rsdt );