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 @@ -125,7 +126,7 @@ 128 * DEFAULT_RCLK, 2}, { 0x14e4, 0x4344, 0xffff, 0, "Sony Ericsson GC89 PC Card", 0x10}, { 0x151f, 0x0000, 0xffff, 0, "TOPIC Semiconductor TP560 56k modem", 0x10 }, -{ 0x1d0f, 0x8250, 0x1d0f, 0, "Amazon PCI serial device", 0x10 }, +{ 0x1d0f, 0x8250, 0, 0, "Amazon EC2 PCI serial console", 0x10 }, { 0x1fd4, 0x1999, 0x1fd4, 0x0001, "Sunix SER5xxxx Serial Port", 0x10, 8 * DEFAULT_RCLK }, { 0x8086, 0x0f0a, 0xffff, 0, "Intel ValleyView LPIO1 HSUART#1", 0x10, @@ -189,10 +190,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; @@ -207,6 +211,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_arm64.c =================================================================== --- sys/dev/uart/uart_cpu_arm64.c +++ sys/dev/uart/uart_cpu_arm64.c @@ -65,8 +65,9 @@ /* * UART console routines. */ +extern struct bus_space memmap_bus; bus_space_tag_t uart_bus_space_io; -bus_space_tag_t uart_bus_space_mem; +bus_space_tag_t uart_bus_space_mem = &memmap_bus; int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) @@ -108,7 +109,7 @@ static int uart_cpu_acpi_probe(struct uart_class **classp, bus_space_tag_t *bst, bus_space_handle_t *bsh, int *baud, u_int *rclk, u_int *shiftp, - u_int *iowidthp) + u_int *iowidthp, struct uart_pci_info *pcip) { struct acpi_uart_compat_data *cd; ACPI_TABLE_SPCR *spcr; @@ -148,10 +149,15 @@ goto out; *classp = cd->cd_class; + *shiftp = spcr->SerialPort.AccessWidth - 1; *rclk = 0; - *shiftp = 2; *iowidthp = spcr->SerialPort.BitWidth / 8; + pcip->vendor = spcr->PciVendorId; + pcip->device = spcr->PciDeviceId; + pcip->bus = spcr->PciBus; + pcip->slot = spcr->PciDevice; + out: acpi_unmap_table(spcr); return (err); @@ -179,7 +185,7 @@ err = ENXIO; #ifdef DEV_ACPI err = uart_cpu_acpi_probe(&class, &bst, &bsh, &br, &rclk, &shift, - &iowidth); + &iowidth, &di->pci_info); #endif #ifdef FDT if (err != 0) {