Skip to content

Commit ea88df6

Browse files
ckoehnemergify[bot]
authored andcommitted
OvmfPkg: move PciEncoding into AcpiPlatformLib
Bhyve supports providing ACPI tables by FwCfg. Therefore, InstallQemuFwCfgTables should be moved to AcpiPlatformLib to reuse the code. As first step, move PciEncoding into AcpiPlatformLib. Signed-off-by: Corvin Köhne <[email protected]> Acked-by: Peter Grehan <[email protected]>
1 parent f5d8516 commit ea88df6

19 files changed

+38
-274
lines changed

ArmVirtPkg/ArmVirtQemu.dsc

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
112112

113113
[LibraryClasses.common.DXE_DRIVER]
114+
AcpiPlatformLib|OvmfPkg/Library/AcpiPlatformLib/DxeAcpiPlatformLib.inf
114115
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
115116

116117
!if $(TPM2_ENABLE) == TRUE

ArmVirtPkg/ArmVirtQemuKernel.dsc

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLibNull/PeiDxeTpmPlatformHierarchyLib.inf
8484

8585
[LibraryClasses.common.DXE_DRIVER]
86+
AcpiPlatformLib|OvmfPkg/Library/AcpiPlatformLib/DxeAcpiPlatformLib.inf
8687
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
8788

8889
[LibraryClasses.common.UEFI_DRIVER]

OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h

-18
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010
#define ACPI_PLATFORM_H_
1111

1212
#include <Protocol/AcpiTable.h> // EFI_ACPI_TABLE_PROTOCOL
13-
#include <Protocol/PciIo.h> // EFI_PCI_IO_PROTOCOL
14-
15-
typedef struct {
16-
EFI_PCI_IO_PROTOCOL *PciIo;
17-
UINT64 PciAttributes;
18-
} ORIGINAL_ATTRIBUTES;
1913

2014
typedef struct S3_CONTEXT S3_CONTEXT;
2115

@@ -43,18 +37,6 @@ InstallAcpiTables (
4337
IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable
4438
);
4539

46-
VOID
47-
EnablePciDecoding (
48-
OUT ORIGINAL_ATTRIBUTES **OriginalAttributes,
49-
OUT UINTN *Count
50-
);
51-
52-
VOID
53-
RestorePciDecoding (
54-
IN ORIGINAL_ATTRIBUTES *OriginalAttributes,
55-
IN UINTN Count
56-
);
57-
5840
EFI_STATUS
5941
AllocateS3Context (
6042
OUT S3_CONTEXT **S3Context,

OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf

+1-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
BootScript.c
2727
CloudHvAcpi.c
2828
EntryPoint.c
29-
PciDecoding.c
3029
QemuFwCfgAcpi.c
3130

3231
[Packages]
@@ -35,15 +34,13 @@
3534
OvmfPkg/OvmfPkg.dec
3635

3736
[LibraryClasses]
37+
AcpiPlatformLib
3838
BaseLib
3939
BaseMemoryLib
40-
DebugLib
4140
MemoryAllocationLib
4241
OrderedCollectionLib
43-
PcdLib
4442
QemuFwCfgLib
4543
QemuFwCfgS3Lib
46-
UefiBootServicesTableLib
4744
UefiDriverEntryPoint
4845
HobLib
4946
TpmMeasurementLib

OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <IndustryStandard/Acpi.h> // EFI_ACPI_DESCRIPTION_HEADER
1212
#include <IndustryStandard/QemuLoader.h> // QEMU_LOADER_FNAME_SIZE
1313
#include <IndustryStandard/UefiTcgPlatform.h>
14+
#include <Library/AcpiPlatformLib.h>
1415
#include <Library/BaseLib.h> // AsciiStrCmp()
1516
#include <Library/BaseMemoryLib.h> // CopyMem()
1617
#include <Library/DebugLib.h> // DEBUG()

OvmfPkg/AmdSev/AmdSevX64.dsc

+1
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@
329329
PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
330330

331331
[LibraryClasses.common.DXE_DRIVER]
332+
AcpiPlatformLib|OvmfPkg/Library/AcpiPlatformLib/DxeAcpiPlatformLib.inf
332333
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
333334
TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf
334335
ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf

OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h

-17
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@
2121
#include <Library/XenPlatformLib.h>
2222
#include <IndustryStandard/Acpi.h>
2323

24-
typedef struct {
25-
EFI_PCI_IO_PROTOCOL *PciIo;
26-
UINT64 PciAttributes;
27-
} ORIGINAL_ATTRIBUTES;
28-
2924
typedef struct S3_CONTEXT S3_CONTEXT;
3025

3126
EFI_STATUS
@@ -58,16 +53,4 @@ InstallAcpiTables (
5853
IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable
5954
);
6055

61-
VOID
62-
EnablePciDecoding (
63-
OUT ORIGINAL_ATTRIBUTES **OriginalAttributes,
64-
OUT UINTN *Count
65-
);
66-
67-
VOID
68-
RestorePciDecoding (
69-
IN ORIGINAL_ATTRIBUTES *OriginalAttributes,
70-
IN UINTN Count
71-
);
72-
7356
#endif /* _ACPI_PLATFORM_H_INCLUDED_ */

OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
AcpiPlatform.h
2727
Bhyve.c
2828
EntryPoint.c
29-
PciDecoding.c
3029

3130
[Packages]
3231
MdePkg/MdePkg.dec

OvmfPkg/Bhyve/AcpiPlatformDxe/PciDecoding.c

-232
This file was deleted.

OvmfPkg/CloudHv/CloudHvX64.dsc

+1
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@
366366
PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
367367

368368
[LibraryClasses.common.DXE_DRIVER]
369+
AcpiPlatformLib|OvmfPkg/Library/AcpiPlatformLib/DxeAcpiPlatformLib.inf
369370
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
370371
TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf
371372
ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.inf

OvmfPkg/Include/Library/AcpiPlatformLib.h

+18
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
#define ACPI_PLATFORM_LIB_H_
99

1010
#include <Protocol/AcpiTable.h>
11+
#include <Protocol/PciIo.h>
12+
13+
typedef struct {
14+
EFI_PCI_IO_PROTOCOL *PciIo;
15+
UINT64 PciAttributes;
16+
} ORIGINAL_ATTRIBUTES;
1117

1218
/**
1319
Searches and returns the address of the ACPI Root System Description Pointer (RSDP) in system memory.
@@ -51,4 +57,16 @@ InstallAcpiTablesFromRsdp (
5157
IN EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp
5258
);
5359

60+
VOID
61+
EnablePciDecoding (
62+
OUT ORIGINAL_ATTRIBUTES **OriginalAttributes,
63+
OUT UINTN *Count
64+
);
65+
66+
VOID
67+
RestorePciDecoding (
68+
IN ORIGINAL_ATTRIBUTES *OriginalAttributes,
69+
IN UINTN Count
70+
);
71+
5472
#endif

0 commit comments

Comments
 (0)