X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FPcatSingleSegmentPciCfg2Pei%2FPciCfg2.c;h=bf1fb2d88768357f22fd193fa58148d87854589e;hp=3542bdd6465c9af93bd29b8e8b9f1a74c7f5a66c;hb=702887db454ab21b8f32c351fccc2a7e2689361f;hpb=d8b61daacca489c69b3f21d2f8d6bd6e33e16e13 diff --git a/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c b/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c index 3542bdd646..bf1fb2d887 100644 --- a/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c +++ b/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c @@ -20,7 +20,7 @@ #include #include -#include +#include /** Convert EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS to PCI_LIB_ADDRESS. @@ -327,16 +327,24 @@ PciCfg2Modify ( IN CONST VOID *ClearBits ) { - UINTN PciLibAddress; + UINTN PciLibAddress; + UINT16 ClearValue16; + UINT16 SetValue16; + UINT32 ClearValue32; + UINT32 SetValue32; PciLibAddress = PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &Address); if (Width == EfiPeiPciCfgWidthUint8) { - PciAndThenOr8 (PciLibAddress, ~(*(UINT8 *)ClearBits), *((UINT8 *) SetBits)); + PciAndThenOr8 (PciLibAddress, (UINT8) (~(*(UINT8 *) ClearBits)), *((UINT8 *) SetBits)); } else if (Width == EfiPeiPciCfgWidthUint16) { - PciAndThenOr16 (PciLibAddress, ~ReadUnaligned16 ((UINT16 *) ClearBits), ReadUnaligned16 ((UINT16 *) SetBits)); + ClearValue16 = (UINT16) (~ReadUnaligned16 ((UINT16 *) ClearBits)); + SetValue16 = ReadUnaligned16 ((UINT16 *) SetBits); + PciAndThenOr16 (PciLibAddress, ClearValue16, SetValue16); } else if (Width == EfiPeiPciCfgWidthUint32) { - PciAndThenOr32 (PciLibAddress, ~ReadUnaligned32 ((UINT32 *) ClearBits), ReadUnaligned32 ((UINT32 *) SetBits)); + ClearValue32 = (UINT32) (~ReadUnaligned32 ((UINT32 *) ClearBits)); + SetValue32 = ReadUnaligned32 ((UINT32 *) SetBits); + PciAndThenOr32 (PciLibAddress, ClearValue32, SetValue32); } else { return EFI_INVALID_PARAMETER; }