* [PATCH v3 01/12] Revert "ArmVirtPkg/FdtClientDxe: make DT table installation !ACPI dependent"
2017-03-24 22:38 [PATCH v3 00/12] ArmVirtPkg: don't forward the DT to the OS if QEMU provides ACPI Laszlo Ersek
@ 2017-03-24 22:38 ` Laszlo Ersek
2017-03-24 22:38 ` [PATCH v3 02/12] Revert "ArmVirtPkg/FdtClientDxe: install DT configuration table at ReadyToBoot" Laszlo Ersek
` (10 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Laszlo Ersek @ 2017-03-24 22:38 UTC (permalink / raw)
To: edk2-devel-01; +Cc: Ard Biesheuvel, Leif Lindholm
This reverts commit 78c41ff519b187d8979cda7074f007a6323f9acd.
We realized that DXE drivers that are independent of AcpiPlatformDxe (that
is, independent of QEMU's ACPI generation), such as RamDiskDxe and
BootGraphicsResourceTableDxe, may produce and/or manipulate ACPI tables,
at driver dispatch or even at Ready To Boot.
This makes it unsafe for us to check for ACPI presence in the UEFI system
config table in a Ready To Boot callback, in order to decide about
exposing the DT.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
Notes:
v3:
- pick up Ard's R-b
ArmVirtPkg/ArmVirtPkg.dec | 10 ++++++++++
ArmVirtPkg/ArmVirtQemu.dsc | 5 +++++
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf | 5 +++--
ArmVirtPkg/FdtClientDxe/FdtClientDxe.c | 16 +++++-----------
4 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec
index efe83a383d55..a5ec42166445 100644
--- a/ArmVirtPkg/ArmVirtPkg.dec
+++ b/ArmVirtPkg/ArmVirtPkg.dec
@@ -58,3 +58,13 @@ [PcdsFixedAtBuild, PcdsPatchableInModule]
# EFI_VT_100_GUID.
#
gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x65, 0x60, 0xA6, 0xDF, 0x19, 0xB4, 0xD3, 0x11, 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D}|VOID*|0x00000007
+
+[PcdsFeatureFlag]
+ #
+ # Pure ACPI boot
+ #
+ # Inhibit installation of the FDT as a configuration table if this feature
+ # PCD is TRUE. Otherwise, the OS is presented with both a DT and an ACPI
+ # description of the platform, and it is up to the OS to choose.
+ #
+ gArmVirtTokenSpaceGuid.PcdPureAcpiBoot|FALSE|BOOLEAN|0x0000000a
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 4f686faa559c..4b556f309a6c 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -34,6 +34,7 @@ [Defines]
# -D FLAG=VALUE
#
DEFINE SECURE_BOOT_ENABLE = FALSE
+ DEFINE PURE_ACPI_BOOT_ENABLE = FALSE
!include ArmVirtPkg/ArmVirt.dsc.inc
@@ -94,6 +95,10 @@ [PcdsFeatureFlag.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
+!if $(PURE_ACPI_BOOT_ENABLE) == TRUE
+ gArmVirtTokenSpaceGuid.PcdPureAcpiBoot|TRUE
+!endif
+
[PcdsFixedAtBuild.common]
gArmPlatformTokenSpaceGuid.PcdCoreCount|1
!if $(ARCH) == AARCH64
diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
index 9861f41e968b..00017727c32c 100644
--- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
@@ -37,16 +37,17 @@ [LibraryClasses]
HobLib
UefiBootServicesTableLib
UefiDriverEntryPoint
- UefiLib
[Protocols]
gFdtClientProtocolGuid ## PRODUCES
[Guids]
- gEfiAcpi20TableGuid
gEfiEventReadyToBootGuid
gFdtHobGuid
gFdtTableGuid
+[FeaturePcd]
+ gArmVirtTokenSpaceGuid.PcdPureAcpiBoot
+
[Depex]
TRUE
diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
index 21c1074e331c..4cf79f70cb2a 100644
--- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
+++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
@@ -17,11 +17,9 @@
#include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
#include <Library/HobLib.h>
#include <libfdt.h>
-#include <Guid/Acpi.h>
#include <Guid/EventGroup.h>
#include <Guid/Fdt.h>
#include <Guid/FdtHob.h>
@@ -318,16 +316,12 @@ OnReadyToBoot (
)
{
EFI_STATUS Status;
- VOID *Table;
- //
- // Only install the FDT as a configuration table if we are not exposing
- // ACPI 2.0 (or later) tables. Note that the legacy ACPI table GUID has
- // no meaning on ARM since we need at least ACPI 5.0 support, and the
- // 64-bit ACPI 2.0 table GUID is mandatory in that case.
- //
- Status = EfiGetSystemConfigurationTable (&gEfiAcpi20TableGuid, &Table);
- if (EFI_ERROR (Status) || Table == NULL) {
+ if (!FeaturePcdGet (PcdPureAcpiBoot)) {
+ //
+ // Only install the FDT as a configuration table if we want to leave it up
+ // to the OS to decide whether it prefers ACPI over DT.
+ //
Status = gBS->InstallConfigurationTable (&gFdtTableGuid, mDeviceTreeBase);
ASSERT_EFI_ERROR (Status);
}
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 02/12] Revert "ArmVirtPkg/FdtClientDxe: install DT configuration table at ReadyToBoot"
2017-03-24 22:38 [PATCH v3 00/12] ArmVirtPkg: don't forward the DT to the OS if QEMU provides ACPI Laszlo Ersek
2017-03-24 22:38 ` [PATCH v3 01/12] Revert "ArmVirtPkg/FdtClientDxe: make DT table installation !ACPI dependent" Laszlo Ersek
@ 2017-03-24 22:38 ` Laszlo Ersek
2017-03-24 22:38 ` [PATCH v3 03/12] ArmVirtPkg/XenAcpiPlatformDxe: don't cast UINT64 to pointer directly Laszlo Ersek
` (9 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Laszlo Ersek @ 2017-03-24 22:38 UTC (permalink / raw)
To: edk2-devel-01; +Cc: Ard Biesheuvel, Leif Lindholm
This reverts commit 18f6d4df9ece8b91b86511bcdd1cf7da478c3627.
We realized that DXE drivers that are independent of AcpiPlatformDxe (that
is, independent of QEMU's ACPI generation), such as RamDiskDxe and
BootGraphicsResourceTableDxe, may produce and/or manipulate ACPI tables,
at driver dispatch or even at Ready To Boot.
This makes it unsafe for us to check for ACPI presence in the UEFI system
config table in a Ready To Boot callback, in order to decide about
exposing the DT.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
Notes:
v3:
- pick up Ard's R-b
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf | 1 -
ArmVirtPkg/FdtClientDxe/FdtClientDxe.c | 49 ++++----------------
2 files changed, 9 insertions(+), 41 deletions(-)
diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
index 00017727c32c..3a0cd37040eb 100644
--- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
@@ -42,7 +42,6 @@ [Protocols]
gFdtClientProtocolGuid ## PRODUCES
[Guids]
- gEfiEventReadyToBootGuid
gFdtHobGuid
gFdtTableGuid
diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
index 4cf79f70cb2a..547a29fce62c 100644
--- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
+++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
@@ -20,7 +20,6 @@
#include <Library/HobLib.h>
#include <libfdt.h>
-#include <Guid/EventGroup.h>
#include <Guid/Fdt.h>
#include <Guid/FdtHob.h>
@@ -307,30 +306,6 @@ STATIC FDT_CLIENT_PROTOCOL mFdtClientProtocol = {
GetOrInsertChosenNode,
};
-STATIC
-VOID
-EFIAPI
-OnReadyToBoot (
- EFI_EVENT Event,
- VOID *Context
- )
-{
- EFI_STATUS Status;
-
- if (!FeaturePcdGet (PcdPureAcpiBoot)) {
- //
- // Only install the FDT as a configuration table if we want to leave it up
- // to the OS to decide whether it prefers ACPI over DT.
- //
- Status = gBS->InstallConfigurationTable (&gFdtTableGuid, mDeviceTreeBase);
- ASSERT_EFI_ERROR (Status);
- }
-
- gBS->CloseEvent (Event);
-}
-
-STATIC EFI_EVENT mReadyToBootEvent;
-
EFI_STATUS
EFIAPI
InitializeFdtClientDxe (
@@ -358,21 +333,15 @@ InitializeFdtClientDxe (
DEBUG ((EFI_D_INFO, "%a: DTB @ 0x%p\n", __FUNCTION__, mDeviceTreeBase));
- Status = gBS->InstallProtocolInterface (&ImageHandle, &gFdtClientProtocolGuid,
- EFI_NATIVE_INTERFACE, &mFdtClientProtocol);
- if (EFI_ERROR (Status)) {
- return Status;
+ if (!FeaturePcdGet (PcdPureAcpiBoot)) {
+ //
+ // Only install the FDT as a configuration table if we want to leave it up
+ // to the OS to decide whether it prefers ACPI over DT.
+ //
+ Status = gBS->InstallConfigurationTable (&gFdtTableGuid, DeviceTreeBase);
+ ASSERT_EFI_ERROR (Status);
}
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- OnReadyToBoot,
- NULL,
- &gEfiEventReadyToBootGuid,
- &mReadyToBootEvent
- );
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
+ return gBS->InstallProtocolInterface (&ImageHandle, &gFdtClientProtocolGuid,
+ EFI_NATIVE_INTERFACE, &mFdtClientProtocol);
}
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 03/12] ArmVirtPkg/XenAcpiPlatformDxe: don't cast UINT64 to pointer directly
2017-03-24 22:38 [PATCH v3 00/12] ArmVirtPkg: don't forward the DT to the OS if QEMU provides ACPI Laszlo Ersek
2017-03-24 22:38 ` [PATCH v3 01/12] Revert "ArmVirtPkg/FdtClientDxe: make DT table installation !ACPI dependent" Laszlo Ersek
2017-03-24 22:38 ` [PATCH v3 02/12] Revert "ArmVirtPkg/FdtClientDxe: install DT configuration table at ReadyToBoot" Laszlo Ersek
@ 2017-03-24 22:38 ` Laszlo Ersek
2017-03-24 22:38 ` [PATCH v3 04/12] MdeModulePkg: introduce EDKII Platform Has ACPI GUID Laszlo Ersek
` (8 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Laszlo Ersek @ 2017-03-24 22:38 UTC (permalink / raw)
To: edk2-devel-01; +Cc: Ard Biesheuvel, Leif Lindholm
Because that breaks the (potential) 32-bit build of the driver.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
Notes:
v3:
- modify commit message (s/upcoming/potential/ build) to reflect that we
won't actually include the ACPI stuff in the 32-bit builds [Ard]
- pick up Ard's R-b
ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c b/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c
index 203946f97bf8..49f9b5d2822a 100644
--- a/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c
+++ b/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c
@@ -73,7 +73,8 @@ GetXenArmAcpiRsdp (
ASSERT (RegSize == 2 * sizeof (UINT64));
RegBase = SwapBytes64(Reg[0]);
- RsdpStructurePtr = (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)RegBase;
+ RsdpStructurePtr =
+ (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)(UINTN)RegBase;
if (RsdpStructurePtr && RsdpStructurePtr->Revision >= 2) {
Sum = CalculateSum8 ((CONST UINT8 *)RsdpStructurePtr,
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 04/12] MdeModulePkg: introduce EDKII Platform Has ACPI GUID
2017-03-24 22:38 [PATCH v3 00/12] ArmVirtPkg: don't forward the DT to the OS if QEMU provides ACPI Laszlo Ersek
` (2 preceding siblings ...)
2017-03-24 22:38 ` [PATCH v3 03/12] ArmVirtPkg/XenAcpiPlatformDxe: don't cast UINT64 to pointer directly Laszlo Ersek
@ 2017-03-24 22:38 ` Laszlo Ersek
2017-03-24 22:41 ` Ard Biesheuvel
2017-03-28 8:20 ` Laszlo Ersek
2017-03-24 22:38 ` [PATCH v3 05/12] ArmPkg: introduce PlatformHasAcpiLib Laszlo Ersek
` (7 subsequent siblings)
11 siblings, 2 replies; 18+ messages in thread
From: Laszlo Ersek @ 2017-03-24 22:38 UTC (permalink / raw)
To: edk2-devel-01; +Cc: Ard Biesheuvel, Feng Tian, Leif Lindholm, Star Zeng
The presence of this GUID in the PPI database, and/or in the DXE protocol
database (as dictated by the platform's needs in these firmware phases)
implies that the platform provides the operating system with an ACPI-based
hardware description. This is not necessarily exclusive with other types
of hardware description (for example, a Device Tree-based one).
A platform PEIM and/or DXE driver is supposed to produce a single instance
of the PPI and/or protocol (with NULL contents), if appropriate. The
decision to produce the PPI and/or protocol is platform specific; for
example, in the DXE phase, it could depend on an HII checkbox / underlying
non-volatile UEFI variable.
In the DXE phase, the protocol is meant to be depended-upon by
"MdeModulePkg/Universal/Acpi/AcpiTableDxe", indirectly:
* In the long term, interested platforms will establish this dependency by
hooking an (upcoming) NULL-class DepexLib instance into AcpiTableDxe in
their DSC files, pointing DepexLib's DEPEX through a FixedAtBuild PCD to
the GUID introduced here. (For the prerequisite BaseTools feature, refer
to <https://bugzilla.tianocore.org/show_bug.cgi?id=444>).
* In the short term, an interested platform may hook a private NULL-class
library instance (called e.g. "PlatformHasAcpiLib") into AcpiTableDxe.
Such a library instance would be a specialization of the above described
generic DepexLib, with the DEPEX open-coded on the GUID introduced here.
Either way, the platform makes EFI_ACPI_TABLE_PROTOCOL and (if enabled)
EFI_ACPI_SDT_PROTOCOL dependent on the platform's dynamic decision to
produce or not to produce a NULL protocol instance with this GUID.
In turn, other (platform and universal) DXE drivers that produce ACPI
tables will wait for EFI_ACPI_TABLE_PROTOCOL / EFI_ACPI_SDT_PROTOCOL, via
DEPEX, protocol notify, or a simple gBS->LocateProtocol() in a "late
enough" callback (such as Ready To Boot).
Because this GUID is not standard, it is prefixed with EDKII / Edkii, as
seen elsewhere in MdeModulePkg and SecurityPkg. In addition, an effort is
made to avoid the phrase "AcpiPlatform", as that belongs to drivers /
libraries that produce platform specific ACPI content (as opposed to
deciding whether the entire firmware will have access to
EFI_ACPI_TABLE_PROTOCOL, or any similar facilities in the PEI phase).
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
Notes:
v3:
- rename gEdkiiPlatformHasAcpiProtocolGuid to gEdkiiPlatformHasAcpiGuid
[Star]
- update commit message and code comments to reflect possible use as a
PPI as well [Star]
- move GUID from ArmPkg to MdeModulePkg [Leif, Ard]
- split PlatformHasAcpiLib to a separate patch [Star]
MdeModulePkg/MdeModulePkg.dec | 3 ++
MdeModulePkg/Include/Guid/PlatformHasAcpi.h | 35 ++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 626e479f5e45..2d94881206d3 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -382,6 +382,9 @@ [Guids]
gEdkiiNonDiscoverableUhciDeviceGuid = { 0xA8CDA0A2, 0x4F37, 0x4A1B, {0x8E, 0x10, 0x8E, 0xF3, 0xCC, 0x3B, 0xF3, 0xA8 } }
gEdkiiNonDiscoverableXhciDeviceGuid = { 0xB1BE0BC5, 0x6C28, 0x442D, {0xAA, 0x37, 0x15, 0x1B, 0x42, 0x57, 0xBD, 0x78 } }
+ ## Include/Guid/PlatformHasAcpi.h
+ gEdkiiPlatformHasAcpiGuid = { 0xf0966b41, 0xc23f, 0x41b9, { 0x96, 0x04, 0x0f, 0xf7, 0xe1, 0x11, 0x96, 0x5a } }
+
[Ppis]
## Include/Ppi/AtaController.h
gPeiAtaControllerPpiGuid = { 0xa45e60d1, 0xc719, 0x44aa, { 0xb0, 0x7a, 0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d }}
diff --git a/MdeModulePkg/Include/Guid/PlatformHasAcpi.h b/MdeModulePkg/Include/Guid/PlatformHasAcpi.h
new file mode 100644
index 000000000000..ad517821375d
--- /dev/null
+++ b/MdeModulePkg/Include/Guid/PlatformHasAcpi.h
@@ -0,0 +1,35 @@
+/** @file
+ EDKII Platform Has ACPI GUID
+
+ A NULL protocol instance with this GUID in the DXE protocol database, and/or
+ a NULL PPI with this GUID in the PPI database, implies that the platform
+ provides the operating system with an ACPI-based hardware description. Note
+ that this is not necessarily exclusive with different kinds of hardware
+ description (for example, a Device Tree-based one). A platform driver and/or
+ PEIM is supposed to produce a single instance of the protocol and/or PPI
+ (with NULL contents), if appropriate.
+
+ Copyright (C) 2017, Red Hat, Inc.
+
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License that 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.
+**/
+
+
+#ifndef __EDKII_PLATFORM_HAS_ACPI_H__
+#define __EDKII_PLATFORM_HAS_ACPI_H__
+
+#define EDKII_PLATFORM_HAS_ACPI_GUID \
+ { \
+ 0xf0966b41, 0xc23f, 0x41b9, \
+ { 0x96, 0x04, 0x0f, 0xf7, 0xe1, 0x11, 0x96, 0x5a } \
+ }
+
+extern EFI_GUID gEdkiiPlatformHasAcpiGuid;
+
+#endif
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v3 04/12] MdeModulePkg: introduce EDKII Platform Has ACPI GUID
2017-03-24 22:38 ` [PATCH v3 04/12] MdeModulePkg: introduce EDKII Platform Has ACPI GUID Laszlo Ersek
@ 2017-03-24 22:41 ` Ard Biesheuvel
2017-03-28 8:20 ` Laszlo Ersek
1 sibling, 0 replies; 18+ messages in thread
From: Ard Biesheuvel @ 2017-03-24 22:41 UTC (permalink / raw)
To: Laszlo Ersek; +Cc: edk2-devel-01, Feng Tian, Leif Lindholm, Star Zeng
On 24 March 2017 at 22:38, Laszlo Ersek <lersek@redhat.com> wrote:
> The presence of this GUID in the PPI database, and/or in the DXE protocol
> database (as dictated by the platform's needs in these firmware phases)
> implies that the platform provides the operating system with an ACPI-based
> hardware description. This is not necessarily exclusive with other types
> of hardware description (for example, a Device Tree-based one).
>
> A platform PEIM and/or DXE driver is supposed to produce a single instance
> of the PPI and/or protocol (with NULL contents), if appropriate. The
> decision to produce the PPI and/or protocol is platform specific; for
> example, in the DXE phase, it could depend on an HII checkbox / underlying
> non-volatile UEFI variable.
>
> In the DXE phase, the protocol is meant to be depended-upon by
> "MdeModulePkg/Universal/Acpi/AcpiTableDxe", indirectly:
>
> * In the long term, interested platforms will establish this dependency by
> hooking an (upcoming) NULL-class DepexLib instance into AcpiTableDxe in
> their DSC files, pointing DepexLib's DEPEX through a FixedAtBuild PCD to
> the GUID introduced here. (For the prerequisite BaseTools feature, refer
> to <https://bugzilla.tianocore.org/show_bug.cgi?id=444>).
>
> * In the short term, an interested platform may hook a private NULL-class
> library instance (called e.g. "PlatformHasAcpiLib") into AcpiTableDxe.
> Such a library instance would be a specialization of the above described
> generic DepexLib, with the DEPEX open-coded on the GUID introduced here.
>
> Either way, the platform makes EFI_ACPI_TABLE_PROTOCOL and (if enabled)
> EFI_ACPI_SDT_PROTOCOL dependent on the platform's dynamic decision to
> produce or not to produce a NULL protocol instance with this GUID.
>
> In turn, other (platform and universal) DXE drivers that produce ACPI
> tables will wait for EFI_ACPI_TABLE_PROTOCOL / EFI_ACPI_SDT_PROTOCOL, via
> DEPEX, protocol notify, or a simple gBS->LocateProtocol() in a "late
> enough" callback (such as Ready To Boot).
>
> Because this GUID is not standard, it is prefixed with EDKII / Edkii, as
> seen elsewhere in MdeModulePkg and SecurityPkg. In addition, an effort is
> made to avoid the phrase "AcpiPlatform", as that belongs to drivers /
> libraries that produce platform specific ACPI content (as opposed to
> deciding whether the entire firmware will have access to
> EFI_ACPI_TABLE_PROTOCOL, or any similar facilities in the PEI phase).
>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Feng Tian <feng.tian@intel.com>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Star Zeng <star.zeng@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>
> Notes:
> v3:
> - rename gEdkiiPlatformHasAcpiProtocolGuid to gEdkiiPlatformHasAcpiGuid
> [Star]
> - update commit message and code comments to reflect possible use as a
> PPI as well [Star]
> - move GUID from ArmPkg to MdeModulePkg [Leif, Ard]
> - split PlatformHasAcpiLib to a separate patch [Star]
>
> MdeModulePkg/MdeModulePkg.dec | 3 ++
> MdeModulePkg/Include/Guid/PlatformHasAcpi.h | 35 ++++++++++++++++++++
> 2 files changed, 38 insertions(+)
>
> diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
> index 626e479f5e45..2d94881206d3 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -382,6 +382,9 @@ [Guids]
> gEdkiiNonDiscoverableUhciDeviceGuid = { 0xA8CDA0A2, 0x4F37, 0x4A1B, {0x8E, 0x10, 0x8E, 0xF3, 0xCC, 0x3B, 0xF3, 0xA8 } }
> gEdkiiNonDiscoverableXhciDeviceGuid = { 0xB1BE0BC5, 0x6C28, 0x442D, {0xAA, 0x37, 0x15, 0x1B, 0x42, 0x57, 0xBD, 0x78 } }
>
> + ## Include/Guid/PlatformHasAcpi.h
> + gEdkiiPlatformHasAcpiGuid = { 0xf0966b41, 0xc23f, 0x41b9, { 0x96, 0x04, 0x0f, 0xf7, 0xe1, 0x11, 0x96, 0x5a } }
> +
> [Ppis]
> ## Include/Ppi/AtaController.h
> gPeiAtaControllerPpiGuid = { 0xa45e60d1, 0xc719, 0x44aa, { 0xb0, 0x7a, 0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d }}
> diff --git a/MdeModulePkg/Include/Guid/PlatformHasAcpi.h b/MdeModulePkg/Include/Guid/PlatformHasAcpi.h
> new file mode 100644
> index 000000000000..ad517821375d
> --- /dev/null
> +++ b/MdeModulePkg/Include/Guid/PlatformHasAcpi.h
> @@ -0,0 +1,35 @@
> +/** @file
> + EDKII Platform Has ACPI GUID
> +
> + A NULL protocol instance with this GUID in the DXE protocol database, and/or
> + a NULL PPI with this GUID in the PPI database, implies that the platform
> + provides the operating system with an ACPI-based hardware description. Note
> + that this is not necessarily exclusive with different kinds of hardware
> + description (for example, a Device Tree-based one). A platform driver and/or
> + PEIM is supposed to produce a single instance of the protocol and/or PPI
> + (with NULL contents), if appropriate.
> +
> + Copyright (C) 2017, Red Hat, Inc.
> +
> + This program and the accompanying materials are licensed and made available
> + under the terms and conditions of the BSD License that 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.
> +**/
> +
> +
> +#ifndef __EDKII_PLATFORM_HAS_ACPI_H__
> +#define __EDKII_PLATFORM_HAS_ACPI_H__
> +
> +#define EDKII_PLATFORM_HAS_ACPI_GUID \
> + { \
> + 0xf0966b41, 0xc23f, 0x41b9, \
> + { 0x96, 0x04, 0x0f, 0xf7, 0xe1, 0x11, 0x96, 0x5a } \
> + }
> +
> +extern EFI_GUID gEdkiiPlatformHasAcpiGuid;
> +
> +#endif
> --
> 2.9.3
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 04/12] MdeModulePkg: introduce EDKII Platform Has ACPI GUID
2017-03-24 22:38 ` [PATCH v3 04/12] MdeModulePkg: introduce EDKII Platform Has ACPI GUID Laszlo Ersek
2017-03-24 22:41 ` Ard Biesheuvel
@ 2017-03-28 8:20 ` Laszlo Ersek
1 sibling, 0 replies; 18+ messages in thread
From: Laszlo Ersek @ 2017-03-28 8:20 UTC (permalink / raw)
To: Feng Tian, Star Zeng
Cc: edk2-devel-01, Leif Lindholm, Ard Biesheuvel, Gao, Liming
Star, Feng,
are you okay with this patch?
As we discussed under the v2 thread, BaseTools don't currently generate
EDKII_PLATFORM_HAS_ACPI_GUID style macros that are usable for
initializing static GUID variables, and GUID fields of static structures.
Therefore the
MdeModulePkg/Include/Guid/PlatformHasAcpi.h
file in this patch adds functionality for which BaseTools have no
substitute.
So, we have the following two options:
(1) I can file a BZ for BaseTools to generate the above static
initializers, *but* for now, we go with this patch as-is, under
MdeModulePkg. If you agree with this, please respond to this patch with
your formal Reviewed-by.
(2) Or else, I will post a v4 of the series, moving this patch back
under ArmPkg, and updating the references in the rest of the patches.
Thanks,
Laszlo
On 03/24/17 23:38, Laszlo Ersek wrote:
> The presence of this GUID in the PPI database, and/or in the DXE protocol
> database (as dictated by the platform's needs in these firmware phases)
> implies that the platform provides the operating system with an ACPI-based
> hardware description. This is not necessarily exclusive with other types
> of hardware description (for example, a Device Tree-based one).
>
> A platform PEIM and/or DXE driver is supposed to produce a single instance
> of the PPI and/or protocol (with NULL contents), if appropriate. The
> decision to produce the PPI and/or protocol is platform specific; for
> example, in the DXE phase, it could depend on an HII checkbox / underlying
> non-volatile UEFI variable.
>
> In the DXE phase, the protocol is meant to be depended-upon by
> "MdeModulePkg/Universal/Acpi/AcpiTableDxe", indirectly:
>
> * In the long term, interested platforms will establish this dependency by
> hooking an (upcoming) NULL-class DepexLib instance into AcpiTableDxe in
> their DSC files, pointing DepexLib's DEPEX through a FixedAtBuild PCD to
> the GUID introduced here. (For the prerequisite BaseTools feature, refer
> to <https://bugzilla.tianocore.org/show_bug.cgi?id=444>).
>
> * In the short term, an interested platform may hook a private NULL-class
> library instance (called e.g. "PlatformHasAcpiLib") into AcpiTableDxe.
> Such a library instance would be a specialization of the above described
> generic DepexLib, with the DEPEX open-coded on the GUID introduced here.
>
> Either way, the platform makes EFI_ACPI_TABLE_PROTOCOL and (if enabled)
> EFI_ACPI_SDT_PROTOCOL dependent on the platform's dynamic decision to
> produce or not to produce a NULL protocol instance with this GUID.
>
> In turn, other (platform and universal) DXE drivers that produce ACPI
> tables will wait for EFI_ACPI_TABLE_PROTOCOL / EFI_ACPI_SDT_PROTOCOL, via
> DEPEX, protocol notify, or a simple gBS->LocateProtocol() in a "late
> enough" callback (such as Ready To Boot).
>
> Because this GUID is not standard, it is prefixed with EDKII / Edkii, as
> seen elsewhere in MdeModulePkg and SecurityPkg. In addition, an effort is
> made to avoid the phrase "AcpiPlatform", as that belongs to drivers /
> libraries that produce platform specific ACPI content (as opposed to
> deciding whether the entire firmware will have access to
> EFI_ACPI_TABLE_PROTOCOL, or any similar facilities in the PEI phase).
>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Feng Tian <feng.tian@intel.com>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Star Zeng <star.zeng@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>
> Notes:
> v3:
> - rename gEdkiiPlatformHasAcpiProtocolGuid to gEdkiiPlatformHasAcpiGuid
> [Star]
> - update commit message and code comments to reflect possible use as a
> PPI as well [Star]
> - move GUID from ArmPkg to MdeModulePkg [Leif, Ard]
> - split PlatformHasAcpiLib to a separate patch [Star]
>
> MdeModulePkg/MdeModulePkg.dec | 3 ++
> MdeModulePkg/Include/Guid/PlatformHasAcpi.h | 35 ++++++++++++++++++++
> 2 files changed, 38 insertions(+)
>
> diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
> index 626e479f5e45..2d94881206d3 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -382,6 +382,9 @@ [Guids]
> gEdkiiNonDiscoverableUhciDeviceGuid = { 0xA8CDA0A2, 0x4F37, 0x4A1B, {0x8E, 0x10, 0x8E, 0xF3, 0xCC, 0x3B, 0xF3, 0xA8 } }
> gEdkiiNonDiscoverableXhciDeviceGuid = { 0xB1BE0BC5, 0x6C28, 0x442D, {0xAA, 0x37, 0x15, 0x1B, 0x42, 0x57, 0xBD, 0x78 } }
>
> + ## Include/Guid/PlatformHasAcpi.h
> + gEdkiiPlatformHasAcpiGuid = { 0xf0966b41, 0xc23f, 0x41b9, { 0x96, 0x04, 0x0f, 0xf7, 0xe1, 0x11, 0x96, 0x5a } }
> +
> [Ppis]
> ## Include/Ppi/AtaController.h
> gPeiAtaControllerPpiGuid = { 0xa45e60d1, 0xc719, 0x44aa, { 0xb0, 0x7a, 0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d }}
> diff --git a/MdeModulePkg/Include/Guid/PlatformHasAcpi.h b/MdeModulePkg/Include/Guid/PlatformHasAcpi.h
> new file mode 100644
> index 000000000000..ad517821375d
> --- /dev/null
> +++ b/MdeModulePkg/Include/Guid/PlatformHasAcpi.h
> @@ -0,0 +1,35 @@
> +/** @file
> + EDKII Platform Has ACPI GUID
> +
> + A NULL protocol instance with this GUID in the DXE protocol database, and/or
> + a NULL PPI with this GUID in the PPI database, implies that the platform
> + provides the operating system with an ACPI-based hardware description. Note
> + that this is not necessarily exclusive with different kinds of hardware
> + description (for example, a Device Tree-based one). A platform driver and/or
> + PEIM is supposed to produce a single instance of the protocol and/or PPI
> + (with NULL contents), if appropriate.
> +
> + Copyright (C) 2017, Red Hat, Inc.
> +
> + This program and the accompanying materials are licensed and made available
> + under the terms and conditions of the BSD License that 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.
> +**/
> +
> +
> +#ifndef __EDKII_PLATFORM_HAS_ACPI_H__
> +#define __EDKII_PLATFORM_HAS_ACPI_H__
> +
> +#define EDKII_PLATFORM_HAS_ACPI_GUID \
> + { \
> + 0xf0966b41, 0xc23f, 0x41b9, \
> + { 0x96, 0x04, 0x0f, 0xf7, 0xe1, 0x11, 0x96, 0x5a } \
> + }
> +
> +extern EFI_GUID gEdkiiPlatformHasAcpiGuid;
> +
> +#endif
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v3 05/12] ArmPkg: introduce PlatformHasAcpiLib
2017-03-24 22:38 [PATCH v3 00/12] ArmVirtPkg: don't forward the DT to the OS if QEMU provides ACPI Laszlo Ersek
` (3 preceding siblings ...)
2017-03-24 22:38 ` [PATCH v3 04/12] MdeModulePkg: introduce EDKII Platform Has ACPI GUID Laszlo Ersek
@ 2017-03-24 22:38 ` Laszlo Ersek
2017-03-24 22:42 ` Ard Biesheuvel
2017-03-24 22:38 ` [PATCH v3 06/12] EmbeddedPkg: introduce EDKII Platform Has Device Tree GUID Laszlo Ersek
` (6 subsequent siblings)
11 siblings, 1 reply; 18+ messages in thread
From: Laszlo Ersek @ 2017-03-24 22:38 UTC (permalink / raw)
To: edk2-devel-01; +Cc: Ard Biesheuvel, Leif Lindholm
Add the shorter-term library instance outlined in the previous
(MdeModulePkg) patch to ArmPkg, so that we can imbue AcpiTableDxe with a
protocol dependency on EDKII_PLATFORM_HAS_ACPI_GUID.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
Notes:
v3:
- move GUID to MdeModulePkg (see previous patch) [Leif, Ard]
- replace ArmPkg.dec package dependency with MdeModulePkg.dec in INF
file
- rename gEdkiiPlatformHasAcpiProtocolGuid to gEdkiiPlatformHasAcpiGuid
[Star]
- update comment in empty constructor function accordingly
ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf | 40 ++++++++++++++++++++
ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.c | 36 ++++++++++++++++++
2 files changed, 76 insertions(+)
diff --git a/ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf b/ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf
new file mode 100644
index 000000000000..0613b0e999d2
--- /dev/null
+++ b/ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf
@@ -0,0 +1,40 @@
+## @file
+# A hook-in library for MdeModulePkg/Universal/Acpi/AcpiTableDxe.
+#
+# Plugging this library instance into AcpiTableDxe makes
+# EFI_ACPI_TABLE_PROTOCOL and (if enabled) EFI_ACPI_SDT_PROTOCOL depend on the
+# platform's dynamic decision whether to expose an ACPI-based hardware
+# description to the operating system.
+#
+# Universal and platform specific DXE drivers that produce ACPI tables depend
+# on EFI_ACPI_TABLE_PROTOCOL / EFI_ACPI_SDT_PROTOCOL in turn.
+#
+# Copyright (C) 2017, Red Hat, Inc.
+#
+# 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.
+##
+
+[Defines]
+ INF_VERSION = 1.25
+ BASE_NAME = PlatformHasAcpiLib
+ FILE_GUID = 29beb028-0958-447b-be0a-12229235d77d
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = PlatformHasAcpiLib|DXE_DRIVER
+ CONSTRUCTOR = PlatformHasAcpiInitialize
+
+[Sources]
+ PlatformHasAcpiLib.c
+
+[Packages]
+ MdeModulePkg/MdeModulePkg.dec
+ MdePkg/MdePkg.dec
+
+[Depex]
+ gEdkiiPlatformHasAcpiGuid
diff --git a/ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.c b/ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.c
new file mode 100644
index 000000000000..2c73e71769eb
--- /dev/null
+++ b/ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.c
@@ -0,0 +1,36 @@
+/** @file
+ A hook-in library for MdeModulePkg/Universal/Acpi/AcpiTableDxe.
+
+ Plugging this library instance into AcpiTableDxe makes
+ EFI_ACPI_TABLE_PROTOCOL and (if enabled) EFI_ACPI_SDT_PROTOCOL depend on the
+ platform's dynamic decision whether to expose an ACPI-based hardware
+ description to the operating system.
+
+ Universal and platform specific DXE drivers that produce ACPI tables depend
+ on EFI_ACPI_TABLE_PROTOCOL / EFI_ACPI_SDT_PROTOCOL in turn.
+
+ Copyright (C) 2017, Red Hat, Inc.
+
+ 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.
+**/
+
+#include <Base.h>
+
+RETURN_STATUS
+EFIAPI
+PlatformHasAcpiInitialize (
+ VOID
+ )
+{
+ //
+ // Do nothing, just imbue AcpiTableDxe with a protocol dependency on
+ // EDKII_PLATFORM_HAS_ACPI_GUID.
+ //
+ return RETURN_SUCCESS;
+}
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v3 05/12] ArmPkg: introduce PlatformHasAcpiLib
2017-03-24 22:38 ` [PATCH v3 05/12] ArmPkg: introduce PlatformHasAcpiLib Laszlo Ersek
@ 2017-03-24 22:42 ` Ard Biesheuvel
0 siblings, 0 replies; 18+ messages in thread
From: Ard Biesheuvel @ 2017-03-24 22:42 UTC (permalink / raw)
To: Laszlo Ersek; +Cc: edk2-devel-01, Leif Lindholm
On 24 March 2017 at 22:38, Laszlo Ersek <lersek@redhat.com> wrote:
> Add the shorter-term library instance outlined in the previous
> (MdeModulePkg) patch to ArmPkg, so that we can imbue AcpiTableDxe with a
> protocol dependency on EDKII_PLATFORM_HAS_ACPI_GUID.
>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>
> Notes:
> v3:
> - move GUID to MdeModulePkg (see previous patch) [Leif, Ard]
> - replace ArmPkg.dec package dependency with MdeModulePkg.dec in INF
> file
> - rename gEdkiiPlatformHasAcpiProtocolGuid to gEdkiiPlatformHasAcpiGuid
> [Star]
> - update comment in empty constructor function accordingly
>
> ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf | 40 ++++++++++++++++++++
> ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.c | 36 ++++++++++++++++++
> 2 files changed, 76 insertions(+)
>
> diff --git a/ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf b/ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf
> new file mode 100644
> index 000000000000..0613b0e999d2
> --- /dev/null
> +++ b/ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf
> @@ -0,0 +1,40 @@
> +## @file
> +# A hook-in library for MdeModulePkg/Universal/Acpi/AcpiTableDxe.
> +#
> +# Plugging this library instance into AcpiTableDxe makes
> +# EFI_ACPI_TABLE_PROTOCOL and (if enabled) EFI_ACPI_SDT_PROTOCOL depend on the
> +# platform's dynamic decision whether to expose an ACPI-based hardware
> +# description to the operating system.
> +#
> +# Universal and platform specific DXE drivers that produce ACPI tables depend
> +# on EFI_ACPI_TABLE_PROTOCOL / EFI_ACPI_SDT_PROTOCOL in turn.
> +#
> +# Copyright (C) 2017, Red Hat, Inc.
> +#
> +# 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.
> +##
> +
> +[Defines]
> + INF_VERSION = 1.25
> + BASE_NAME = PlatformHasAcpiLib
> + FILE_GUID = 29beb028-0958-447b-be0a-12229235d77d
> + MODULE_TYPE = BASE
> + VERSION_STRING = 1.0
> + LIBRARY_CLASS = PlatformHasAcpiLib|DXE_DRIVER
> + CONSTRUCTOR = PlatformHasAcpiInitialize
> +
> +[Sources]
> + PlatformHasAcpiLib.c
> +
> +[Packages]
> + MdeModulePkg/MdeModulePkg.dec
> + MdePkg/MdePkg.dec
> +
> +[Depex]
> + gEdkiiPlatformHasAcpiGuid
> diff --git a/ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.c b/ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.c
> new file mode 100644
> index 000000000000..2c73e71769eb
> --- /dev/null
> +++ b/ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.c
> @@ -0,0 +1,36 @@
> +/** @file
> + A hook-in library for MdeModulePkg/Universal/Acpi/AcpiTableDxe.
> +
> + Plugging this library instance into AcpiTableDxe makes
> + EFI_ACPI_TABLE_PROTOCOL and (if enabled) EFI_ACPI_SDT_PROTOCOL depend on the
> + platform's dynamic decision whether to expose an ACPI-based hardware
> + description to the operating system.
> +
> + Universal and platform specific DXE drivers that produce ACPI tables depend
> + on EFI_ACPI_TABLE_PROTOCOL / EFI_ACPI_SDT_PROTOCOL in turn.
> +
> + Copyright (C) 2017, Red Hat, Inc.
> +
> + 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.
> +**/
> +
> +#include <Base.h>
> +
> +RETURN_STATUS
> +EFIAPI
> +PlatformHasAcpiInitialize (
> + VOID
> + )
> +{
> + //
> + // Do nothing, just imbue AcpiTableDxe with a protocol dependency on
> + // EDKII_PLATFORM_HAS_ACPI_GUID.
> + //
> + return RETURN_SUCCESS;
> +}
> --
> 2.9.3
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v3 06/12] EmbeddedPkg: introduce EDKII Platform Has Device Tree GUID
2017-03-24 22:38 [PATCH v3 00/12] ArmVirtPkg: don't forward the DT to the OS if QEMU provides ACPI Laszlo Ersek
` (4 preceding siblings ...)
2017-03-24 22:38 ` [PATCH v3 05/12] ArmPkg: introduce PlatformHasAcpiLib Laszlo Ersek
@ 2017-03-24 22:38 ` Laszlo Ersek
2017-03-24 22:42 ` Ard Biesheuvel
2017-03-24 22:38 ` [PATCH v3 07/12] ArmVirtPkg: add PlatformHasAcpiDtDxe Laszlo Ersek
` (5 subsequent siblings)
11 siblings, 1 reply; 18+ messages in thread
From: Laszlo Ersek @ 2017-03-24 22:38 UTC (permalink / raw)
To: edk2-devel-01; +Cc: Ard Biesheuvel, Leif Lindholm
The presence of this GUID in the PPI database, and/or in the DXE protocol
database (as dictated by the platform's needs in these firmware phases)
implies that the platform provides the operating system with a Device
Tree-based hardware description. This is not necessarily exclusive with
other types of hardware description (for example, an ACPI-based one).
A platform PEIM and/or DXE driver is supposed to produce a single instance
of the PPI and/or protocol (with NULL contents), if appropriate. The
decision to produce the PPI and/or protocol is platform specific; for
example, in the DXE phase, it could depend on an HII checkbox / underlying
non-volatile UEFI variable.
In the DXE phase, the protocol is meant to be consumed by the platform
driver that
- owns the Device Tree description of the hardware, and
- is responsible for installing it as a system configuration table.
Said FDT-owner driver can wait for the protocol via DEPEX or protocol
notify.
Because this GUID is not standard, it is prefixed with EDKII / Edkii, as
seen elsewhere (for example in MdeModulePkg and SecurityPkg).
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
Notes:
v3:
- move GUID from ArmPkg to EmbeddedPkg [Leif]
- apply the protocol -> generic GUID changes to naming, comments, and
the commit message, that were suggested by Star for the MdeModulePkg /
ACPI counterpart
EmbeddedPkg/EmbeddedPkg.dec | 3 ++
EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h | 35 ++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
index 2c2cf41103c2..002b053a921a 100644
--- a/EmbeddedPkg/EmbeddedPkg.dec
+++ b/EmbeddedPkg/EmbeddedPkg.dec
@@ -56,6 +56,9 @@ [Guids.common]
gFdtHobGuid = { 0x16958446, 0x19B7, 0x480B, { 0xB0, 0x47, 0x74, 0x85, 0xAD, 0x3F, 0x71, 0x6D } }
gFdtVariableGuid = { 0x25a4fd4a, 0x9703, 0x4ba9, { 0xa1, 0x90, 0xb7, 0xc8, 0x4e, 0xfb, 0x3e, 0x57 } }
+ ## Include/Guid/PlatformHasDeviceTree.h
+ gEdkiiPlatformHasDeviceTreeGuid = { 0x7ebb920d, 0x1aaf, 0x46d9, { 0xb2, 0xaf, 0x54, 0x1e, 0x1d, 0xce, 0x14, 0x8b } }
+
[Protocols.common]
gHardwareInterruptProtocolGuid = { 0x2890B3EA, 0x053D, 0x1643, { 0xAD, 0x0C, 0xD6, 0x48, 0x08, 0xDA, 0x3F, 0xF1 } }
gEfiDebugSupportPeriodicCallbackProtocolGuid = { 0x9546e07c, 0x2cbb, 0x4c88, { 0x98, 0x6c, 0xcd, 0x34, 0x10, 0x86, 0xf0, 0x44 } }
diff --git a/EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h b/EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h
new file mode 100644
index 000000000000..a9bc51270cda
--- /dev/null
+++ b/EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h
@@ -0,0 +1,35 @@
+/** @file
+ EDKII Platform Has Device Tree GUID
+
+ A NULL protocol instance with this GUID in the DXE protocol database, and/or
+ a NULL PPI with this GUID in the PPI database, implies that the platform
+ provides the operating system with a Device Tree-based hardware description.
+ Note that this is not necessarily exclusive with different kinds of hardware
+ description (for example, an ACPI-based one). A platform driver and/or PEIM
+ is supposed to produce a single instance of the protocol and/or PPI (with
+ NULL contents), if appropriate.
+
+ Copyright (C) 2017, Red Hat, Inc.
+
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License that 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.
+**/
+
+
+#ifndef __EDKII_PLATFORM_HAS_DEVICE_TREE_H__
+#define __EDKII_PLATFORM_HAS_DEVICE_TREE_H__
+
+#define EDKII_PLATFORM_HAS_DEVICE_TREE_GUID \
+ { \
+ 0x7ebb920d, 0x1aaf, 0x46d9, \
+ { 0xb2, 0xaf, 0x54, 0x1e, 0x1d, 0xce, 0x14, 0x8b } \
+ }
+
+extern EFI_GUID gEdkiiPlatformHasDeviceTreeGuid;
+
+#endif
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v3 06/12] EmbeddedPkg: introduce EDKII Platform Has Device Tree GUID
2017-03-24 22:38 ` [PATCH v3 06/12] EmbeddedPkg: introduce EDKII Platform Has Device Tree GUID Laszlo Ersek
@ 2017-03-24 22:42 ` Ard Biesheuvel
0 siblings, 0 replies; 18+ messages in thread
From: Ard Biesheuvel @ 2017-03-24 22:42 UTC (permalink / raw)
To: Laszlo Ersek; +Cc: edk2-devel-01, Leif Lindholm
On 24 March 2017 at 22:38, Laszlo Ersek <lersek@redhat.com> wrote:
> The presence of this GUID in the PPI database, and/or in the DXE protocol
> database (as dictated by the platform's needs in these firmware phases)
> implies that the platform provides the operating system with a Device
> Tree-based hardware description. This is not necessarily exclusive with
> other types of hardware description (for example, an ACPI-based one).
>
> A platform PEIM and/or DXE driver is supposed to produce a single instance
> of the PPI and/or protocol (with NULL contents), if appropriate. The
> decision to produce the PPI and/or protocol is platform specific; for
> example, in the DXE phase, it could depend on an HII checkbox / underlying
> non-volatile UEFI variable.
>
> In the DXE phase, the protocol is meant to be consumed by the platform
> driver that
> - owns the Device Tree description of the hardware, and
> - is responsible for installing it as a system configuration table.
>
> Said FDT-owner driver can wait for the protocol via DEPEX or protocol
> notify.
>
> Because this GUID is not standard, it is prefixed with EDKII / Edkii, as
> seen elsewhere (for example in MdeModulePkg and SecurityPkg).
>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>
> Notes:
> v3:
> - move GUID from ArmPkg to EmbeddedPkg [Leif]
> - apply the protocol -> generic GUID changes to naming, comments, and
> the commit message, that were suggested by Star for the MdeModulePkg /
> ACPI counterpart
>
> EmbeddedPkg/EmbeddedPkg.dec | 3 ++
> EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h | 35 ++++++++++++++++++++
> 2 files changed, 38 insertions(+)
>
> diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
> index 2c2cf41103c2..002b053a921a 100644
> --- a/EmbeddedPkg/EmbeddedPkg.dec
> +++ b/EmbeddedPkg/EmbeddedPkg.dec
> @@ -56,6 +56,9 @@ [Guids.common]
> gFdtHobGuid = { 0x16958446, 0x19B7, 0x480B, { 0xB0, 0x47, 0x74, 0x85, 0xAD, 0x3F, 0x71, 0x6D } }
> gFdtVariableGuid = { 0x25a4fd4a, 0x9703, 0x4ba9, { 0xa1, 0x90, 0xb7, 0xc8, 0x4e, 0xfb, 0x3e, 0x57 } }
>
> + ## Include/Guid/PlatformHasDeviceTree.h
> + gEdkiiPlatformHasDeviceTreeGuid = { 0x7ebb920d, 0x1aaf, 0x46d9, { 0xb2, 0xaf, 0x54, 0x1e, 0x1d, 0xce, 0x14, 0x8b } }
> +
> [Protocols.common]
> gHardwareInterruptProtocolGuid = { 0x2890B3EA, 0x053D, 0x1643, { 0xAD, 0x0C, 0xD6, 0x48, 0x08, 0xDA, 0x3F, 0xF1 } }
> gEfiDebugSupportPeriodicCallbackProtocolGuid = { 0x9546e07c, 0x2cbb, 0x4c88, { 0x98, 0x6c, 0xcd, 0x34, 0x10, 0x86, 0xf0, 0x44 } }
> diff --git a/EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h b/EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h
> new file mode 100644
> index 000000000000..a9bc51270cda
> --- /dev/null
> +++ b/EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h
> @@ -0,0 +1,35 @@
> +/** @file
> + EDKII Platform Has Device Tree GUID
> +
> + A NULL protocol instance with this GUID in the DXE protocol database, and/or
> + a NULL PPI with this GUID in the PPI database, implies that the platform
> + provides the operating system with a Device Tree-based hardware description.
> + Note that this is not necessarily exclusive with different kinds of hardware
> + description (for example, an ACPI-based one). A platform driver and/or PEIM
> + is supposed to produce a single instance of the protocol and/or PPI (with
> + NULL contents), if appropriate.
> +
> + Copyright (C) 2017, Red Hat, Inc.
> +
> + This program and the accompanying materials are licensed and made available
> + under the terms and conditions of the BSD License that 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.
> +**/
> +
> +
> +#ifndef __EDKII_PLATFORM_HAS_DEVICE_TREE_H__
> +#define __EDKII_PLATFORM_HAS_DEVICE_TREE_H__
> +
> +#define EDKII_PLATFORM_HAS_DEVICE_TREE_GUID \
> + { \
> + 0x7ebb920d, 0x1aaf, 0x46d9, \
> + { 0xb2, 0xaf, 0x54, 0x1e, 0x1d, 0xce, 0x14, 0x8b } \
> + }
> +
> +extern EFI_GUID gEdkiiPlatformHasDeviceTreeGuid;
> +
> +#endif
> --
> 2.9.3
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v3 07/12] ArmVirtPkg: add PlatformHasAcpiDtDxe
2017-03-24 22:38 [PATCH v3 00/12] ArmVirtPkg: don't forward the DT to the OS if QEMU provides ACPI Laszlo Ersek
` (5 preceding siblings ...)
2017-03-24 22:38 ` [PATCH v3 06/12] EmbeddedPkg: introduce EDKII Platform Has Device Tree GUID Laszlo Ersek
@ 2017-03-24 22:38 ` Laszlo Ersek
2017-03-24 22:38 ` [PATCH v3 08/12] ArmVirtPkg: add XenPlatformHasAcpiDtDxe Laszlo Ersek
` (4 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Laszlo Ersek @ 2017-03-24 22:38 UTC (permalink / raw)
To: edk2-devel-01; +Cc: Ard Biesheuvel, Leif Lindholm
This driver produces the EDKII Platform Has ACPI and Platform Has Device
Tree protocols, exactly matching the current ACPI / DT exposure on QEMU,
according to ARM vs. AARCH64, and (in the latter case) to PcdPureAcpiBoot.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
Notes:
v3:
- update package dependencies in INF file according to the GUID
relocations in prior patches (replace ArmPkg.dec with EmbeddedPkg.dec
and MdeModulePkg.dec)
- rename gEdkiiPlatformHasAcpiProtocolGuid -> gEdkiiPlatformHasAcpiGuid
- rename gEdkiiPlatformHasDeviceTreeProtocolGuid ->
gEdkiiPlatformHasDeviceTreeGuid
- adapt include paths and INF sections to protocol -> general GUID
change
- pick up Ard's R-b
ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf | 48 ++++++++++++
ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c | 77 ++++++++++++++++++++
2 files changed, 125 insertions(+)
diff --git a/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf b/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf
new file mode 100644
index 000000000000..e77bb04e2e9d
--- /dev/null
+++ b/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf
@@ -0,0 +1,48 @@
+## @file
+# Decide whether the firmware should expose an ACPI- and/or a Device Tree-based
+# hardware description to the operating system.
+#
+# Copyright (c) 2017, Red Hat, Inc.
+#
+# 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.
+##
+
+[Defines]
+ INF_VERSION = 1.25
+ BASE_NAME = PlatformHasAcpiDtDxe
+ FILE_GUID = 9d1dd27f-6d7f-427b-aec4-b62f6279c2f1
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = PlatformHasAcpiDt
+
+[Sources]
+ PlatformHasAcpiDtDxe.c
+
+[Packages]
+ ArmVirtPkg/ArmVirtPkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ DebugLib
+ PcdLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+
+[Guids]
+ gEdkiiPlatformHasAcpiGuid ## SOMETIMES_PRODUCES ## PROTOCOL
+ gEdkiiPlatformHasDeviceTreeGuid ## SOMETIMES_PRODUCES ## PROTOCOL
+
+[FeaturePcd]
+ gArmVirtTokenSpaceGuid.PcdPureAcpiBoot ## CONSUMES
+
+[Depex]
+ TRUE
diff --git a/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c b/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c
new file mode 100644
index 000000000000..a718ce1b5a7b
--- /dev/null
+++ b/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c
@@ -0,0 +1,77 @@
+/** @file
+ Decide whether the firmware should expose an ACPI- and/or a Device Tree-based
+ hardware description to the operating system.
+
+ Copyright (c) 2017, Red Hat, Inc.
+
+ 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.
+**/
+
+#include <Guid/PlatformHasAcpi.h>
+#include <Guid/PlatformHasDeviceTree.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+
+EFI_STATUS
+EFIAPI
+PlatformHasAcpiDt (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = EFI_SUCCESS;
+
+ //
+ // If we fail to install any of the necessary protocols below, the OS will be
+ // unbootable anyway (due to lacking hardware description), so tolerate no
+ // errors here.
+ //
+ // Always make ACPI available on 64-bit systems.
+ //
+ if (MAX_UINTN == MAX_UINT64) {
+ Status = gBS->InstallProtocolInterface (
+ &ImageHandle,
+ &gEdkiiPlatformHasAcpiGuid,
+ EFI_NATIVE_INTERFACE,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ goto Failed;
+ }
+ }
+
+ //
+ // Expose the Device Tree unless PcdPureAcpiBoot is set.
+ //
+ if (!FeaturePcdGet (PcdPureAcpiBoot)) {
+ Status = gBS->InstallProtocolInterface (
+ &ImageHandle,
+ &gEdkiiPlatformHasDeviceTreeGuid,
+ EFI_NATIVE_INTERFACE,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ goto Failed;
+ }
+ }
+
+ return Status;
+
+Failed:
+ ASSERT_EFI_ERROR (Status);
+ CpuDeadLoop ();
+ //
+ // Keep compilers happy.
+ //
+ return Status;
+}
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 08/12] ArmVirtPkg: add XenPlatformHasAcpiDtDxe
2017-03-24 22:38 [PATCH v3 00/12] ArmVirtPkg: don't forward the DT to the OS if QEMU provides ACPI Laszlo Ersek
` (6 preceding siblings ...)
2017-03-24 22:38 ` [PATCH v3 07/12] ArmVirtPkg: add PlatformHasAcpiDtDxe Laszlo Ersek
@ 2017-03-24 22:38 ` Laszlo Ersek
2017-03-24 22:38 ` [PATCH v3 09/12] ArmVirtPkg: enable AcpiTableDxe and EFI_ACPI_TABLE_PROTOCOL dynamically Laszlo Ersek
` (3 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Laszlo Ersek @ 2017-03-24 22:38 UTC (permalink / raw)
To: edk2-devel-01; +Cc: Ard Biesheuvel, Leif Lindholm
This driver produces the EDKII Platform Has ACPI and Platform Has Device
Tree protocols, exactly matching the current ACPI / DT exposure on Xen,
according to ARM vs. AARCH64. At this point it differs from the QEMU
driver PlatformHasAcpiDtDxe in that this one always installs the DT.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
Notes:
v3:
- update package dependencies in INF file according to the GUID
relocations in prior patches (replace ArmPkg.dec with EmbeddedPkg.dec
and MdeModulePkg.dec)
- drop superfluous ArmVirtPkg.dec package dependency
- rename gEdkiiPlatformHasAcpiProtocolGuid -> gEdkiiPlatformHasAcpiGuid
- rename gEdkiiPlatformHasDeviceTreeProtocolGuid ->
gEdkiiPlatformHasDeviceTreeGuid
- adapt include paths and INF sections to protocol -> general GUID
change
- pick up Ard's R-b
ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.inf | 43 ++++++++++++
ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.c | 72 ++++++++++++++++++++
2 files changed, 115 insertions(+)
diff --git a/ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.inf b/ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.inf
new file mode 100644
index 000000000000..26965c50c12b
--- /dev/null
+++ b/ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.inf
@@ -0,0 +1,43 @@
+## @file
+# Decide whether the firmware should expose an ACPI- and/or a Device Tree-based
+# hardware description to the operating system.
+#
+# Copyright (c) 2017, Red Hat, Inc.
+#
+# 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.
+##
+
+[Defines]
+ INF_VERSION = 1.25
+ BASE_NAME = XenPlatformHasAcpiDtDxe
+ FILE_GUID = 6914c46f-d46e-48dc-9998-8a5f64f02553
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = XenPlatformHasAcpiDt
+
+[Sources]
+ XenPlatformHasAcpiDtDxe.c
+
+[Packages]
+ EmbeddedPkg/EmbeddedPkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ BaseLib
+ DebugLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+
+[Guids]
+ gEdkiiPlatformHasAcpiGuid ## SOMETIMES_PRODUCES ## PROTOCOL
+ gEdkiiPlatformHasDeviceTreeGuid ## PRODUCES ## PROTOCOL
+
+[Depex]
+ TRUE
diff --git a/ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.c b/ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.c
new file mode 100644
index 000000000000..596f4ea8ddca
--- /dev/null
+++ b/ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.c
@@ -0,0 +1,72 @@
+/** @file
+ Decide whether the firmware should expose an ACPI- and/or a Device Tree-based
+ hardware description to the operating system.
+
+ Copyright (c) 2017, Red Hat, Inc.
+
+ 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.
+**/
+
+#include <Guid/PlatformHasAcpi.h>
+#include <Guid/PlatformHasDeviceTree.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+
+EFI_STATUS
+EFIAPI
+XenPlatformHasAcpiDt (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ //
+ // If we fail to install any of the necessary protocols below, the OS will be
+ // unbootable anyway (due to lacking hardware description), so tolerate no
+ // errors here.
+ //
+ // Always make ACPI available on 64-bit systems.
+ //
+ if (MAX_UINTN == MAX_UINT64) {
+ Status = gBS->InstallProtocolInterface (
+ &ImageHandle,
+ &gEdkiiPlatformHasAcpiGuid,
+ EFI_NATIVE_INTERFACE,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ goto Failed;
+ }
+ }
+
+ //
+ // Expose the Device Tree unconditionally.
+ //
+ Status = gBS->InstallProtocolInterface (
+ &ImageHandle,
+ &gEdkiiPlatformHasDeviceTreeGuid,
+ EFI_NATIVE_INTERFACE,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ goto Failed;
+ }
+
+ return Status;
+
+Failed:
+ ASSERT_EFI_ERROR (Status);
+ CpuDeadLoop ();
+ //
+ // Keep compilers happy.
+ //
+ return Status;
+}
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 09/12] ArmVirtPkg: enable AcpiTableDxe and EFI_ACPI_TABLE_PROTOCOL dynamically
2017-03-24 22:38 [PATCH v3 00/12] ArmVirtPkg: don't forward the DT to the OS if QEMU provides ACPI Laszlo Ersek
` (7 preceding siblings ...)
2017-03-24 22:38 ` [PATCH v3 08/12] ArmVirtPkg: add XenPlatformHasAcpiDtDxe Laszlo Ersek
@ 2017-03-24 22:38 ` Laszlo Ersek
2017-03-24 22:43 ` Ard Biesheuvel
2017-03-24 22:38 ` [PATCH v3 10/12] ArmVirtPkg/FdtClientDxe: install DT as sysconfig table in protocol notify Laszlo Ersek
` (2 subsequent siblings)
11 siblings, 1 reply; 18+ messages in thread
From: Laszlo Ersek @ 2017-03-24 22:38 UTC (permalink / raw)
To: edk2-devel-01; +Cc: Ard Biesheuvel, Leif Lindholm
In this patch, the ACPI protocol / driver chain is enabled dynamically,
when appropriate. This is being done in one larger patch, because
ArmVirt.dsc.inc, where AcpiTableDxe is built, is used by all the platform
DSCs.
No change in behavior should be observable after this patch on any
ArmVirtPkg platform.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
Notes:
v3:
- don't enable dynamism for 32-bit (ARM) [Ard]
ArmVirtPkg/ArmVirt.dsc.inc | 9 ++++++++-
ArmVirtPkg/ArmVirtQemu.dsc | 1 +
ArmVirtPkg/ArmVirtQemuKernel.dsc | 1 +
ArmVirtPkg/ArmVirtXen.dsc | 1 +
ArmVirtPkg/ArmVirtXen.fdf | 1 +
ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 1 +
6 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index f61fd0680612..90ab97c240a1 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -443,5 +443,12 @@ [Components.AARCH64]
#
# ACPI Support
#
- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+ MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf {
+ <LibraryClasses>
+ NULL|ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf
+ }
+
+ #
+ # EBC support
+ #
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 4b556f309a6c..c2427a6fcea2 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -382,6 +382,7 @@ [Components.AARCH64]
#
# ACPI Support
#
+ ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf {
<LibraryClasses>
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index 6b6555c889a3..c7317a056c0e 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -371,6 +371,7 @@ [Components.AARCH64]
#
# ACPI Support
#
+ ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf {
<LibraryClasses>
diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
index 3422d1e5d996..679ca67ffa0f 100644
--- a/ArmVirtPkg/ArmVirtXen.dsc
+++ b/ArmVirtPkg/ArmVirtXen.dsc
@@ -222,5 +222,6 @@ [Components.common]
# ACPI support
#
!if $(ARCH) == AARCH64
+ ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.inf
ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
!endif
diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
index c997251b12b8..aaae9755cd53 100644
--- a/ArmVirtPkg/ArmVirtXen.fdf
+++ b/ArmVirtPkg/ArmVirtXen.fdf
@@ -184,6 +184,7 @@ [FV.FvMain]
# ACPI support
#
!if $(ARCH) == AARCH64
+ INF ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.inf
INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
INF ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
index cc5d12aaefea..b4381132c864 100644
--- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
+++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
@@ -144,6 +144,7 @@ [FV.FvMain]
#
# ACPI Support
#
+ INF ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf
INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
INF OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v3 09/12] ArmVirtPkg: enable AcpiTableDxe and EFI_ACPI_TABLE_PROTOCOL dynamically
2017-03-24 22:38 ` [PATCH v3 09/12] ArmVirtPkg: enable AcpiTableDxe and EFI_ACPI_TABLE_PROTOCOL dynamically Laszlo Ersek
@ 2017-03-24 22:43 ` Ard Biesheuvel
0 siblings, 0 replies; 18+ messages in thread
From: Ard Biesheuvel @ 2017-03-24 22:43 UTC (permalink / raw)
To: Laszlo Ersek; +Cc: edk2-devel-01, Leif Lindholm
On 24 March 2017 at 22:38, Laszlo Ersek <lersek@redhat.com> wrote:
> In this patch, the ACPI protocol / driver chain is enabled dynamically,
> when appropriate. This is being done in one larger patch, because
> ArmVirt.dsc.inc, where AcpiTableDxe is built, is used by all the platform
> DSCs.
>
> No change in behavior should be observable after this patch on any
> ArmVirtPkg platform.
>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>
> Notes:
> v3:
> - don't enable dynamism for 32-bit (ARM) [Ard]
>
> ArmVirtPkg/ArmVirt.dsc.inc | 9 ++++++++-
> ArmVirtPkg/ArmVirtQemu.dsc | 1 +
> ArmVirtPkg/ArmVirtQemuKernel.dsc | 1 +
> ArmVirtPkg/ArmVirtXen.dsc | 1 +
> ArmVirtPkg/ArmVirtXen.fdf | 1 +
> ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 1 +
> 6 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> index f61fd0680612..90ab97c240a1 100644
> --- a/ArmVirtPkg/ArmVirt.dsc.inc
> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> @@ -443,5 +443,12 @@ [Components.AARCH64]
> #
> # ACPI Support
> #
> - MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf {
> + <LibraryClasses>
> + NULL|ArmPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf
> + }
> +
> + #
> + # EBC support
> + #
> MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
> index 4b556f309a6c..c2427a6fcea2 100644
> --- a/ArmVirtPkg/ArmVirtQemu.dsc
> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
> @@ -382,6 +382,7 @@ [Components.AARCH64]
> #
> # ACPI Support
> #
> + ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf
> MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
> OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf {
> <LibraryClasses>
> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
> index 6b6555c889a3..c7317a056c0e 100644
> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
> @@ -371,6 +371,7 @@ [Components.AARCH64]
> #
> # ACPI Support
> #
> + ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf
> MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
> OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf {
> <LibraryClasses>
> diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc
> index 3422d1e5d996..679ca67ffa0f 100644
> --- a/ArmVirtPkg/ArmVirtXen.dsc
> +++ b/ArmVirtPkg/ArmVirtXen.dsc
> @@ -222,5 +222,6 @@ [Components.common]
> # ACPI support
> #
> !if $(ARCH) == AARCH64
> + ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.inf
> ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
> !endif
> diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
> index c997251b12b8..aaae9755cd53 100644
> --- a/ArmVirtPkg/ArmVirtXen.fdf
> +++ b/ArmVirtPkg/ArmVirtXen.fdf
> @@ -184,6 +184,7 @@ [FV.FvMain]
> # ACPI support
> #
> !if $(ARCH) == AARCH64
> + INF ArmVirtPkg/XenPlatformHasAcpiDtDxe/XenPlatformHasAcpiDtDxe.inf
> INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> INF ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
>
> diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
> index cc5d12aaefea..b4381132c864 100644
> --- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
> +++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
> @@ -144,6 +144,7 @@ [FV.FvMain]
> #
> # ACPI Support
> #
> + INF ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf
> INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
> INF OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
> --
> 2.9.3
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v3 10/12] ArmVirtPkg/FdtClientDxe: install DT as sysconfig table in protocol notify
2017-03-24 22:38 [PATCH v3 00/12] ArmVirtPkg: don't forward the DT to the OS if QEMU provides ACPI Laszlo Ersek
` (8 preceding siblings ...)
2017-03-24 22:38 ` [PATCH v3 09/12] ArmVirtPkg: enable AcpiTableDxe and EFI_ACPI_TABLE_PROTOCOL dynamically Laszlo Ersek
@ 2017-03-24 22:38 ` Laszlo Ersek
2017-03-24 22:38 ` [PATCH v3 11/12] ArmVirtPkg/PlatformHasAcpiDtDxe: don't expose DT if QEMU provides ACPI Laszlo Ersek
2017-03-24 22:38 ` [PATCH v3 12/12] ArmVirtPkg: remove PURE_ACPI_BOOT_ENABLE and PcdPureAcpiBoot Laszlo Ersek
11 siblings, 0 replies; 18+ messages in thread
From: Laszlo Ersek @ 2017-03-24 22:38 UTC (permalink / raw)
To: edk2-devel-01; +Cc: Ard Biesheuvel, Leif Lindholm
Replace the dependency on PcdPureAcpiBoot with a Platform Has Device Tree
notification callback. Move the sysconfig table installation from the
entry point function to the callback.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
Notes:
v3:
- replace gEdkiiPlatformHasDeviceTreeProtocolGuid with
gEdkiiPlatformHasDeviceTreeGuid
- adapt Protocols / Guids sections in INF file
- drop now superfluous ArmPkg.dec dependency in INF file
- adapt include paths
- pick up Ard's R-b
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf | 4 +-
ArmVirtPkg/FdtClientDxe/FdtClientDxe.c | 105 ++++++++++++++++++--
2 files changed, 97 insertions(+), 12 deletions(-)
diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
index 3a0cd37040eb..8a5182a3ce99 100644
--- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
@@ -42,11 +42,9 @@ [Protocols]
gFdtClientProtocolGuid ## PRODUCES
[Guids]
+ gEdkiiPlatformHasDeviceTreeGuid ## CONSUMES ## PROTOCOL
gFdtHobGuid
gFdtTableGuid
-[FeaturePcd]
- gArmVirtTokenSpaceGuid.PcdPureAcpiBoot
-
[Depex]
TRUE
diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
index 547a29fce62c..2d867b16fda8 100644
--- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
+++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
@@ -22,6 +22,7 @@
#include <Guid/Fdt.h>
#include <Guid/FdtHob.h>
+#include <Guid/PlatformHasDeviceTree.h>
#include <Protocol/FdtClient.h>
@@ -306,6 +307,40 @@ STATIC FDT_CLIENT_PROTOCOL mFdtClientProtocol = {
GetOrInsertChosenNode,
};
+STATIC
+VOID
+EFIAPI
+OnPlatformHasDeviceTree (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+ VOID *Interface;
+ VOID *DeviceTreeBase;
+
+ Status = gBS->LocateProtocol (
+ &gEdkiiPlatformHasDeviceTreeGuid,
+ NULL, // Registration
+ &Interface
+ );
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ DeviceTreeBase = Context;
+ DEBUG ((
+ DEBUG_INFO,
+ "%a: exposing DTB @ 0x%p to OS\n",
+ __FUNCTION__,
+ DeviceTreeBase
+ ));
+ Status = gBS->InstallConfigurationTable (&gFdtTableGuid, DeviceTreeBase);
+ ASSERT_EFI_ERROR (Status);
+
+ gBS->CloseEvent (Event);
+}
+
EFI_STATUS
EFIAPI
InitializeFdtClientDxe (
@@ -316,6 +351,8 @@ InitializeFdtClientDxe (
VOID *Hob;
VOID *DeviceTreeBase;
EFI_STATUS Status;
+ EFI_EVENT PlatformHasDeviceTreeEvent;
+ VOID *Registration;
Hob = GetFirstGuidHob (&gFdtHobGuid);
if (Hob == NULL || GET_GUID_HOB_DATA_SIZE (Hob) != sizeof (UINT64)) {
@@ -333,15 +370,65 @@ InitializeFdtClientDxe (
DEBUG ((EFI_D_INFO, "%a: DTB @ 0x%p\n", __FUNCTION__, mDeviceTreeBase));
- if (!FeaturePcdGet (PcdPureAcpiBoot)) {
- //
- // Only install the FDT as a configuration table if we want to leave it up
- // to the OS to decide whether it prefers ACPI over DT.
- //
- Status = gBS->InstallConfigurationTable (&gFdtTableGuid, DeviceTreeBase);
- ASSERT_EFI_ERROR (Status);
+ //
+ // Register a protocol notify for the EDKII Platform Has Device Tree
+ // Protocol.
+ //
+ Status = gBS->CreateEvent (
+ EVT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ OnPlatformHasDeviceTree,
+ DeviceTreeBase, // Context
+ &PlatformHasDeviceTreeEvent
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: CreateEvent(): %r\n", __FUNCTION__, Status));
+ return Status;
}
- return gBS->InstallProtocolInterface (&ImageHandle, &gFdtClientProtocolGuid,
- EFI_NATIVE_INTERFACE, &mFdtClientProtocol);
+ Status = gBS->RegisterProtocolNotify (
+ &gEdkiiPlatformHasDeviceTreeGuid,
+ PlatformHasDeviceTreeEvent,
+ &Registration
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: RegisterProtocolNotify(): %r\n",
+ __FUNCTION__,
+ Status
+ ));
+ goto CloseEvent;
+ }
+
+ //
+ // Kick the event; the protocol could be available already.
+ //
+ Status = gBS->SignalEvent (PlatformHasDeviceTreeEvent);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: SignalEvent(): %r\n", __FUNCTION__, Status));
+ goto CloseEvent;
+ }
+
+ Status = gBS->InstallProtocolInterface (
+ &ImageHandle,
+ &gFdtClientProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mFdtClientProtocol
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: InstallProtocolInterface(): %r\n",
+ __FUNCTION__,
+ Status
+ ));
+ goto CloseEvent;
+ }
+
+ return Status;
+
+CloseEvent:
+ gBS->CloseEvent (PlatformHasDeviceTreeEvent);
+ return Status;
}
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 11/12] ArmVirtPkg/PlatformHasAcpiDtDxe: don't expose DT if QEMU provides ACPI
2017-03-24 22:38 [PATCH v3 00/12] ArmVirtPkg: don't forward the DT to the OS if QEMU provides ACPI Laszlo Ersek
` (9 preceding siblings ...)
2017-03-24 22:38 ` [PATCH v3 10/12] ArmVirtPkg/FdtClientDxe: install DT as sysconfig table in protocol notify Laszlo Ersek
@ 2017-03-24 22:38 ` Laszlo Ersek
2017-03-24 22:38 ` [PATCH v3 12/12] ArmVirtPkg: remove PURE_ACPI_BOOT_ENABLE and PcdPureAcpiBoot Laszlo Ersek
11 siblings, 0 replies; 18+ messages in thread
From: Laszlo Ersek @ 2017-03-24 22:38 UTC (permalink / raw)
To: edk2-devel-01; +Cc: Ard Biesheuvel, Leif Lindholm
This will let QEMU's "-no-acpi" option exclusively expose DT vs. ACPI to
the guest. Showing both is never needed (it is actually detrimental to the
adoption of standards, such as SBSA / SBBR).
* Without "-no-acpi", the firmware logs (from PlatformHasAcpiDtDxe)
> Found FwCfg @ 0x9020008/0x9020000
> Found FwCfg DMA @ 0x9020010
> InstallProtocolInterface: [EdkiiPlatformHasAcpi] 0
plus the usual messages. Later the guest kernel logs
> [ 0.000000] efi: SMBIOS 3.0=0x13bdb0000 ACPI 2.0=0x138440000
> MEMATTR=0x13a675018
before it lists the ACPI tables one by one.
In addition, in the guest, the "/sys/firmware/devicetree/*" shell pattern
matches no files, while the "/sys/firmware/acpi/tables/*" pattern matches
the ACPI tables.
* With "-no-acpi", the firmware logs:
> PlatformHasAcpiDtDxe | Found FwCfg @ 0x9020008/0x9020000
> PlatformHasAcpiDtDxe | Found FwCfg DMA @ 0x9020010
> PlatformHasAcpiDtDxe | InstallProtocolInterface:
> PlatformHasAcpiDtDxe | [EdkiiPlatformHasDeviceTree] 0
> FdtClientDxe | OnPlatformHasDeviceTree: exposing DTB @
> FdtClientDxe | 0x13FFBF000 to OS
> ...
> DXE_CORE | Driver [AcpiTableDxe] was discovered but not
> DXE_CORE | loaded!!
> DXE_CORE | Driver [QemuFwCfgAcpiPlatform] was discovered but
> DXE_CORE | not loaded!!
> ...
> RamDiskDxe | RamDiskAcpiCheck: Cannot locate the EFI ACPI
> RamDiskDxe | Table Protocol, unable to publish RAM disks to
> RamDiskDxe | NFIT.
(BootGraphicsResourceTableDxe's ReadyToBoot callback --
InstallBootGraphicsResourceTable() -- handles the lack of
EFI_ACPI_TABLE_PROTOCOL silently.) Later the guest kernel logs
> [ 0.000000] efi: SMBIOS 3.0=0x13bdb0000 MEMATTR=0x138caa018
In addition, in the guest, the "/sys/firmware/devicetree/*" shell pattern
matches the directory "/sys/firmware/devicetree/base", which contains a
large number of DT nodes, while the "/sys/firmware/acpi/tables/*" pattern
matches no files.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1430262
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
Notes:
v3:
- pick up MEMATTR log from repeated testing with Fedora guest (ACPI
case) [Ard]
- extend the commit message with "/sys/firmware/devicetree/*" and
"/sys/firmware/acpi/tables/*" pattern matching in the guest
- drop ArmVirtPkg.dec package dependency -- with the removal of the
"pure ACPI boot" PCD dependency, ArmVirtPkg.dec actually becomes
superfluous
- adapt patch to protocol -> generic GUID renaming
- pick up Ard's R-b
ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf | 7 +--
ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c | 45 ++++++++++++--------
2 files changed, 29 insertions(+), 23 deletions(-)
diff --git a/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf b/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf
index e77bb04e2e9d..3fcbb6b080d8 100644
--- a/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf
+++ b/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf
@@ -25,15 +25,15 @@ [Sources]
PlatformHasAcpiDtDxe.c
[Packages]
- ArmVirtPkg/ArmVirtPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec
+ OvmfPkg/OvmfPkg.dec
[LibraryClasses]
BaseLib
DebugLib
- PcdLib
+ QemuFwCfgLib
UefiBootServicesTableLib
UefiDriverEntryPoint
@@ -41,8 +41,5 @@ [Guids]
gEdkiiPlatformHasAcpiGuid ## SOMETIMES_PRODUCES ## PROTOCOL
gEdkiiPlatformHasDeviceTreeGuid ## SOMETIMES_PRODUCES ## PROTOCOL
-[FeaturePcd]
- gArmVirtTokenSpaceGuid.PcdPureAcpiBoot ## CONSUMES
-
[Depex]
TRUE
diff --git a/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c b/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c
index a718ce1b5a7b..8932dacabec5 100644
--- a/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c
+++ b/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c
@@ -17,7 +17,7 @@
#include <Guid/PlatformHasDeviceTree.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
+#include <Library/QemuFwCfgLib.h>
#include <Library/UefiBootServicesTableLib.h>
EFI_STATUS
@@ -27,18 +27,27 @@ PlatformHasAcpiDt (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
+ EFI_STATUS Status;
+ FIRMWARE_CONFIG_ITEM FwCfgItem;
+ UINTN FwCfgSize;
//
// If we fail to install any of the necessary protocols below, the OS will be
// unbootable anyway (due to lacking hardware description), so tolerate no
// errors here.
//
- // Always make ACPI available on 64-bit systems.
- //
- if (MAX_UINTN == MAX_UINT64) {
+ if (MAX_UINTN == MAX_UINT64 &&
+ !EFI_ERROR (
+ QemuFwCfgFindFile (
+ "etc/table-loader",
+ &FwCfgItem,
+ &FwCfgSize
+ )
+ )) {
+ //
+ // Only make ACPI available on 64-bit systems, and only if QEMU generates
+ // (a subset of) the ACPI tables.
+ //
Status = gBS->InstallProtocolInterface (
&ImageHandle,
&gEdkiiPlatformHasAcpiGuid,
@@ -48,21 +57,21 @@ PlatformHasAcpiDt (
if (EFI_ERROR (Status)) {
goto Failed;
}
+
+ return Status;
}
//
- // Expose the Device Tree unless PcdPureAcpiBoot is set.
+ // Expose the Device Tree otherwise.
//
- if (!FeaturePcdGet (PcdPureAcpiBoot)) {
- Status = gBS->InstallProtocolInterface (
- &ImageHandle,
- &gEdkiiPlatformHasDeviceTreeGuid,
- EFI_NATIVE_INTERFACE,
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto Failed;
- }
+ Status = gBS->InstallProtocolInterface (
+ &ImageHandle,
+ &gEdkiiPlatformHasDeviceTreeGuid,
+ EFI_NATIVE_INTERFACE,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ goto Failed;
}
return Status;
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 12/12] ArmVirtPkg: remove PURE_ACPI_BOOT_ENABLE and PcdPureAcpiBoot
2017-03-24 22:38 [PATCH v3 00/12] ArmVirtPkg: don't forward the DT to the OS if QEMU provides ACPI Laszlo Ersek
` (10 preceding siblings ...)
2017-03-24 22:38 ` [PATCH v3 11/12] ArmVirtPkg/PlatformHasAcpiDtDxe: don't expose DT if QEMU provides ACPI Laszlo Ersek
@ 2017-03-24 22:38 ` Laszlo Ersek
11 siblings, 0 replies; 18+ messages in thread
From: Laszlo Ersek @ 2017-03-24 22:38 UTC (permalink / raw)
To: edk2-devel-01; +Cc: Ard Biesheuvel, Leif Lindholm
The build flag and the FeaturePCD have no effect any longer, remove them.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
Notes:
v3:
- pick up Ard's R-b
ArmVirtPkg/ArmVirtPkg.dec | 10 ----------
ArmVirtPkg/ArmVirtQemu.dsc | 5 -----
2 files changed, 15 deletions(-)
diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec
index a5ec42166445..efe83a383d55 100644
--- a/ArmVirtPkg/ArmVirtPkg.dec
+++ b/ArmVirtPkg/ArmVirtPkg.dec
@@ -58,13 +58,3 @@ [PcdsFixedAtBuild, PcdsPatchableInModule]
# EFI_VT_100_GUID.
#
gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x65, 0x60, 0xA6, 0xDF, 0x19, 0xB4, 0xD3, 0x11, 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D}|VOID*|0x00000007
-
-[PcdsFeatureFlag]
- #
- # Pure ACPI boot
- #
- # Inhibit installation of the FDT as a configuration table if this feature
- # PCD is TRUE. Otherwise, the OS is presented with both a DT and an ACPI
- # description of the platform, and it is up to the OS to choose.
- #
- gArmVirtTokenSpaceGuid.PcdPureAcpiBoot|FALSE|BOOLEAN|0x0000000a
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index c2427a6fcea2..4075b92aa2cb 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -34,7 +34,6 @@ [Defines]
# -D FLAG=VALUE
#
DEFINE SECURE_BOOT_ENABLE = FALSE
- DEFINE PURE_ACPI_BOOT_ENABLE = FALSE
!include ArmVirtPkg/ArmVirt.dsc.inc
@@ -95,10 +94,6 @@ [PcdsFeatureFlag.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
-!if $(PURE_ACPI_BOOT_ENABLE) == TRUE
- gArmVirtTokenSpaceGuid.PcdPureAcpiBoot|TRUE
-!endif
-
[PcdsFixedAtBuild.common]
gArmPlatformTokenSpaceGuid.PcdCoreCount|1
!if $(ARCH) == AARCH64
--
2.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread