git: 9eb5fd359969 - main - uart: Match simple comm

Warner Losh imp at FreeBSD.org
Thu Sep 30 20:35:28 UTC 2021


The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=9eb5fd3599695acc76291777bc587e14746e960c

commit 9eb5fd3599695acc76291777bc587e14746e960c
Author:     Warner Losh <imp at FreeBSD.org>
AuthorDate: 2021-09-30 20:16:19 +0000
Commit:     Warner Losh <imp at FreeBSD.org>
CommitDate: 2021-09-30 20:16:19 +0000

    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
---
 sys/dev/uart/uart_bus_pci.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/sys/dev/uart/uart_bus_pci.c b/sys/dev/uart/uart_bus_pci.c
index 4090af0ea9a0..fe5ad2b6d206 100644
--- a/sys/dev/uart/uart_bus_pci.c
+++ b/sys/dev/uart/uart_bus_pci.c
@@ -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);
 


More information about the dev-commits-src-main mailing list