Changeset 77662 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Csm
- Timestamp:
- Mar 12, 2019 12:40:12 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 129295
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776 /vendor/edk2/current 103735-103757,103769-103776,129194-129237
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
r48674 r77662 38 38 MdePkg/MdePkg.dec 39 39 IntelFrameworkPkg/IntelFrameworkPkg.dec 40 OvmfPkg/OvmfPkg.dec 41 42 [Pcd] 43 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId 40 44 41 45 [Protocols] -
trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c
r48674 r77662 20 20 // 21 21 STATIC EFI_HANDLE mLegacyInterruptHandle = NULL; 22 23 // 24 // Legacy Interrupt Device number (0x01 on piix4, 0x1f on q35/mch) 25 // 26 STATIC UINT8 mLegacyInterruptDevice; 22 27 23 28 // … … 78 83 { 79 84 *Bus = LEGACY_INT_BUS; 80 *Device = LEGACY_INT_DEV;85 *Device = mLegacyInterruptDevice; 81 86 *Function = LEGACY_INT_FUNC; 82 87 … … 99 104 return PCI_LIB_ADDRESS( 100 105 LEGACY_INT_BUS, 101 LEGACY_INT_DEV,106 mLegacyInterruptDevice, 102 107 LEGACY_INT_FUNC, 103 108 PirqReg[PirqNumber] … … 174 179 ) 175 180 { 181 UINT16 HostBridgeDevId; 176 182 EFI_STATUS Status; 177 183 … … 180 186 // 181 187 ASSERT_PROTOCOL_ALREADY_INSTALLED(NULL, &gEfiLegacyInterruptProtocolGuid); 188 189 // 190 // Query Host Bridge DID to determine platform type, then set device number 191 // 192 HostBridgeDevId = PcdGet16 (PcdOvmfHostBridgePciDevId); 193 switch (HostBridgeDevId) { 194 case INTEL_82441_DEVICE_ID: 195 mLegacyInterruptDevice = LEGACY_INT_DEV_PIIX4; 196 break; 197 case INTEL_Q35_MCH_DEVICE_ID: 198 mLegacyInterruptDevice = LEGACY_INT_DEV_Q35; 199 break; 200 default: 201 DEBUG ((EFI_D_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n", 202 __FUNCTION__, HostBridgeDevId)); 203 ASSERT (FALSE); 204 return EFI_UNSUPPORTED; 205 } 182 206 183 207 // -
trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h
r48674 r77662 21 21 #include <Protocol/LegacyInterrupt.h> 22 22 23 #include <Library/PcdLib.h> 23 24 #include <Library/PciLib.h> 24 25 #include <Library/DebugLib.h> 25 26 #include <Library/UefiBootServicesTableLib.h> 27 #include <OvmfPlatforms.h> 28 26 29 27 30 #define LEGACY_INT_BUS 0 28 #define LEGACY_INT_DEV 1 31 #define LEGACY_INT_DEV_PIIX4 0x01 32 #define LEGACY_INT_DEV_Q35 0x1f 29 33 #define LEGACY_INT_FUNC 0 30 34 -
trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.c
r58459 r77662 257 257 258 258 // 259 // Initialize variable states. Th s is important for selecting the VGA device260 // if multiple devices exist behind a single bridge.259 // Initialize variable states. This is important for selecting the VGA 260 // device if multiple devices exist behind a single bridge. 261 261 // 262 262 HandleCount = 0; -
trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c
r48674 r77662 2 2 Legacy Region Support 3 3 4 Copyright (c) 2006 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials are … … 17 17 18 18 // 19 // 440 PAM map. 20 // 21 // PAM Range Offset Bits Operation 22 // =============== ====== ==== =============================================================== 23 // 0xC0000-0xC3FFF 0x5a 1:0 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 24 // 0xC4000-0xC7FFF 0x5a 5:4 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 25 // 0xC8000-0xCBFFF 0x5b 1:0 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 26 // 0xCC000-0xCFFFF 0x5b 5:4 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 27 // 0xD0000-0xD3FFF 0x5c 1:0 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 28 // 0xD4000-0xD7FFF 0x5c 5:4 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 29 // 0xD8000-0xDBFFF 0x5d 1:0 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 30 // 0xDC000-0xDFFFF 0x5d 5:4 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 31 // 0xE0000-0xE3FFF 0x5e 1:0 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 32 // 0xE4000-0xE7FFF 0x5e 5:4 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 33 // 0xE8000-0xEBFFF 0x5f 1:0 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 34 // 0xEC000-0xEFFFF 0x5f 5:4 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 35 // 0xF0000-0xFFFFF 0x59 5:4 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 19 // 440/Q35 PAM map. 20 // 21 // PAM Range Offset Bits Operation 22 // 440 Q35 23 // =============== ==== ==== ==== =============================================================== 24 // 0xC0000-0xC3FFF 0x5a 0x91 1:0 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 25 // 0xC4000-0xC7FFF 0x5a 0x91 5:4 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 26 // 0xC8000-0xCBFFF 0x5b 0x92 1:0 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 27 // 0xCC000-0xCFFFF 0x5b 0x92 5:4 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 28 // 0xD0000-0xD3FFF 0x5c 0x93 1:0 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 29 // 0xD4000-0xD7FFF 0x5c 0x93 5:4 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 30 // 0xD8000-0xDBFFF 0x5d 0x94 1:0 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 31 // 0xDC000-0xDFFFF 0x5d 0x94 5:4 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 32 // 0xE0000-0xE3FFF 0x5e 0x95 1:0 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 33 // 0xE4000-0xE7FFF 0x5e 0x95 5:4 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 34 // 0xE8000-0xEBFFF 0x5f 0x96 1:0 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 35 // 0xEC000-0xEFFFF 0x5f 0x96 5:4 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 36 // 0xF0000-0xFFFFF 0x59 0x90 5:4 00 = DRAM Disabled, 01= Read Only, 10 = Write Only, 11 = Normal 36 37 // 37 38 STATIC LEGACY_MEMORY_SECTION_INFO mSectionArray[] = { … … 51 52 }; 52 53 53 STATIC PAM_REGISTER_VALUE mRegisterValues [] = {54 { REG_PAM1_OFFSET, 0x01, 0x02},55 { REG_PAM1_OFFSET, 0x10, 0x20},56 { REG_PAM2_OFFSET, 0x01, 0x02},57 { REG_PAM2_OFFSET, 0x10, 0x20},58 { REG_PAM3_OFFSET, 0x01, 0x02},59 { REG_PAM3_OFFSET, 0x10, 0x20},60 { REG_PAM4_OFFSET, 0x01, 0x02},61 { REG_PAM4_OFFSET, 0x10, 0x20},62 { REG_PAM5_OFFSET, 0x01, 0x02},63 { REG_PAM5_OFFSET, 0x10, 0x20},64 { REG_PAM6_OFFSET, 0x01, 0x02},65 { REG_PAM6_OFFSET, 0x10, 0x20},66 { REG_PAM0_OFFSET, 0x10, 0x20}54 STATIC PAM_REGISTER_VALUE mRegisterValues440[] = { 55 {PMC_REGISTER_PIIX4 (PIIX4_PAM1), 0x01, 0x02}, 56 {PMC_REGISTER_PIIX4 (PIIX4_PAM1), 0x10, 0x20}, 57 {PMC_REGISTER_PIIX4 (PIIX4_PAM2), 0x01, 0x02}, 58 {PMC_REGISTER_PIIX4 (PIIX4_PAM2), 0x10, 0x20}, 59 {PMC_REGISTER_PIIX4 (PIIX4_PAM3), 0x01, 0x02}, 60 {PMC_REGISTER_PIIX4 (PIIX4_PAM3), 0x10, 0x20}, 61 {PMC_REGISTER_PIIX4 (PIIX4_PAM4), 0x01, 0x02}, 62 {PMC_REGISTER_PIIX4 (PIIX4_PAM4), 0x10, 0x20}, 63 {PMC_REGISTER_PIIX4 (PIIX4_PAM5), 0x01, 0x02}, 64 {PMC_REGISTER_PIIX4 (PIIX4_PAM5), 0x10, 0x20}, 65 {PMC_REGISTER_PIIX4 (PIIX4_PAM6), 0x01, 0x02}, 66 {PMC_REGISTER_PIIX4 (PIIX4_PAM6), 0x10, 0x20}, 67 {PMC_REGISTER_PIIX4 (PIIX4_PAM0), 0x10, 0x20} 67 68 }; 69 70 STATIC PAM_REGISTER_VALUE mRegisterValuesQ35[] = { 71 {DRAMC_REGISTER_Q35 (MCH_PAM1), 0x01, 0x02}, 72 {DRAMC_REGISTER_Q35 (MCH_PAM1), 0x10, 0x20}, 73 {DRAMC_REGISTER_Q35 (MCH_PAM2), 0x01, 0x02}, 74 {DRAMC_REGISTER_Q35 (MCH_PAM2), 0x10, 0x20}, 75 {DRAMC_REGISTER_Q35 (MCH_PAM3), 0x01, 0x02}, 76 {DRAMC_REGISTER_Q35 (MCH_PAM3), 0x10, 0x20}, 77 {DRAMC_REGISTER_Q35 (MCH_PAM4), 0x01, 0x02}, 78 {DRAMC_REGISTER_Q35 (MCH_PAM4), 0x10, 0x20}, 79 {DRAMC_REGISTER_Q35 (MCH_PAM5), 0x01, 0x02}, 80 {DRAMC_REGISTER_Q35 (MCH_PAM5), 0x10, 0x20}, 81 {DRAMC_REGISTER_Q35 (MCH_PAM6), 0x01, 0x02}, 82 {DRAMC_REGISTER_Q35 (MCH_PAM6), 0x10, 0x20}, 83 {DRAMC_REGISTER_Q35 (MCH_PAM0), 0x10, 0x20} 84 }; 85 86 STATIC PAM_REGISTER_VALUE *mRegisterValues; 68 87 69 88 // … … 112 131 // 113 132 StartIndex = 0; 114 for (Index = 0; Index < (sizeof(mSectionArray) / sizeof (mSectionArray[0])); Index++) {133 for (Index = 0; Index < ARRAY_SIZE (mSectionArray); Index++) { 115 134 if ((Start >= mSectionArray[Index].Start) && (Start < (mSectionArray[Index].Start + mSectionArray[Index].Length))) { 116 135 StartIndex = Index; … … 118 137 } 119 138 } 120 ASSERT (Index < (sizeof(mSectionArray) / sizeof (mSectionArray[0])));139 ASSERT (Index < ARRAY_SIZE (mSectionArray)); 121 140 122 141 // 123 142 // Program PAM until end PAM is encountered 124 143 // 125 for (Index = StartIndex; Index < (sizeof(mSectionArray) / sizeof (mSectionArray[0])); Index++) {144 for (Index = StartIndex; Index < ARRAY_SIZE (mSectionArray); Index++) { 126 145 if (ReadEnable != NULL) { 127 146 if (*ReadEnable) { 128 147 PciOr8 ( 129 PCI_LIB_ADDRESS(PAM_PCI_BUS, PAM_PCI_DEV, PAM_PCI_FUNC, mRegisterValues[Index].PAMRegOffset),148 mRegisterValues[Index].PAMRegPciLibAddress, 130 149 mRegisterValues[Index].ReadEnableData 131 150 ); 132 151 } else { 133 152 PciAnd8 ( 134 PCI_LIB_ADDRESS(PAM_PCI_BUS, PAM_PCI_DEV, PAM_PCI_FUNC, mRegisterValues[Index].PAMRegOffset),153 mRegisterValues[Index].PAMRegPciLibAddress, 135 154 (UINT8) (~mRegisterValues[Index].ReadEnableData) 136 155 ); … … 140 159 if (*WriteEnable) { 141 160 PciOr8 ( 142 PCI_LIB_ADDRESS(PAM_PCI_BUS, PAM_PCI_DEV, PAM_PCI_FUNC, mRegisterValues[Index].PAMRegOffset),161 mRegisterValues[Index].PAMRegPciLibAddress, 143 162 mRegisterValues[Index].WriteEnableData 144 163 ); 145 164 } else { 146 165 PciAnd8 ( 147 PCI_LIB_ADDRESS(PAM_PCI_BUS, PAM_PCI_DEV, PAM_PCI_FUNC, mRegisterValues[Index].PAMRegOffset),166 mRegisterValues[Index].PAMRegPciLibAddress, 148 167 (UINT8) (~mRegisterValues[Index].WriteEnableData) 149 168 ); … … 159 178 } 160 179 } 161 ASSERT (Index < (sizeof(mSectionArray) / sizeof (mSectionArray[0])));180 ASSERT (Index < ARRAY_SIZE (mSectionArray)); 162 181 163 182 return EFI_SUCCESS; … … 186 205 *DescriptorCount = sizeof(mSectionArray) / sizeof (mSectionArray[0]); 187 206 for (Index = 0; Index < *DescriptorCount; Index++) { 188 PamValue = PciRead8 ( PCI_LIB_ADDRESS(PAM_PCI_BUS, PAM_PCI_DEV, PAM_PCI_FUNC, mRegisterValues[Index].PAMRegOffset));207 PamValue = PciRead8 (mRegisterValues[Index].PAMRegPciLibAddress); 189 208 mSectionArray[Index].ReadEnabled = FALSE; 190 209 if ((PamValue & mRegisterValues[Index].ReadEnableData) != 0) { … … 451 470 { 452 471 EFI_STATUS Status; 472 UINT16 HostBridgeDevId; 473 474 // 475 // Query Host Bridge DID to determine platform type 476 // 477 HostBridgeDevId = PcdGet16 (PcdOvmfHostBridgePciDevId); 478 switch (HostBridgeDevId) { 479 case INTEL_82441_DEVICE_ID: 480 mRegisterValues = mRegisterValues440; 481 break; 482 case INTEL_Q35_MCH_DEVICE_ID: 483 mRegisterValues = mRegisterValuesQ35; 484 break; 485 default: 486 DEBUG ((EFI_D_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n", 487 __FUNCTION__, HostBridgeDevId)); 488 ASSERT (FALSE); 489 return RETURN_UNSUPPORTED; 490 } 453 491 454 492 // -
trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.h
r48674 r77662 2 2 Legacy Region Support 3 3 4 Copyright (c) 2008 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials are … … 22 22 23 23 #include <IndustryStandard/Pci.h> 24 #include <IndustryStandard/Q35MchIch9.h> 25 #include <IndustryStandard/I440FxPiix4.h> 24 26 25 27 #include <Library/PciLib.h> … … 28 30 #include <Library/MemoryAllocationLib.h> 29 31 #include <Library/UefiBootServicesTableLib.h> 30 31 #define PAM_PCI_BUS 032 #define PAM_PCI_DEV 033 #define PAM_PCI_FUNC 034 35 #define REG_PAM0_OFFSET 0x59 // Programmable Attribute Map 036 #define REG_PAM1_OFFSET 0x5a // Programmable Attribute Map 137 #define REG_PAM2_OFFSET 0x5b // Programmable Attribute Map 238 #define REG_PAM3_OFFSET 0x5c // Programmable Attribute Map 339 #define REG_PAM4_OFFSET 0x5d // Programmable Attribute Map 440 #define REG_PAM5_OFFSET 0x5e // Programmable Attribute Map 541 #define REG_PAM6_OFFSET 0x5f // Programmable Attribute Map 642 32 43 33 #define PAM_BASE_ADDRESS 0xc0000 … … 58 48 // 59 49 typedef struct { 60 UINT 8 PAMRegOffset;50 UINTN PAMRegPciLibAddress; 61 51 UINT8 ReadEnableData; 62 52 UINT8 WriteEnableData;
Note:
See TracChangeset
for help on using the changeset viewer.