]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: AcpiPlatformDxe: extract common entry point
authorLaszlo Ersek <lersek@redhat.com>
Thu, 19 Feb 2015 23:45:57 +0000 (23:45 +0000)
committerjljusten <jljusten@Edk2>
Thu, 19 Feb 2015 23:45:57 +0000 (23:45 +0000)
Currently the entry point functions of both driver builds
(AcpiPlatformDxe.inf and QemuFwCfgAcpiPlatformDxe.inf) directly contain
the logic that is different between the two builds.

Because we're going to restructure the entry point logic soon, we'd have
to duplicate the same new code between both entry point functions.

Push down the logic in which they differ to a new function:
- InstallAcpiTables() [AcpiPlatform.c]
- InstallAcpiTables() [QemuFwCfgAcpiPlatform.c]

and extract a common entry point function:
- AcpiPlatformEntryPoint() [EntryPoint.c]

which we can soon modify without code duplication.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16885 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
OvmfPkg/AcpiPlatformDxe/EntryPoint.c [new file with mode: 0644]
OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatform.c [new file with mode: 0644]
OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf

index 8bfb1890b17deaa8bb720734b11cde4764caf253..61166c65c33cd2c366b4b8d11df95f522bff5a43 100644 (file)
@@ -228,7 +228,7 @@ InstallOvmfFvTables (
 }\r
 \r
 /**\r
-  Entrypoint of Acpi Platform driver.\r
+  Effective entrypoint of Acpi Platform driver.\r
 \r
   @param  ImageHandle\r
   @param  SystemTable\r
@@ -240,23 +240,11 @@ InstallOvmfFvTables (
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-AcpiPlatformEntryPoint (\r
-  IN EFI_HANDLE         ImageHandle,\r
-  IN EFI_SYSTEM_TABLE   *SystemTable\r
+InstallAcpiTables (\r
+  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiTable\r
   )\r
 {\r
   EFI_STATUS                         Status;\r
-  EFI_ACPI_TABLE_PROTOCOL            *AcpiTable;\r
-\r
-  //\r
-  // Find the AcpiTable protocol\r
-  //\r
-  Status = gBS->LocateProtocol (\r
-                  &gEfiAcpiTableProtocolGuid,\r
-                  NULL,\r
-                  (VOID**)&AcpiTable\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
 \r
   if (XenDetected ()) {\r
     Status = InstallXenTables (AcpiTable);\r
index ae11e79e110514b1c143f07f5ed523315c864c43..55b380b285057be0b6d7ab683980cf1f3f28eb12 100644 (file)
@@ -67,5 +67,11 @@ InstallQemuFwCfgTables (
   IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol\r
   );\r
 \r
+EFI_STATUS\r
+EFIAPI\r
+InstallAcpiTables (\r
+  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiTable\r
+  );\r
+\r
 #endif\r
 \r
index 53292bf150461412cf52b0c0eb528259be1e5f34..0ba703dcecae1071101fac83514d5d85e989cf5b 100644 (file)
@@ -31,6 +31,7 @@
   Qemu.c\r
   QemuFwCfgAcpi.c\r
   Xen.c\r
+  EntryPoint.c\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
diff --git a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
new file mode 100644 (file)
index 0000000..d782b61
--- /dev/null
@@ -0,0 +1,47 @@
+/** @file\r
+  Entry point of OVMF ACPI Platform Driver\r
+\r
+  Copyright (C) 2015, Red Hat, Inc.\r
+  Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>\r
+\r
+  This program and the accompanying materials are licensed and made available\r
+  under the terms and conditions of the BSD License which accompanies this\r
+  distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
+  WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+\r
+#include "AcpiPlatform.h"\r
+\r
+STATIC\r
+EFI_ACPI_TABLE_PROTOCOL *\r
+FindAcpiTableProtocol (\r
+  VOID\r
+  )\r
+{\r
+  EFI_STATUS              Status;\r
+  EFI_ACPI_TABLE_PROTOCOL *AcpiTable;\r
+\r
+  Status = gBS->LocateProtocol (\r
+                  &gEfiAcpiTableProtocolGuid,\r
+                  NULL,\r
+                  (VOID**)&AcpiTable\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+  return AcpiTable;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+AcpiPlatformEntryPoint (\r
+  IN EFI_HANDLE         ImageHandle,\r
+  IN EFI_SYSTEM_TABLE   *SystemTable\r
+  )\r
+{\r
+  EFI_STATUS Status;\r
+\r
+  Status = InstallAcpiTables (FindAcpiTableProtocol ());\r
+  return Status;\r
+}\r
index 806446ee7fe7a91a76499c194e72b08a49e26d12..81620448a046364149e9dbaf5018c2327438cfa3 100644 (file)
@@ -683,39 +683,3 @@ FreeLoader:
 \r
   return Status;\r
 }\r
-\r
-\r
-/**\r
-  Entrypoint of QEMU fw-cfg Acpi Platform driver.\r
-\r
-  @param  ImageHandle\r
-  @param  SystemTable\r
-\r
-  @return EFI_SUCCESS\r
-  @return EFI_LOAD_ERROR\r
-  @return EFI_OUT_OF_RESOURCES\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-QemuFwCfgAcpiPlatformEntryPoint (\r
-  IN EFI_HANDLE         ImageHandle,\r
-  IN EFI_SYSTEM_TABLE   *SystemTable\r
-  )\r
-{\r
-  EFI_STATUS                         Status;\r
-  EFI_ACPI_TABLE_PROTOCOL            *AcpiTable;\r
-\r
-  //\r
-  // Find the AcpiTable protocol\r
-  //\r
-  Status = gBS->LocateProtocol (\r
-                  &gEfiAcpiTableProtocolGuid,\r
-                  NULL,\r
-                  (VOID**)&AcpiTable\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  Status = InstallQemuFwCfgTables (AcpiTable);\r
-  return Status;\r
-}\r
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatform.c b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatform.c
new file mode 100644 (file)
index 0000000..5cb3bac
--- /dev/null
@@ -0,0 +1,39 @@
+/** @file\r
+  OVMF ACPI Platform Driver using QEMU's fw-cfg interface\r
+\r
+  Copyright (C) 2015, Red Hat, Inc.\r
+  Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>\r
+\r
+  This program and the accompanying materials are licensed and made available\r
+  under the terms and conditions of the BSD License which accompanies this\r
+  distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
+  WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+\r
+#include "AcpiPlatform.h"\r
+\r
+/**\r
+  Effective entrypoint of QEMU fw-cfg Acpi Platform driver.\r
+\r
+  @param  ImageHandle\r
+  @param  SystemTable\r
+\r
+  @return EFI_SUCCESS\r
+  @return EFI_LOAD_ERROR\r
+  @return EFI_OUT_OF_RESOURCES\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InstallAcpiTables (\r
+  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiTable\r
+  )\r
+{\r
+  EFI_STATUS                         Status;\r
+\r
+  Status = InstallQemuFwCfgTables (AcpiTable);\r
+  return Status;\r
+}\r
index 5dab3ba2d79a23796a7311c578de0f8a7d6a4ac4..13c8009ed2bd413e2bb7dc8a758b440fcbf71335 100644 (file)
@@ -18,7 +18,7 @@
   FILE_GUID                      = 17985e6f-e778-4d94-aefa-c5dd2b77e186\r
   MODULE_TYPE                    = DXE_DRIVER\r
   VERSION_STRING                 = 1.0\r
-  ENTRY_POINT                    = QemuFwCfgAcpiPlatformEntryPoint\r
+  ENTRY_POINT                    = AcpiPlatformEntryPoint\r
 \r
 #\r
 # The following information is for reference only and not required by the build tools.\r
@@ -27,7 +27,9 @@
 #\r
 \r
 [Sources]\r
+  QemuFwCfgAcpiPlatform.c\r
   QemuFwCfgAcpi.c\r
+  EntryPoint.c\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r