X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FPcatSingleSegmentPciCfg2Pei%2FPciCfg2.c;h=ae177f487c1e669470d5d9d0213d5d3675c76263;hb=6fc2b00b1aff69e31e83b3ec317e95db9ea0b37e;hp=9e478eb8797fdb8ede39d6f90fc48c960bca00e1;hpb=2d85ada2ec519c27d445510afd97e3fc40899ac0;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c b/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c index 9e478eb879..ae177f487c 100644 --- a/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c +++ b/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PciCfg2.c @@ -1,4 +1,5 @@ -/** +/** @file + Installs Single Segment Pci Configuration PPI. Copyright (c) 2006 - 2007, Intel Corporation All rights reserved. This program and the accompanying materials @@ -27,9 +28,9 @@ @param Address PCI address with EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS format. - + @return The PCI address with PCI_LIB_ADDRESS format. - + **/ STATIC UINTN @@ -69,7 +70,7 @@ PciCfgAddressConvert ( **/ EFI_STATUS -EFIAPI +EFIAPI PciCfg2Read ( IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_PEI_PCI_CFG2_PPI *This, @@ -103,7 +104,7 @@ PciCfg2Read ( **/ EFI_STATUS -EFIAPI +EFIAPI PciCfg2Write ( IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_PEI_PCI_CFG2_PPI *This, @@ -143,14 +144,14 @@ PciCfg2Write ( **/ EFI_STATUS -EFIAPI +EFIAPI PciCfg2Modify ( IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_PEI_PCI_CFG2_PPI *This, IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, IN UINT64 Address, - IN CONST VOID *SetBits, - IN CONST VOID *ClearBits + IN VOID *SetBits, + IN VOID *ClearBits ); @@ -209,7 +210,7 @@ EFI_PEI_PPI_DESCRIPTOR gPciCfg2PpiList = { **/ EFI_STATUS -EFIAPI +EFIAPI PciCfg2Read ( IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_PEI_PCI_CFG2_PPI *This, @@ -260,7 +261,7 @@ PciCfg2Read ( **/ EFI_STATUS -EFIAPI +EFIAPI PciCfg2Write ( IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_PEI_PCI_CFG2_PPI *This, @@ -317,26 +318,34 @@ PciCfg2Write ( **/ EFI_STATUS -EFIAPI +EFIAPI PciCfg2Modify ( IN CONST EFI_PEI_SERVICES **PeiServices, IN CONST EFI_PEI_PCI_CFG2_PPI *This, IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, IN UINT64 Address, - IN CONST VOID *SetBits, - IN CONST VOID *ClearBits + IN VOID *SetBits, + IN 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; } @@ -356,7 +365,7 @@ PeimInitializePciCfg ( ASSERT ((**PeiServices).Hdr.Revision >= PEI_SERVICES_REVISION); (**PeiServices).PciCfg = &gPciCfg2Ppi; - Status = (**PeiServices).InstallPpi (PeiServices, &gPciCfg2PpiList); + Status = (**PeiServices).InstallPpi ((CONST EFI_PEI_SERVICES **)PeiServices, &gPciCfg2PpiList); return Status; }