Index: sys/dev/uart/uart_bus_pci.c =================================================================== --- sys/dev/uart/uart_bus_pci.c +++ sys/dev/uart/uart_bus_pci.c @@ -43,6 +43,7 @@ #include #include +#include #define DEFAULT_RCLK 1843200 @@ -190,10 +191,13 @@ return ((id->vendor == vendor && id->device == device) ? id : NULL); } +extern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs; + static int uart_pci_probe(device_t dev) { struct uart_softc *sc; + struct uart_devinfo *sysdev; const struct pci_id *id; int result; @@ -208,6 +212,16 @@ return (ENXIO); match: + SLIST_FOREACH(sysdev, &uart_sysdevs, next) { + if (sysdev->pci_info.vendor == pci_get_vendor(dev) + && sysdev->pci_info.device == pci_get_device(dev) + && sysdev->pci_info.bus == pci_get_bus(dev) + && sysdev->pci_info.slot == pci_get_slot(dev)) { + sc->sc_sysdev = sysdev; + sysdev->bas.rclk = sc->sc_bas.rclk; + } + } + result = uart_bus_probe(dev, id->regshft, 0, id->rclk, id->rid, 0, 0); /* Bail out on error. */ if (result > 0) Index: sys/dev/uart/uart_cpu.h =================================================================== --- sys/dev/uart/uart_cpu.h +++ sys/dev/uart/uart_cpu.h @@ -52,6 +52,16 @@ extern bus_space_tag_t uart_bus_space_io; extern bus_space_tag_t uart_bus_space_mem; +/* + * PCI bus address from the ACPI SPCR table. + */ +struct uart_pci_info { + uint16_t vendor; + uint16_t device; + uint8_t bus; + uint8_t slot; +}; + /* * Console and debug port device info. */ @@ -72,6 +82,7 @@ void *cookie; /* Type dependent use. */ struct mtx *hwmtx; struct uart_softc *sc; /* valid only from start of attach */ + struct uart_pci_info pci_info; }; int uart_cpu_eqres(struct uart_bas *, struct uart_bas *); Index: sys/dev/uart/uart_cpu_acpi.c =================================================================== --- sys/dev/uart/uart_cpu_acpi.c +++ sys/dev/uart/uart_cpu_acpi.c @@ -147,6 +147,10 @@ (int)spcr->BaudRate); goto out; } + di->pci_info.vendor = spcr->PciVendorId; + di->pci_info.device = spcr->PciDeviceId; + di->pci_info.bus = spcr->PciBus; + di->pci_info.slot = spcr->PciDevice; /* Apply device tweaks. */ if ((cd->cd_quirks & UART_F_IGNORE_SPCR_REGSHFT) ==