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