Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147032595
D9123.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D9123.diff
View Options
Index: head/sys/dev/uart/uart_bus_pci.c
===================================================================
--- head/sys/dev/uart/uart_bus_pci.c
+++ head/sys/dev/uart/uart_bus_pci.c
@@ -45,12 +45,14 @@
#define DEFAULT_RCLK 1843200
static int uart_pci_probe(device_t dev);
+static int uart_pci_attach(device_t dev);
+static int uart_pci_detach(device_t dev);
static device_method_t uart_pci_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, uart_pci_probe),
- DEVMETHOD(device_attach, uart_bus_attach),
- DEVMETHOD(device_detach, uart_bus_detach),
+ DEVMETHOD(device_attach, uart_pci_attach),
+ DEVMETHOD(device_detach, uart_pci_detach),
DEVMETHOD(device_resume, uart_bus_resume),
DEVMETHOD_END
};
@@ -209,4 +211,40 @@
return (result);
}
+static int
+uart_pci_attach(device_t dev)
+{
+ struct uart_softc *sc;
+ int count;
+
+ sc = device_get_softc(dev);
+
+ /*
+ * Use MSI in preference to legacy IRQ if available.
+ * Whilst some PCIe UARTs support >1 MSI vector, use only the first.
+ */
+ if (pci_msi_count(dev) > 0) {
+ count = 1;
+ if (pci_alloc_msi(dev, &count) == 0) {
+ sc->sc_irid = 1;
+ device_printf(dev, "Using %d MSI message\n", count);
+ }
+ }
+
+ return (uart_bus_attach(dev));
+}
+
+static int
+uart_pci_detach(device_t dev)
+{
+ struct uart_softc *sc;
+
+ sc = device_get_softc(dev);
+
+ if (sc->sc_irid != 0)
+ pci_release_msi(dev);
+
+ return (uart_bus_detach(dev));
+}
+
DRIVER_MODULE(uart, pci, uart_pci_driver, uart_devclass, NULL, NULL);
Index: head/sys/dev/uart/uart_core.c
===================================================================
--- head/sys/dev/uart/uart_core.c
+++ head/sys/dev/uart/uart_core.c
@@ -677,7 +677,6 @@
* safest thing to do.
*/
if (filt != FILTER_SCHEDULE_THREAD && !uart_force_poll) {
- sc->sc_irid = 0;
sc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ,
&sc->sc_irid, RF_ACTIVE | RF_SHAREABLE);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 8, 6:49 PM (9 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29398142
Default Alt Text
D9123.diff (1 KB)
Attached To
Mode
D9123: Allow uart(4) to use MSI interrupts (for PCI child instances).
Attached
Detach File
Event Timeline
Log In to Comment