]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelSiliconPkg IntelVTdDxe: Fix incorrect code to clear VTd error
authorStar Zeng <star.zeng@intel.com>
Tue, 5 Jun 2018 08:04:38 +0000 (16:04 +0800)
committerStar Zeng <star.zeng@intel.com>
Wed, 6 Jun 2018 04:46:43 +0000 (12:46 +0800)
According to VTd spec, Software writes the value read from this
field (F) to Clear it. But current code is using 0 to clear the
field, that is incorrect.

And R_FSTS_REG register value clearing should be not in the for loop.

Without this patch, we will see same VTd error message appears again
and again after it occurs first time.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c

index 8dbc83fa2d6764654209d820f4a98ab9e9c90785..e564d373c756c82f2d284121c147aa98f143fb3f 100644 (file)
@@ -554,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
-          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
-        MmioWrite32 (mVtdUnitInformation[Num].VtdUnitBaseAddress + R_FSTS_REG, MmioRead32 (mVtdUnitInformation[Num].VtdUnitBaseAddress + R_FSTS_REG));\r
       }\r
+      MmioWrite32 (mVtdUnitInformation[Num].VtdUnitBaseAddress + R_FSTS_REG, MmioRead32 (mVtdUnitInformation[Num].VtdUnitBaseAddress + R_FSTS_REG));\r
     }\r
   }\r
 }\r