Revision: 16885
http://sourceforge.net/p/edk2/code/16885
Author: jljusten
Date: 2015-02-19 23:45:57 +0000 (Thu, 19 Feb 2015)
Log Message:
-----------
OvmfPkg: AcpiPlatformDxe: extract common entry point
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 <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Modified Paths:
--------------
trunk/edk2/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
trunk/edk2/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
trunk/edk2/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
trunk/edk2/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
trunk/edk2/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
Added Paths:
-----------
trunk/edk2/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
trunk/edk2/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatform.c
Modified: trunk/edk2/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
===================================================================
--- trunk/edk2/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c 2015-02-19 23:45:50 UTC
(rev 16884)
+++ trunk/edk2/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c 2015-02-19 23:45:57 UTC
(rev 16885)
@@ -228,7 +228,7 @@
}
/**
- Entrypoint of Acpi Platform driver.
+ Effective entrypoint of Acpi Platform driver.
@param ImageHandle
@param SystemTable
@@ -240,24 +240,12 @@
**/
EFI_STATUS
EFIAPI
-AcpiPlatformEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+InstallAcpiTables (
+ IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable
)
{
EFI_STATUS Status;
- EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
- //
- // Find the AcpiTable protocol
- //
- Status = gBS->LocateProtocol (
- &gEfiAcpiTableProtocolGuid,
- NULL,
- (VOID**)&AcpiTable
- );
- ASSERT_EFI_ERROR (Status);
-
if (XenDetected ()) {
Status = InstallXenTables (AcpiTable);
} else {
Modified: trunk/edk2/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
===================================================================
--- trunk/edk2/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h 2015-02-19 23:45:50 UTC
(rev 16884)
+++ trunk/edk2/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h 2015-02-19 23:45:57 UTC
(rev 16885)
@@ -67,5 +67,11 @@
IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol
);
+EFI_STATUS
+EFIAPI
+InstallAcpiTables (
+ IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable
+ );
+
#endif
Modified: trunk/edk2/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
===================================================================
--- trunk/edk2/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf 2015-02-19
23:45:50 UTC (rev 16884)
+++ trunk/edk2/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf 2015-02-19
23:45:57 UTC (rev 16885)
@@ -31,6 +31,7 @@
Qemu.c
QemuFwCfgAcpi.c
Xen.c
+ EntryPoint.c
[Packages]
MdePkg/MdePkg.dec
Added: trunk/edk2/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
===================================================================
--- trunk/edk2/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
(rev 0)
+++ trunk/edk2/OvmfPkg/AcpiPlatformDxe/EntryPoint.c 2015-02-19 23:45:57 UTC
(rev 16885)
@@ -0,0 +1,47 @@
+/** @file
+ Entry point of OVMF ACPI Platform Driver
+
+ Copyright (C) 2015, Red Hat, Inc.
+ Copyright (c) 2008 - 2015, 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 "AcpiPlatform.h"
+
+STATIC
+EFI_ACPI_TABLE_PROTOCOL *
+FindAcpiTableProtocol (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+
+ Status = gBS->LocateProtocol (
+ &gEfiAcpiTableProtocolGuid,
+ NULL,
+ (VOID**)&AcpiTable
+ );
+ ASSERT_EFI_ERROR (Status);
+ return AcpiTable;
+}
+
+EFI_STATUS
+EFIAPI
+AcpiPlatformEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = InstallAcpiTables (FindAcpiTableProtocol ());
+ return Status;
+}
Modified: trunk/edk2/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
===================================================================
--- trunk/edk2/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c 2015-02-19 23:45:50 UTC
(rev 16884)
+++ trunk/edk2/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c 2015-02-19 23:45:57 UTC
(rev 16885)
@@ -683,39 +683,3 @@
return Status;
}
-
-
-/**
- Entrypoint of QEMU fw-cfg Acpi Platform driver.
-
- @param ImageHandle
- @param SystemTable
-
- @return EFI_SUCCESS
- @return EFI_LOAD_ERROR
- @return EFI_OUT_OF_RESOURCES
-
-**/
-EFI_STATUS
-EFIAPI
-QemuFwCfgAcpiPlatformEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
-
- //
- // Find the AcpiTable protocol
- //
- Status = gBS->LocateProtocol (
- &gEfiAcpiTableProtocolGuid,
- NULL,
- (VOID**)&AcpiTable
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = InstallQemuFwCfgTables (AcpiTable);
- return Status;
-}
Added: trunk/edk2/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatform.c
===================================================================
--- trunk/edk2/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatform.c
(rev 0)
+++ trunk/edk2/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatform.c 2015-02-19
23:45:57 UTC (rev 16885)
@@ -0,0 +1,39 @@
+/** @file
+ OVMF ACPI Platform Driver using QEMU's fw-cfg interface
+
+ Copyright (C) 2015, Red Hat, Inc.
+ Copyright (c) 2008 - 2014, 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 "AcpiPlatform.h"
+
+/**
+ Effective entrypoint of QEMU fw-cfg Acpi Platform driver.
+
+ @param ImageHandle
+ @param SystemTable
+
+ @return EFI_SUCCESS
+ @return EFI_LOAD_ERROR
+ @return EFI_OUT_OF_RESOURCES
+
+**/
+EFI_STATUS
+EFIAPI
+InstallAcpiTables (
+ IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = InstallQemuFwCfgTables (AcpiTable);
+ return Status;
+}
Modified: trunk/edk2/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
===================================================================
--- trunk/edk2/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
2015-02-19 23:45:50 UTC (rev 16884)
+++ trunk/edk2/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
2015-02-19 23:45:57 UTC (rev 16885)
@@ -18,7 +18,7 @@
FILE_GUID = 17985e6f-e778-4d94-aefa-c5dd2b77e186
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
- ENTRY_POINT = QemuFwCfgAcpiPlatformEntryPoint
+ ENTRY_POINT = AcpiPlatformEntryPoint
#
# The following information is for reference only and not required by the
build tools.
@@ -27,7 +27,9 @@
#
[Sources]
+ QemuFwCfgAcpiPlatform.c
QemuFwCfgAcpi.c
+ EntryPoint.c
[Packages]
MdePkg/MdePkg.dec
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits