Revision: 16375
http://sourceforge.net/p/edk2/code/16375
Author: jljusten
Date: 2014-11-14 00:38:00 +0000 (Fri, 14 Nov 2014)
Log Message:
-----------
OvmfPkg: CsmSupportLib: Set/use platform specific legacy interrupt device
Use a PCD set from PEI to determine the legacy interrupt device
number appropriate for the underlying platform type during protocol
initialization.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gabriel Somlo <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Reviewed-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Modified Paths:
--------------
trunk/edk2/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
trunk/edk2/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c
trunk/edk2/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h
Modified: trunk/edk2/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
===================================================================
--- trunk/edk2/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf 2014-11-14
00:37:39 UTC (rev 16374)
+++ trunk/edk2/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf 2014-11-14
00:38:00 UTC (rev 16375)
@@ -38,6 +38,9 @@
MdePkg/MdePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
+[Pcd]
+ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
+
[Protocols]
gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiDiskInfoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
Modified: trunk/edk2/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c
===================================================================
--- trunk/edk2/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c 2014-11-14
00:37:39 UTC (rev 16374)
+++ trunk/edk2/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c 2014-11-14
00:38:00 UTC (rev 16375)
@@ -21,6 +21,11 @@
STATIC EFI_HANDLE mLegacyInterruptHandle = NULL;
//
+// Legacy Interrupt Device number (0x01 on piix4, 0x1f on q35/mch)
+//
+STATIC UINT8 mLegacyInterruptDevice;
+
+//
// The Legacy Interrupt Protocol instance produced by this driver
//
STATIC EFI_LEGACY_INTERRUPT_PROTOCOL mLegacyInterrupt = {
@@ -77,7 +82,7 @@
)
{
*Bus = LEGACY_INT_BUS;
- *Device = LEGACY_INT_DEV;
+ *Device = mLegacyInterruptDevice;
*Function = LEGACY_INT_FUNC;
return EFI_SUCCESS;
@@ -98,7 +103,7 @@
{
return PCI_LIB_ADDRESS(
LEGACY_INT_BUS,
- LEGACY_INT_DEV,
+ mLegacyInterruptDevice,
LEGACY_INT_FUNC,
PirqReg[PirqNumber]
);
@@ -173,6 +178,7 @@
VOID
)
{
+ UINT16 HostBridgeDevId;
EFI_STATUS Status;
//
@@ -181,6 +187,24 @@
ASSERT_PROTOCOL_ALREADY_INSTALLED(NULL, &gEfiLegacyInterruptProtocolGuid);
//
+ // Query Host Bridge DID to determine platform type, then set device number
+ //
+ HostBridgeDevId = PcdGet16 (PcdOvmfHostBridgePciDevId);
+ switch (HostBridgeDevId) {
+ case INTEL_82441_DEVICE_ID:
+ mLegacyInterruptDevice = LEGACY_INT_DEV_PIIX4;
+ break;
+ case INTEL_Q35_MCH_DEVICE_ID:
+ mLegacyInterruptDevice = LEGACY_INT_DEV_Q35;
+ break;
+ default:
+ DEBUG ((EFI_D_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n",
+ __FUNCTION__, HostBridgeDevId));
+ ASSERT (FALSE);
+ return EFI_UNSUPPORTED;
+ }
+
+ //
// Make a new handle and install the protocol
//
Status = gBS->InstallMultipleProtocolInterfaces (
Modified: trunk/edk2/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h
===================================================================
--- trunk/edk2/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h 2014-11-14
00:37:39 UTC (rev 16374)
+++ trunk/edk2/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h 2014-11-14
00:38:00 UTC (rev 16375)
@@ -20,12 +20,16 @@
#include <Protocol/LegacyInterrupt.h>
+#include <Library/PcdLib.h>
#include <Library/PciLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
+#include <OvmfPlatforms.h>
+
#define LEGACY_INT_BUS 0
-#define LEGACY_INT_DEV 1
+#define LEGACY_INT_DEV_PIIX4 0x01
+#define LEGACY_INT_DEV_Q35 0x1f
#define LEGACY_INT_FUNC 0
#define PIRQN 0x00 // PIRQ Null
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits