summaryrefslogtreecommitdiffstats
path: root/OvmfPkg
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2015-07-14 12:02:06 +0000
committerlersek <lersek@Edk2>2015-07-14 12:02:06 +0000
commitfe907a688c58bc834e5eb368837d5efb184dac87 (patch)
tree5cb8844bd12bce920fc001c0a39af9d3305084c3 /OvmfPkg
parent6c46498875b7f67b2e3edf5a4bdb4c34f529236f (diff)
downloadedk2-fe907a688c58bc834e5eb368837d5efb184dac87.tar.gz
edk2-fe907a688c58bc834e5eb368837d5efb184dac87.tar.bz2
edk2-fe907a688c58bc834e5eb368837d5efb184dac87.zip
OvmfPkg: PciHostBridgeDxe: embed device path in private root bridge struct
Currently we define a device path for each root bridge statically (for all one of them). Since we'll want to create a dynamic number of root bridges, replace the static device paths with a common template, embed the actual device path into the private root bridge structure, and distinguish the device paths from each other in the UID field (as required by ACPI). This patch is best viewed with "git show -b". Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Regression-tested-by: Gabriel Somlo <somlo@cmu.edu> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17957 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg')
-rw-r--r--OvmfPkg/PciHostBridgeDxe/PciHostBridge.c49
-rw-r--r--OvmfPkg/PciHostBridgeDxe/PciHostBridge.h3
2 files changed, 27 insertions, 25 deletions
diff --git a/OvmfPkg/PciHostBridgeDxe/PciHostBridge.c b/OvmfPkg/PciHostBridgeDxe/PciHostBridge.c
index 985290928d..c2277bfca3 100644
--- a/OvmfPkg/PciHostBridgeDxe/PciHostBridge.c
+++ b/OvmfPkg/PciHostBridgeDxe/PciHostBridge.c
@@ -17,37 +17,36 @@
#include "PciHostBridge.h"
-//
-// Hard code: Root Bridge's device path
-// Root Bridge's resource aperture
-//
-
-EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath[1] = {
+STATIC
+CONST
+EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mRootBridgeDevicePathTemplate = {
{
{
+ ACPI_DEVICE_PATH,
+ ACPI_DP,
{
- ACPI_DEVICE_PATH,
- ACPI_DP,
- {
- (UINT8) (sizeof(ACPI_HID_DEVICE_PATH)),
- (UINT8) ((sizeof(ACPI_HID_DEVICE_PATH)) >> 8)
- }
- },
- EISA_PNP_ID(0x0A03),
- 0
+ (UINT8) (sizeof(ACPI_HID_DEVICE_PATH)),
+ (UINT8) ((sizeof(ACPI_HID_DEVICE_PATH)) >> 8)
+ }
},
+ EISA_PNP_ID(0x0A03), // HID
+ 0 // UID
+ },
+ {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
{
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- END_DEVICE_PATH_LENGTH,
- 0
- }
+ END_DEVICE_PATH_LENGTH,
+ 0
}
}
};
+//
+// Hard code: Root Bridge's resource aperture
+//
+
PCI_ROOT_BRIDGE_RESOURCE_APERTURE mResAperture[1] = {
{0, 0xff, 0x80000000, 0xffffffff, 0, 0xffff}
};
@@ -135,8 +134,10 @@ InitializePciHostBridge (
}
PrivateData->Signature = PCI_ROOT_BRIDGE_SIGNATURE;
- PrivateData->DevicePath =
- (EFI_DEVICE_PATH_PROTOCOL *)&mEfiPciRootBridgeDevicePath[Loop2];
+
+ CopyMem (&PrivateData->DevicePath, &mRootBridgeDevicePathTemplate,
+ sizeof mRootBridgeDevicePathTemplate);
+ PrivateData->DevicePath.AcpiDevicePath.UID = Loop2;
RootBridgeConstructor (
&PrivateData->Io,
@@ -148,7 +149,7 @@ InitializePciHostBridge (
Status = gBS->InstallMultipleProtocolInterfaces(
&PrivateData->Handle,
&gEfiDevicePathProtocolGuid,
- PrivateData->DevicePath,
+ &PrivateData->DevicePath,
&gEfiPciRootBridgeIoProtocolGuid,
&PrivateData->Io,
NULL
diff --git a/OvmfPkg/PciHostBridgeDxe/PciHostBridge.h b/OvmfPkg/PciHostBridgeDxe/PciHostBridge.h
index 28e0cd0e51..05b8cecf80 100644
--- a/OvmfPkg/PciHostBridgeDxe/PciHostBridge.h
+++ b/OvmfPkg/PciHostBridgeDxe/PciHostBridge.h
@@ -1,6 +1,7 @@
/** @file
The Header file of the Pci Host Bridge Driver
+ Copyright (C) 2015, Red Hat, Inc.
Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
@@ -605,7 +606,7 @@ typedef struct {
UINT64 MemLimit;
UINT64 IoLimit;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_PCI_ROOT_BRIDGE_DEVICE_PATH DevicePath;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL Io;
} PCI_ROOT_BRIDGE_INSTANCE;