mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-24 11:29:10 +00:00
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
7eaec467d8
commit
e0a9358679
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=135574
@ -280,8 +280,8 @@ acpi_pci_save_handle(ACPI_HANDLE handle, UINT32 level, void *context,
|
||||
|
||||
if (ACPI_FAILURE(acpi_GetInteger(handle, "_ADR", &address)))
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
slot = address >> 16;
|
||||
func = address & 0xffff;
|
||||
slot = ACPI_ADR_PCI_SLOT(address);
|
||||
func = ACPI_ADR_PCI_FUNC(address);
|
||||
if (device_get_children((device_t)context, &devlist, &devcount) != 0)
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
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,
|
||||
(int)((entry->prt.Address & 0xffff0000) >> 16),
|
||||
(int)(ACPI_ADR_PCI_SLOT(entry->prt.Address)),
|
||||
(int)entry->prt.Pin);
|
||||
}
|
||||
|
||||
@ -981,7 +981,7 @@ acpi_pci_link_config(device_t dev, ACPI_BUFFER *prtbuf, int busno)
|
||||
|
||||
snprintf(prthint, sizeof(prthint),
|
||||
"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);
|
||||
|
||||
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) {
|
||||
prt = &entry->prt;
|
||||
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)
|
||||
break;
|
||||
}
|
||||
|
@ -188,8 +188,8 @@ acpi_pcib_acpi_attach(device_t dev)
|
||||
device_printf(dev, "couldn't find _ADR\n");
|
||||
} else {
|
||||
/* XXX: We assume bus 0. */
|
||||
slot = addr >> 16;
|
||||
func = addr & 0xffff;
|
||||
slot = ACPI_ADR_PCI_SLOT(addr);
|
||||
func = ACPI_ADR_PCI_FUNC(addr);
|
||||
if (bootverbose)
|
||||
device_printf(dev, "reading config registers from 0:%d:%d\n",
|
||||
slot, func);
|
||||
|
@ -98,6 +98,10 @@ struct acpi_prw_data {
|
||||
/* Flags for each device defined in the AML namespace. */
|
||||
#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
|
||||
* file, sysctls, and I/O on the control device. Entry points from below
|
||||
|
Loading…
Reference in New Issue
Block a user