]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/PcatSingleSegmentPciCfgPei/PciCfg2.c
Update PciCfg2.c to follow strict ANSI C spec.
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / PcatSingleSegmentPciCfgPei / PciCfg2.c
index 28af898b98161cb66da9b197f0b7e0d477e3279d..1cde2025aff79d67333940a914b4bb6799bc158a 100644 (file)
@@ -236,16 +236,24 @@ PciCfg2Modify (
   IN CONST  VOID                      *ClearBits\r
 )\r
 {\r
-  UINTN  PciLibAddress;\r
+  UINTN   PciLibAddress;\r
+  UINT16  ClearValue16;\r
+  UINT16  SetValue16;\r
+  UINT32  ClearValue32;\r
+  UINT32  SetValue32;\r
 \r
   PciLibAddress = PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &Address);\r
 \r
   if (Width == EfiPeiPciCfgWidthUint8) {\r
-    PciAndThenOr8 (PciLibAddress, ~(*(UINT8 *)ClearBits), *((UINT8 *) SetBits));\r
+    PciAndThenOr8 (PciLibAddress, (UINT8) (~(*(UINT8 *) ClearBits)), *((UINT8 *) SetBits));\r
   } else if (Width == EfiPeiPciCfgWidthUint16) {\r
-    PciAndThenOr16 (PciLibAddress, ~ReadUnaligned16 ((UINT16 *) ClearBits), ReadUnaligned16 ((UINT16 *) SetBits));\r
+    ClearValue16  = (UINT16) (~ReadUnaligned16 ((UINT16 *) ClearBits));\r
+    SetValue16    = ReadUnaligned16 ((UINT16 *) SetBits);\r
+    PciAndThenOr16 (PciLibAddress, ClearValue16, SetValue16);\r
   } else if (Width == EfiPeiPciCfgWidthUint32) {\r
-    PciAndThenOr32 (PciLibAddress, ~ReadUnaligned32 ((UINT32 *) ClearBits), ReadUnaligned32 ((UINT32 *) SetBits));\r
+    ClearValue32  = (UINT32) (~ReadUnaligned32 ((UINT32 *) ClearBits));\r
+    SetValue32    = ReadUnaligned32 ((UINT32 *) SetBits);\r
+    PciAndThenOr32 (PciLibAddress, ClearValue32, SetValue32);\r
   } else {\r
     return EFI_INVALID_PARAMETER;\r
   }\r