kernel/acpi/acpi_osl.cpp
/*
 * Platform and hardware-independent PCI configuration space access
 * Note: Can't use "Register" as a parameter, changed to "Reg" --
 * certain compilers complain.
 */
Platform and hardware-independent PCI configuration space access
Note: Can't use "Register" as a parameter, changed to "Reg"
certain compilers complain.
Platform and hardware - independent PCI configuration space access Note : Can ' t use " Register " as a parameter changed to " Reg " certain compilers complain .
ACPI_STATUS AcpiOsReadPciConfiguration(ACPI_PCI_ID *PciId, UINT32 Reg, UINT64 *Value, UINT32 Width)
{
  uint32_t raw_reg;
  uint32_t raw_reg_upper;
  KL_TRC_ENTRY;
  ASSERT(PciId->Segment == 0);
  pci_address addr;
  addr.bus = PciId->Bus;
  addr.device = PciId->Device;
  addr.function = PciId->Function;
  addr.register_num = Reg;
  raw_reg = pci_read_raw_reg(addr);
  switch(Width)
  {
  case 8:
    KL_TRC_TRACE(TRC_LVL::FLOW, "8-bit width\n");
    *Value = raw_reg & 0xFF;
    break;
  case 16:
    KL_TRC_TRACE(TRC_LVL::FLOW, "16-bit width\n");
    *Value = raw_reg & 0xFFFF;
    break;
  case 32:
    KL_TRC_TRACE(TRC_LVL::FLOW, "32-bit width\n");
    *Value = raw_reg;
    break;
  case 64:
    KL_TRC_TRACE(TRC_LVL::FLOW, "64-bit width\n");
    addr.register_num++;
    raw_reg_upper = pci_read_raw_reg(addr);
    *Value = raw_reg_upper;
    *Value = *Value << 32;
    *Value = *Value | raw_reg;
    break;
  default:
    panic("Unknown PCI register width");
  }
  KL_TRC_EXIT;
  return AE_OK;
}
ACPI_STATUS AcpiOsReadPciConfiguration ( ACPI_PCI_ID * PciId , UINT32 Reg , UINT64 * Value , UINT32 Width ) { uint32_t raw_reg ; uint32_t raw_reg_upper ; KL_TRC_ENTRY ; ASSERT ( PciId -> Segment == 0 ) ; pci_address addr ; addr . bus = PciId -> Bus ; addr . device = PciId -> Device ; addr . function = PciId -> Function ; addr . register_num = Reg ; raw_reg = pci_read_raw_reg ( addr ) ; switch ( Width ) { case 8 : KL_TRC_TRACE ( TRC_LVL :: FLOW , " \n " ) ; * Value = raw_reg & 0xFF ; break ; case 16 : KL_TRC_TRACE ( TRC_LVL :: FLOW , " \n " ) ; * Value = raw_reg & 0xFFFF ; break ; case 32 : KL_TRC_TRACE ( TRC_LVL :: FLOW , " \n " ) ; * Value = raw_reg ; break ; case 64 : KL_TRC_TRACE ( TRC_LVL :: FLOW , " \n " ) ; addr . register_num ++ ; raw_reg_upper = pci_read_raw_reg ( addr ) ; * Value = raw_reg_upper ; * Value = * Value << 32 ; * Value = * Value | raw_reg ; break ; default : panic ( " " ) ; } KL_TRC_EXIT ; return AE_OK ; }
Platform and hardware-independent PCI configuration space access
 Note: Can't use "Register" as a parameter, changed to "Reg"
 certain compilers complain.
Platform and hardware - independent PCI configuration space access Note : Can ' t use " Register " as a parameter changed to " Reg " certain compilers complain .
// PCI Express isn't currently supported.