Introduce an ACPI platform driver for ARM / AARCH64 virtual machines. For
the time being it is only a thin wrapper around OvmfPkg's QemuLoaderLib,
ie. it downloads ACPI blobs from QEMU over fw_cfg, processes them, and
installs the resultant ACPI tables.

We deliberately make no attempt to add (or even support) static asl(c)
files built into the firmware, as the targeted VMs have fully dynamic
hardware, and the ACPI payload generated by QEMU is expected to be
self-describing & complete.

Developers are welcome to extend this driver with logic for other
hypervisors -- like Xen -- and to include the driver in the corresponding
platform DSC and FDF files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
---
 ArmPlatformPkg/ArmVirtualizationPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf | 50 
++++++++++++++++++++++++++++++++++++++++++++++++++
 ArmPlatformPkg/ArmVirtualizationPkg/AcpiPlatformDxe/AcpiPlatform.c      | 39 
+++++++++++++++++++++++++++++++++++++++
 ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc           |  1 +
 ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemu.dsc           |  7 
+++++++
 ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemu.fdf           |  6 
++++++
 5 files changed, 103 insertions(+)

diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf 
b/ArmPlatformPkg/ArmVirtualizationPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
new file mode 100644
index 0000000..5d480ec
--- /dev/null
+++ b/ArmPlatformPkg/ArmVirtualizationPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -0,0 +1,50 @@
+## @file
+#  ACPI Platform Driver for ARM/AARCH64 virtual machines.
+#
+#  Copyright (C) 2015, Red Hat, Inc.
+#  Copyright (c) 2008 - 2012, 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.
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = AcpiPlatformDxe
+  FILE_GUID                      = BE0E9D2B-C31B-48AB-8C10-551DC2845D01
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = AcpiPlatformEntryPoint
+
+#
+# The following information is for reference only and not required by the build
+# tools.
+#
+#  VALID_ARCHITECTURES           = ARM AARCH64
+#
+
+[Sources]
+  AcpiPlatform.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  OvmfPkg/OvmfPkg.dec
+
+[LibraryClasses]
+  DebugLib
+  QemuLoaderLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+
+[Protocols]
+  gEfiAcpiTableProtocolGuid                          # PROTOCOL ALWAYS_CONSUMED
+
+[Depex]
+  gEfiAcpiTableProtocolGuid
diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/AcpiPlatformDxe/AcpiPlatform.c 
b/ArmPlatformPkg/ArmVirtualizationPkg/AcpiPlatformDxe/AcpiPlatform.c
new file mode 100644
index 0000000..a7a52d0
--- /dev/null
+++ b/ArmPlatformPkg/ArmVirtualizationPkg/AcpiPlatformDxe/AcpiPlatform.c
@@ -0,0 +1,39 @@
+/** @file
+  ACPI Platform Driver for ARM/AARCH64 virtual machines.
+
+  Copyright (C) 2015, Red Hat, Inc.
+  Copyright (c) 2008 - 2012, 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.
+
+**/
+
+#include <Library/DebugLib.h>
+#include <Library/QemuLoaderLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+
+EFI_STATUS
+EFIAPI
+AcpiPlatformEntryPoint (
+  IN EFI_HANDLE       ImageHandle,
+  IN EFI_SYSTEM_TABLE *SystemTable
+  )
+{
+  EFI_STATUS              Status;
+  EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+
+  //
+  // Our Depex ensures that this always succeeds.
+  //
+  Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid,
+                  NULL /* Registration */, (VOID **)&AcpiTable);
+  ASSERT_EFI_ERROR (Status);
+
+  return InstallAllQemuLinkedTables (AcpiTable);
+}
diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc 
b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc
index b05f1ec..f17cd2f 100644
--- a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc
+++ b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc
@@ -41,12 +41,13 @@
   
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
   
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
   
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
 
   UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
+  
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
 
   #
   # Allow dynamic PCDs
   #
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
 
diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemu.dsc 
b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemu.dsc
index 30e48d1..7509cbb 100644
--- a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemu.dsc
+++ b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemu.dsc
@@ -40,12 +40,13 @@
 
 [LibraryClasses.common]
   # Virtio Support
   VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
   
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
   
QemuFwCfgLib|ArmPlatformPkg/ArmVirtualizationPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
+  QemuLoaderLib|OvmfPkg/Library/QemuLoaderLib/QemuLoaderLib.inf
 
   
ArmPlatformLib|ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/ArmVirtualizationPlatformLib.inf
   
ArmPlatformSysConfigLib|ArmPlatformPkg/Library/ArmPlatformSysConfigLibNull/ArmPlatformSysConfigLibNull.inf
 
   TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
 
@@ -277,6 +278,12 @@
 
   #
   # SCSI Bus and Disk Driver
   #
   MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
   MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
+
+  #
+  # ACPI Support
+  #
+  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+  ArmPlatformPkg/ArmVirtualizationPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemu.fdf 
b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemu.fdf
index 2b71d61..9b94b73 100644
--- a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemu.fdf
+++ b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemu.fdf
@@ -188,12 +188,18 @@ READ_LOCK_STATUS   = TRUE
   #
   # SCSI Bus and Disk Driver
   #
   INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
   INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
 
+  #
+  # ACPI Support
+  #
+  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+  INF ArmPlatformPkg/ArmVirtualizationPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
+
 [FV.FVMAIN_COMPACT]
 FvAlignment        = 16
 ERASE_POLARITY     = 1
 MEMORY_MAPPED      = TRUE
 STICKY_WRITE       = TRUE
 LOCK_CAP           = TRUE
-- 
1.8.3.1


------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to