Add a couple of macros to extract the PCI slot (device) and function from
an ACPI _ADR value and use that rather than inlining the same shifts and masks everywhere.
This commit is contained in:
parent
3956303607
commit
cf1b8fbca5
@ -280,8 +280,8 @@ acpi_pci_save_handle(ACPI_HANDLE handle, UINT32 level, void *context,
|
|||||||
|
|
||||||
if (ACPI_FAILURE(acpi_GetInteger(handle, "_ADR", &address)))
|
if (ACPI_FAILURE(acpi_GetInteger(handle, "_ADR", &address)))
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS (AE_OK);
|
||||||
slot = address >> 16;
|
slot = ACPI_ADR_PCI_SLOT(address);
|
||||||
func = address & 0xffff;
|
func = ACPI_ADR_PCI_FUNC(address);
|
||||||
if (device_get_children((device_t)context, &devlist, &devcount) != 0)
|
if (device_get_children((device_t)context, &devlist, &devcount) != 0)
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS (AE_OK);
|
||||||
for (i = 0; i < devcount; i++) {
|
for (i = 0; i < devcount; i++) {
|
||||||
|
@ -151,7 +151,7 @@ acpi_pci_link_entry_dump(struct acpi_prt_entry *entry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf(" %d.%d.%d\n", entry->busno,
|
printf(" %d.%d.%d\n", entry->busno,
|
||||||
(int)((entry->prt.Address & 0xffff0000) >> 16),
|
(int)(ACPI_ADR_PCI_SLOT(entry->prt.Address)),
|
||||||
(int)entry->prt.Pin);
|
(int)entry->prt.Pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -981,7 +981,7 @@ acpi_pci_link_config(device_t dev, ACPI_BUFFER *prtbuf, int busno)
|
|||||||
|
|
||||||
snprintf(prthint, sizeof(prthint),
|
snprintf(prthint, sizeof(prthint),
|
||||||
"hw.acpi.pci.link.%d.%d.%d.irq", entry->busno,
|
"hw.acpi.pci.link.%d.%d.%d.irq", entry->busno,
|
||||||
(int)((entry->prt.Address & 0xffff0000) >> 16),
|
(int)(ACPI_ADR_PCI_SLOT(entry->prt.Address)),
|
||||||
(int)entry->prt.Pin);
|
(int)entry->prt.Pin);
|
||||||
|
|
||||||
if (getenv_int(prthint, &irq) == 0)
|
if (getenv_int(prthint, &irq) == 0)
|
||||||
@ -1069,7 +1069,7 @@ acpi_pci_find_prt(device_t pcibdev, device_t dev, int pin)
|
|||||||
TAILQ_FOREACH(entry, &acpi_prt_entries, links) {
|
TAILQ_FOREACH(entry, &acpi_prt_entries, links) {
|
||||||
prt = &entry->prt;
|
prt = &entry->prt;
|
||||||
if (entry->busno == pci_get_bus(dev) &&
|
if (entry->busno == pci_get_bus(dev) &&
|
||||||
(prt->Address & 0xffff0000) >> 16 == pci_get_slot(dev) &&
|
ACPI_ADR_PCI_SLOT(prt->Address) == pci_get_slot(dev) &&
|
||||||
prt->Pin == pin)
|
prt->Pin == pin)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -188,8 +188,8 @@ acpi_pcib_acpi_attach(device_t dev)
|
|||||||
device_printf(dev, "couldn't find _ADR\n");
|
device_printf(dev, "couldn't find _ADR\n");
|
||||||
} else {
|
} else {
|
||||||
/* XXX: We assume bus 0. */
|
/* XXX: We assume bus 0. */
|
||||||
slot = addr >> 16;
|
slot = ACPI_ADR_PCI_SLOT(addr);
|
||||||
func = addr & 0xffff;
|
func = ACPI_ADR_PCI_FUNC(addr);
|
||||||
if (bootverbose)
|
if (bootverbose)
|
||||||
device_printf(dev, "reading config registers from 0:%d:%d\n",
|
device_printf(dev, "reading config registers from 0:%d:%d\n",
|
||||||
slot, func);
|
slot, func);
|
||||||
|
@ -98,6 +98,10 @@ struct acpi_prw_data {
|
|||||||
/* Flags for each device defined in the AML namespace. */
|
/* Flags for each device defined in the AML namespace. */
|
||||||
#define ACPI_FLAG_WAKE_ENABLED 0x1
|
#define ACPI_FLAG_WAKE_ENABLED 0x1
|
||||||
|
|
||||||
|
/* Macros for extracting parts of a PCI address from an _ADR value. */
|
||||||
|
#define ACPI_ADR_PCI_SLOT(adr) (((adr) & 0xffff0000) >> 16)
|
||||||
|
#define ACPI_ADR_PCI_FUNC(adr) ((adr) & 0xffff)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Entry points to ACPI from above are global functions defined in this
|
* Entry points to ACPI from above are global functions defined in this
|
||||||
* file, sysctls, and I/O on the control device. Entry points from below
|
* file, sysctls, and I/O on the control device. Entry points from below
|
||||||
|
Loading…
x
Reference in New Issue
Block a user