uart: Match simple comm

Match the PCI simple comm devices (or try to). Be conservative and use
legacy interrupts rather than msi messages by default for this 'catch
all' since it matches what Linux does (it has opt-in generally for MSI,
but also matches more devices because it does a catch-all like
implemented in this commit).

Sponsored by:		Netflix
Reviewed by:		kbowling
Differential Revision:	https://reviews.freebsd.org/D32228
This commit is contained in:
Warner Losh 2021-09-30 14:16:19 -06:00
parent bf40080762
commit 9eb5fd3599

View File

@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
#include <dev/uart/uart.h>
#include <dev/uart/uart_bus.h>
@ -218,6 +219,12 @@ uart_pci_probe(device_t dev)
{
struct uart_softc *sc;
const struct pci_id *id;
struct pci_id cid = {
.regshft = 0,
.rclk = 0,
.rid = 0x10 | PCI_NO_MSI,
.desc = "Generic SimpleComm PCI device",
};
int result;
sc = device_get_softc(dev);
@ -227,6 +234,14 @@ uart_pci_probe(device_t dev)
sc->sc_class = &uart_ns8250_class;
goto match;
}
if (pci_get_class(dev) == PCIC_SIMPLECOMM &&
pci_get_subclass(dev) == PCIS_SIMPLECOMM_UART &&
pci_get_progif(dev) < PCIP_SIMPLECOMM_UART_16550A) {
/* XXX rclk what to do */
id = &cid;
sc->sc_class = &uart_ns8250_class;
goto match;
}
/* Add checks for non-ns8250 IDs here. */
return (ENXIO);