/* Calculate GICD_ICFGRn base address and corresponding bit field Int_config of the GIC distributor register. */
EFI_STATUS GicGetDistributorIcfgBaseAndBit(IN HARDWARE_INTERRUPT_SOURCE Source, OUT UINTN *RegAddress, OUT UINTN *Config1Bit)
/* Calculate GICD_ICFGRn base address and corresponding bit field Int_config of the GIC distributor register. */
EFI_STATUS GicGetDistributorIcfgBaseAndBit(IN HARDWARE_INTERRUPT_SOURCE Source, OUT UINTN *RegAddress, OUT UINTN *Config1Bit)
{
  UINTN  RegIndex;
  UINTN  Field;
  if (Source >= mGicNumInterrupts) {
    ASSERT (Source < mGicNumInterrupts);
    return EFI_UNSUPPORTED;
  }
  RegIndex    = Source / ARM_GIC_ICDICFR_F_STRIDE;
  Field       = Source % ARM_GIC_ICDICFR_F_STRIDE;
  *RegAddress = (UINTN)PcdGet64 (PcdGicDistributorBase)
                + ARM_GIC_ICDICFR
                + (ARM_GIC_ICDICFR_BYTES * RegIndex);
  *Config1Bit = ((Field * ARM_GIC_ICDICFR_F_WIDTH)
                 + ARM_GIC_ICDICFR_F_CONFIG1_BIT);
  return EFI_SUCCESS;
}