summaryrefslogtreecommitdiffstats
path: root/IntelSiliconPkg/IntelVTdDxe/TranslationTable.c
diff options
context:
space:
mode:
authorJiewen Yao <jiewen.yao@intel.com>2017-08-25 14:46:07 +0800
committerJiewen Yao <jiewen.yao@intel.com>2017-08-28 16:28:45 +0800
commitf77d35c7f0835150df4be5327dd83152bac5ee39 (patch)
tree46c4e09264c176c7fec2d9c50444bf3bac38c664 /IntelSiliconPkg/IntelVTdDxe/TranslationTable.c
parent71872f7cda66ddf381e7d788750ed69e3e02a3d0 (diff)
downloadedk2-f77d35c7f0835150df4be5327dd83152bac5ee39.tar.gz
edk2-f77d35c7f0835150df4be5327dd83152bac5ee39.tar.bz2
edk2-f77d35c7f0835150df4be5327dd83152bac5ee39.zip
IntelSiliconPkg/IntelVTd: update PlatformVtdPolicy
1. Handle flexible exception list format. 1.1 Handle DeviceScope based device info. 1.2 Handle PciDeviceId based device info. 2. Reorg the PCI_DEVICE_INFORMATION 2.1 Merge data pointer reduce allocation times 2.2 Add PCI device id to PCI_DEVICE_INFORMATION 2.3 Rename PciDescriptor to avoid confusing. 3. Fix the debug message too long issue. Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
Diffstat (limited to 'IntelSiliconPkg/IntelVTdDxe/TranslationTable.c')
-rw-r--r--IntelSiliconPkg/IntelVTdDxe/TranslationTable.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/IntelSiliconPkg/IntelVTdDxe/TranslationTable.c b/IntelSiliconPkg/IntelVTdDxe/TranslationTable.c
index bc0c24c020..cd3111ce36 100644
--- a/IntelSiliconPkg/IntelVTdDxe/TranslationTable.c
+++ b/IntelSiliconPkg/IntelVTdDxe/TranslationTable.c
@@ -86,16 +86,16 @@ CreateContextEntry (
VTD_ROOT_ENTRY *RootEntry;
VTD_CONTEXT_ENTRY *ContextEntryTable;
VTD_CONTEXT_ENTRY *ContextEntry;
- VTD_SOURCE_ID *PciDescriptor;
+ VTD_SOURCE_ID *PciSourceId;
VTD_SOURCE_ID SourceId;
UINTN MaxBusNumber;
UINTN EntryTablePages;
MaxBusNumber = 0;
- for (Index = 0; Index < mVtdUnitInformation[VtdIndex].PciDeviceInfo.PciDescriptorNumber; Index++) {
- PciDescriptor = &mVtdUnitInformation[VtdIndex].PciDeviceInfo.PciDescriptors[Index];
- if (PciDescriptor->Bits.Bus > MaxBusNumber) {
- MaxBusNumber = PciDescriptor->Bits.Bus;
+ for (Index = 0; Index < mVtdUnitInformation[VtdIndex].PciDeviceInfo.PciDeviceDataNumber; Index++) {
+ PciSourceId = &mVtdUnitInformation[VtdIndex].PciDeviceInfo.PciDeviceData[Index].PciSourceId;
+ if (PciSourceId->Bits.Bus > MaxBusNumber) {
+ MaxBusNumber = PciSourceId->Bits.Bus;
}
}
DEBUG ((DEBUG_INFO," MaxBusNumber - 0x%x\n", MaxBusNumber));
@@ -111,12 +111,12 @@ CreateContextEntry (
mVtdUnitInformation[VtdIndex].RootEntryTable = (VTD_ROOT_ENTRY *)Buffer;
Buffer = (UINT8 *)Buffer + EFI_PAGES_TO_SIZE (RootPages);
- for (Index = 0; Index < mVtdUnitInformation[VtdIndex].PciDeviceInfo.PciDescriptorNumber; Index++) {
- PciDescriptor = &mVtdUnitInformation[VtdIndex].PciDeviceInfo.PciDescriptors[Index];
+ for (Index = 0; Index < mVtdUnitInformation[VtdIndex].PciDeviceInfo.PciDeviceDataNumber; Index++) {
+ PciSourceId = &mVtdUnitInformation[VtdIndex].PciDeviceInfo.PciDeviceData[Index].PciSourceId;
- SourceId.Bits.Bus = PciDescriptor->Bits.Bus;
- SourceId.Bits.Device = PciDescriptor->Bits.Device;
- SourceId.Bits.Function = PciDescriptor->Bits.Function;
+ SourceId.Bits.Bus = PciSourceId->Bits.Bus;
+ SourceId.Bits.Device = PciSourceId->Bits.Device;
+ SourceId.Bits.Function = PciSourceId->Bits.Function;
RootEntry = &mVtdUnitInformation[VtdIndex].RootEntryTable[SourceId.Index.RootIndex];
if (RootEntry->Bits.Present == 0) {
@@ -886,7 +886,7 @@ SetAccessAttribute (
VTD_CONTEXT_ENTRY *ContextEntry;
VTD_SECOND_LEVEL_PAGING_ENTRY *SecondLevelPagingEntry;
UINT64 Pt;
- UINTN PciDescriptorIndex;
+ UINTN PciDataIndex;
UINT16 DomainIdentifier;
SecondLevelPagingEntry = NULL;
@@ -899,12 +899,12 @@ SetAccessAttribute (
return EFI_DEVICE_ERROR;
}
- PciDescriptorIndex = GetPciDescriptor (VtdIndex, Segment, SourceId);
- mVtdUnitInformation[VtdIndex].PciDeviceInfo.AccessCount[PciDescriptorIndex]++;
+ PciDataIndex = GetPciDataIndex (VtdIndex, Segment, SourceId);
+ mVtdUnitInformation[VtdIndex].PciDeviceInfo.PciDeviceData[PciDataIndex].AccessCount++;
//
// DomainId should not be 0.
//
- DomainIdentifier = (UINT16)(PciDescriptorIndex + 1);
+ DomainIdentifier = (UINT16)(PciDataIndex + 1);
if (ExtContextEntry != NULL) {
if (ExtContextEntry->Bits.Present == 0) {