Procházet zdrojové kódy

[efi] Provide access to ACPI tables

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown před 7 roky
rodič
revize
993fd2b451

+ 1
- 1
src/config/defaults/efi.h Zobrazit soubor

@@ -21,7 +21,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
21 21
 #define ENTROPY_EFI
22 22
 #define TIME_EFI
23 23
 #define REBOOT_EFI
24
-#define ACPI_NULL
24
+#define ACPI_EFI
25 25
 
26 26
 #define DOWNLOAD_PROTO_FILE	/* Local filesystem access */
27 27
 

+ 1
- 0
src/include/ipxe/acpi.h Zobrazit soubor

@@ -215,6 +215,7 @@ struct acpi_model {
215 215
 
216 216
 /* Include all architecture-independent ACPI API headers */
217 217
 #include <ipxe/null_acpi.h>
218
+#include <ipxe/efi/efi_acpi.h>
218 219
 
219 220
 /* Include all architecture-dependent ACPI API headers */
220 221
 #include <bits/acpi.h>

+ 48
- 0
src/include/ipxe/efi/Guid/Acpi.h Zobrazit soubor

@@ -0,0 +1,48 @@
1
+/** @file
2
+  GUIDs used for ACPI entries in the EFI system table
3
+
4
+  These GUIDs point the ACPI tables as defined in the ACPI specifications.
5
+  ACPI 2.0 specification defines the ACPI 2.0 GUID. UEFI 2.0 defines the
6
+  ACPI 2.0 Table GUID and ACPI Table GUID.
7
+
8
+  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
9
+  This program and the accompanying materials
10
+  are licensed and made available under the terms and conditions of the BSD License
11
+  which accompanies this distribution.  The full text of the license may be found at
12
+  http://opensource.org/licenses/bsd-license.php
13
+
14
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16
+
17
+  @par Revision Reference:
18
+  GUIDs defined in UEFI 2.0 spec.
19
+
20
+**/
21
+
22
+#ifndef __ACPI_GUID_H__
23
+#define __ACPI_GUID_H__
24
+
25
+FILE_LICENCE ( BSD3 );
26
+
27
+#define ACPI_TABLE_GUID \
28
+  { \
29
+    0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
30
+  }
31
+
32
+#define EFI_ACPI_TABLE_GUID \
33
+  { \
34
+    0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
35
+  }
36
+
37
+#define ACPI_10_TABLE_GUID     ACPI_TABLE_GUID
38
+
39
+//
40
+// ACPI 2.0 or newer tables should use EFI_ACPI_TABLE_GUID.
41
+//
42
+#define EFI_ACPI_20_TABLE_GUID EFI_ACPI_TABLE_GUID
43
+
44
+extern EFI_GUID gEfiAcpiTableGuid;
45
+extern EFI_GUID gEfiAcpi10TableGuid;
46
+extern EFI_GUID gEfiAcpi20TableGuid;
47
+
48
+#endif

+ 18
- 0
src/include/ipxe/efi/efi_acpi.h Zobrazit soubor

@@ -0,0 +1,18 @@
1
+#ifndef _IPXE_EFI_ACPI_H
2
+#define _IPXE_EFI_ACPI_H
3
+
4
+/** @file
5
+ *
6
+ * iPXE ACPI API for EFI
7
+ *
8
+ */
9
+
10
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11
+
12
+#ifdef ACPI_EFI
13
+#define ACPI_PREFIX_efi
14
+#else
15
+#define ACPI_PREFIX_efi __efi_
16
+#endif
17
+
18
+#endif /* _IPXE_EFI_ACPI_H */

+ 56
- 0
src/interface/efi/efi_acpi.c Zobrazit soubor

@@ -0,0 +1,56 @@
1
+/*
2
+ * Copyright (C) 2017 Michael Brown <mbrown@fensystems.co.uk>.
3
+ *
4
+ * This program is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU General Public License as
6
+ * published by the Free Software Foundation; either version 2 of the
7
+ * License, or any later version.
8
+ *
9
+ * This program is distributed in the hope that it will be useful, but
10
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
+ * General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License
15
+ * along with this program; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17
+ * 02110-1301, USA.
18
+ *
19
+ * You can also choose to distribute this program under the terms of
20
+ * the Unmodified Binary Distribution Licence (as given in the file
21
+ * COPYING.UBDL), provided that you have satisfied its requirements.
22
+ */
23
+
24
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
25
+
26
+/**
27
+ * @file
28
+ *
29
+ * iPXE ACPI API for EFI
30
+ *
31
+ */
32
+
33
+#include <ipxe/acpi.h>
34
+#include <ipxe/efi/efi.h>
35
+#include <ipxe/efi/Guid/Acpi.h>
36
+#include <ipxe/efi/efi_acpi.h>
37
+
38
+/** ACPI configuration table */
39
+static EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER *rsdp;
40
+EFI_USE_TABLE ( ACPI_10_TABLE, &rsdp, 0 );
41
+
42
+/**
43
+ * Locate ACPI root system description table
44
+ *
45
+ * @ret rsdt		ACPI root system description table, or UNULL
46
+ */
47
+static userptr_t efi_find_rsdt ( void ) {
48
+
49
+	/* Locate RSDT via ACPI configuration table, if available */
50
+	if ( rsdp )
51
+		return phys_to_user ( rsdp->RsdtAddress );
52
+
53
+	return UNULL;
54
+}
55
+
56
+PROVIDE_ACPI ( efi, acpi_find_rsdt, efi_find_rsdt );

Načítá se…
Zrušit
Uložit