]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c
IntelSiliconPkg IntelVTdDxe: Fix incorrect code to clear VTd error
[mirror_edk2.git] / IntelSiliconPkg / Feature / VTd / IntelVTdDxe / VtdReg.c
index 1404af7cd7817fb4163b9eb01e7ad2df66631d87..e564d373c756c82f2d284121c147aa98f143fb3f 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
 /** @file\r
 \r
-  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -13,7 +13,6 @@
 \r
 #include "DmaProtection.h"\r
 \r
 \r
 #include "DmaProtection.h"\r
 \r
-UINT64                           mVtdHostAddressWidthMask;\r
 UINTN                            mVtdUnitNumber;\r
 VTD_UNIT_INFORMATION             *mVtdUnitInformation;\r
 \r
 UINTN                            mVtdUnitNumber;\r
 VTD_UNIT_INFORMATION             *mVtdUnitInformation;\r
 \r
@@ -482,7 +481,7 @@ DumpVtdRegs (
       SourceId.Uint16 = (UINT16)FrcdReg.Bits.SID;\r
       DEBUG((DEBUG_INFO, "    Source - B%02x D%02x F%02x\n", SourceId.Bits.Bus, SourceId.Bits.Device, SourceId.Bits.Function));\r
       DEBUG((DEBUG_INFO, "    Type - %x (%a)\n", FrcdReg.Bits.T, FrcdReg.Bits.T ? "read" : "write"));\r
       SourceId.Uint16 = (UINT16)FrcdReg.Bits.SID;\r
       DEBUG((DEBUG_INFO, "    Source - B%02x D%02x F%02x\n", SourceId.Bits.Bus, SourceId.Bits.Device, SourceId.Bits.Function));\r
       DEBUG((DEBUG_INFO, "    Type - %x (%a)\n", FrcdReg.Bits.T, FrcdReg.Bits.T ? "read" : "write"));\r
-      DEBUG((DEBUG_INFO, "    Reason - %x\n", FrcdReg.Bits.FR));\r
+      DEBUG((DEBUG_INFO, "    Reason - %x (Refer to VTd Spec, Appendix A)\n", FrcdReg.Bits.FR));\r
     }\r
   }\r
 \r
     }\r
   }\r
 \r
@@ -555,11 +554,13 @@ DumpVtdIfError (
       for (Index = 0; Index < (UINTN)CapReg.Bits.NFR + 1; Index++) {\r
         FrcdReg.Uint64[1] = MmioRead64 (mVtdUnitInformation[Num].VtdUnitBaseAddress + ((CapReg.Bits.FRO * 16) + (Index * 16) + R_FRCD_REG + sizeof(UINT64)));\r
         if (FrcdReg.Bits.F != 0) {\r
       for (Index = 0; Index < (UINTN)CapReg.Bits.NFR + 1; Index++) {\r
         FrcdReg.Uint64[1] = MmioRead64 (mVtdUnitInformation[Num].VtdUnitBaseAddress + ((CapReg.Bits.FRO * 16) + (Index * 16) + R_FRCD_REG + sizeof(UINT64)));\r
         if (FrcdReg.Bits.F != 0) {\r
-          FrcdReg.Bits.F = 0;\r
+          //\r
+          // Software writes the value read from this field (F) to Clear it.\r
+          //\r
           MmioWrite64 (mVtdUnitInformation[Num].VtdUnitBaseAddress + ((CapReg.Bits.FRO * 16) + (Index * 16) + R_FRCD_REG + sizeof(UINT64)), FrcdReg.Uint64[1]);\r
         }\r
           MmioWrite64 (mVtdUnitInformation[Num].VtdUnitBaseAddress + ((CapReg.Bits.FRO * 16) + (Index * 16) + R_FRCD_REG + sizeof(UINT64)), FrcdReg.Uint64[1]);\r
         }\r
-        MmioWrite32 (mVtdUnitInformation[Num].VtdUnitBaseAddress + R_FSTS_REG, MmioRead32 (mVtdUnitInformation[Num].VtdUnitBaseAddress + R_FSTS_REG));\r
       }\r
       }\r
+      MmioWrite32 (mVtdUnitInformation[Num].VtdUnitBaseAddress + R_FSTS_REG, MmioRead32 (mVtdUnitInformation[Num].VtdUnitBaseAddress + R_FSTS_REG));\r
     }\r
   }\r
 }\r
     }\r
   }\r
 }\r