/* Update the value of an 32-bit PCI configuration register in a PCI device. If the PCI Configuration register specified by PciAddress is already programmed with a non-zero value, then return the current value. Otherwise update the PCI configuration register specified by PciAddress with the value specified by Value and return the value programmed into the PCI configuration register. All values must be masked using the bitmask specified by Mask. */
UINT32 SerialPortLibUpdatePciRegister32(UINTN PciAddress, UINT32 Value, UINT32 Mask)
/* Update the value of an 32-bit PCI configuration register in a PCI device. If the PCI Configuration register specified by PciAddress is already programmed with a non-zero value, then return the current value. Otherwise update the PCI configuration register specified by PciAddress with the value specified by Value and return the value programmed into the PCI configuration register. All values must be masked using the bitmask specified by Mask. */
UINT32 SerialPortLibUpdatePciRegister32(UINTN PciAddress, UINT32 Value, UINT32 Mask)
{
  UINT32  CurrentValue;
  CurrentValue = PciRead32 (PciAddress) & Mask;
  if (CurrentValue != 0) {
    return CurrentValue;
  }
  return PciWrite32 (PciAddress, Value & Mask);
}