1098ca2bdSWarner Losh /*- 2718cf2ccSPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3718cf2ccSPedro F. Giffuni * 4f86e6000SWarner Losh * Copyright (c) 2006 Marcel Moolenaar All rights reserved. 5f86e6000SWarner Losh * Copyright (c) 2001 M. Warner Losh <imp@FreeBSD.org> 627d5dc18SMarcel Moolenaar * 727d5dc18SMarcel Moolenaar * Redistribution and use in source and binary forms, with or without 827d5dc18SMarcel Moolenaar * modification, are permitted provided that the following conditions 927d5dc18SMarcel Moolenaar * are met: 1027d5dc18SMarcel Moolenaar * 1. Redistributions of source code must retain the above copyright 1127d5dc18SMarcel Moolenaar * notice, this list of conditions and the following disclaimer. 1227d5dc18SMarcel Moolenaar * 2. Redistributions in binary form must reproduce the above copyright 1327d5dc18SMarcel Moolenaar * notice, this list of conditions and the following disclaimer in the 1427d5dc18SMarcel Moolenaar * documentation and/or other materials provided with the distribution. 1527d5dc18SMarcel Moolenaar * 1627d5dc18SMarcel Moolenaar * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1727d5dc18SMarcel Moolenaar * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1827d5dc18SMarcel Moolenaar * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1927d5dc18SMarcel Moolenaar * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2027d5dc18SMarcel Moolenaar * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2127d5dc18SMarcel Moolenaar * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2227d5dc18SMarcel Moolenaar * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2327d5dc18SMarcel Moolenaar * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2427d5dc18SMarcel Moolenaar * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2527d5dc18SMarcel Moolenaar * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2627d5dc18SMarcel Moolenaar */ 2727d5dc18SMarcel Moolenaar 2827d5dc18SMarcel Moolenaar #include <sys/cdefs.h> 2927d5dc18SMarcel Moolenaar __FBSDID("$FreeBSD$"); 3027d5dc18SMarcel Moolenaar 3127d5dc18SMarcel Moolenaar #include <sys/param.h> 3227d5dc18SMarcel Moolenaar #include <sys/systm.h> 3327d5dc18SMarcel Moolenaar #include <sys/bus.h> 3427d5dc18SMarcel Moolenaar #include <sys/conf.h> 3527d5dc18SMarcel Moolenaar #include <sys/kernel.h> 3627d5dc18SMarcel Moolenaar #include <sys/module.h> 3727d5dc18SMarcel Moolenaar #include <machine/bus.h> 3827d5dc18SMarcel Moolenaar #include <sys/rman.h> 3927d5dc18SMarcel Moolenaar #include <machine/resource.h> 4027d5dc18SMarcel Moolenaar 4127d5dc18SMarcel Moolenaar #include <dev/pci/pcivar.h> 4227d5dc18SMarcel Moolenaar 4327d5dc18SMarcel Moolenaar #include <dev/uart/uart.h> 4427d5dc18SMarcel Moolenaar #include <dev/uart/uart_bus.h> 4527d5dc18SMarcel Moolenaar 4624f9da03SMarcel Moolenaar #define DEFAULT_RCLK 1843200 4724f9da03SMarcel Moolenaar 4827d5dc18SMarcel Moolenaar static int uart_pci_probe(device_t dev); 49fb1d9b7fSBruce M Simpson static int uart_pci_attach(device_t dev); 50fb1d9b7fSBruce M Simpson static int uart_pci_detach(device_t dev); 5127d5dc18SMarcel Moolenaar 5227d5dc18SMarcel Moolenaar static device_method_t uart_pci_methods[] = { 5327d5dc18SMarcel Moolenaar /* Device interface */ 5427d5dc18SMarcel Moolenaar DEVMETHOD(device_probe, uart_pci_probe), 55fb1d9b7fSBruce M Simpson DEVMETHOD(device_attach, uart_pci_attach), 56fb1d9b7fSBruce M Simpson DEVMETHOD(device_detach, uart_pci_detach), 575b23b1b9SAndriy Gapon DEVMETHOD(device_resume, uart_bus_resume), 58dec28016SMarius Strobl DEVMETHOD_END 5927d5dc18SMarcel Moolenaar }; 6027d5dc18SMarcel Moolenaar 6127d5dc18SMarcel Moolenaar static driver_t uart_pci_driver = { 6227d5dc18SMarcel Moolenaar uart_driver_name, 6327d5dc18SMarcel Moolenaar uart_pci_methods, 6427d5dc18SMarcel Moolenaar sizeof(struct uart_softc), 6527d5dc18SMarcel Moolenaar }; 6627d5dc18SMarcel Moolenaar 6727d5dc18SMarcel Moolenaar struct pci_id { 6824f9da03SMarcel Moolenaar uint16_t vendor; 6924f9da03SMarcel Moolenaar uint16_t device; 7024f9da03SMarcel Moolenaar uint16_t subven; 7124f9da03SMarcel Moolenaar uint16_t subdev; 7227d5dc18SMarcel Moolenaar const char *desc; 7327d5dc18SMarcel Moolenaar int rid; 7424f9da03SMarcel Moolenaar int rclk; 759308005eSMarcel Moolenaar int regshft; 7627d5dc18SMarcel Moolenaar }; 7727d5dc18SMarcel Moolenaar 78dec28016SMarius Strobl static const struct pci_id pci_ns8250_ids[] = { 79ab2b8832SMarcel Moolenaar { 0x1028, 0x0008, 0xffff, 0, "Dell Remote Access Card III", 0x14, 80ab2b8832SMarcel Moolenaar 128 * DEFAULT_RCLK }, 81ab2b8832SMarcel Moolenaar { 0x1028, 0x0012, 0xffff, 0, "Dell RAC 4 Daughter Card Virtual UART", 0x14, 82ab2b8832SMarcel Moolenaar 128 * DEFAULT_RCLK }, 8324f9da03SMarcel Moolenaar { 0x1033, 0x0074, 0x1033, 0x8014, "NEC RCV56ACF 56k Voice Modem", 0x10 }, 8424f9da03SMarcel Moolenaar { 0x1033, 0x007d, 0x1033, 0x8012, "NEC RS232C", 0x10 }, 85ab2b8832SMarcel Moolenaar { 0x103c, 0x1048, 0x103c, 0x1227, "HP Diva Serial [GSP] UART - Powerbar SP2", 86ab2b8832SMarcel Moolenaar 0x10 }, 877db977fbSMarcel Moolenaar { 0x103c, 0x1048, 0x103c, 0x1301, "HP Diva RMP3", 0x14 }, 88ab2b8832SMarcel Moolenaar { 0x103c, 0x1290, 0xffff, 0, "HP Auxiliary Diva Serial Port", 0x18 }, 89b1a64a96SMarcel Moolenaar { 0x103c, 0x3301, 0xffff, 0, "HP iLO serial port", 0x10 }, 9024f9da03SMarcel Moolenaar { 0x11c1, 0x0480, 0xffff, 0, "Agere Systems Venus Modem (V90, 56KFlex)", 0x14 }, 9124f9da03SMarcel Moolenaar { 0x115d, 0x0103, 0xffff, 0, "Xircom Cardbus Ethernet + 56k Modem", 0x10 }, 92059178b6SEd Maste { 0x125b, 0x9100, 0xa000, 0x1000, 93059178b6SEd Maste "ASIX AX99100 PCIe 1/2/3/4-port RS-232/422/485", 0x10 }, 942f8c04adSJohn Baldwin { 0x1282, 0x6585, 0xffff, 0, "Davicom 56PDV PCI Modem", 0x10 }, 9524f9da03SMarcel Moolenaar { 0x12b9, 0x1008, 0xffff, 0, "3Com 56K FaxModem Model 5610", 0x10 }, 9624f9da03SMarcel Moolenaar { 0x131f, 0x1000, 0xffff, 0, "Siig CyberSerial (1-port) 16550", 0x18 }, 9724f9da03SMarcel Moolenaar { 0x131f, 0x1001, 0xffff, 0, "Siig CyberSerial (1-port) 16650", 0x18 }, 9824f9da03SMarcel Moolenaar { 0x131f, 0x1002, 0xffff, 0, "Siig CyberSerial (1-port) 16850", 0x18 }, 9924f9da03SMarcel Moolenaar { 0x131f, 0x2000, 0xffff, 0, "Siig CyberSerial (1-port) 16550", 0x10 }, 10024f9da03SMarcel Moolenaar { 0x131f, 0x2001, 0xffff, 0, "Siig CyberSerial (1-port) 16650", 0x10 }, 10124f9da03SMarcel Moolenaar { 0x131f, 0x2002, 0xffff, 0, "Siig CyberSerial (1-port) 16850", 0x10 }, 10224f9da03SMarcel Moolenaar { 0x135c, 0x0190, 0xffff, 0, "Quatech SSCLP-100", 0x18 }, 10324f9da03SMarcel Moolenaar { 0x135c, 0x01c0, 0xffff, 0, "Quatech SSCLP-200/300", 0x18 }, 104ab2b8832SMarcel Moolenaar { 0x135e, 0x7101, 0xffff, 0, "Sealevel Systems Single Port RS-232/422/485/530", 105ab2b8832SMarcel Moolenaar 0x18 }, 10624f9da03SMarcel Moolenaar { 0x1407, 0x0110, 0xffff, 0, "Lava Computer mfg DSerial-PCI Port A", 0x10 }, 10724f9da03SMarcel Moolenaar { 0x1407, 0x0111, 0xffff, 0, "Lava Computer mfg DSerial-PCI Port B", 0x10 }, 10864fc5491SKai Wang { 0x1407, 0x0510, 0xffff, 0, "Lava SP Serial 550 PCI", 0x10 }, 109ab2b8832SMarcel Moolenaar { 0x1409, 0x7168, 0x1409, 0x4025, "Timedia Technology Serial Port", 0x10, 110ab2b8832SMarcel Moolenaar 8 * DEFAULT_RCLK }, 111ab2b8832SMarcel Moolenaar { 0x1409, 0x7168, 0x1409, 0x4027, "Timedia Technology Serial Port", 0x10, 112ab2b8832SMarcel Moolenaar 8 * DEFAULT_RCLK }, 113ab2b8832SMarcel Moolenaar { 0x1409, 0x7168, 0x1409, 0x4028, "Timedia Technology Serial Port", 0x10, 114ab2b8832SMarcel Moolenaar 8 * DEFAULT_RCLK }, 115ab2b8832SMarcel Moolenaar { 0x1409, 0x7168, 0x1409, 0x5025, "Timedia Technology Serial Port", 0x10, 116ab2b8832SMarcel Moolenaar 8 * DEFAULT_RCLK }, 117ab2b8832SMarcel Moolenaar { 0x1409, 0x7168, 0x1409, 0x5027, "Timedia Technology Serial Port", 0x10, 118ab2b8832SMarcel Moolenaar 8 * DEFAULT_RCLK }, 119ab2b8832SMarcel Moolenaar { 0x1415, 0x950b, 0xffff, 0, "Oxford Semiconductor OXCB950 Cardbus 16950 UART", 120ab2b8832SMarcel Moolenaar 0x10, 16384000 }, 1217e47312cSPeter Grehan { 0x1415, 0xc120, 0xffff, 0, "Oxford Semiconductor OXPCIe952 PCIe 16950 UART", 1227e47312cSPeter Grehan 0x10 }, 1237bd6f3d0SMarcel Moolenaar { 0x14e4, 0x160a, 0xffff, 0, "Broadcom TruManage UART", 0x10, 1247bd6f3d0SMarcel Moolenaar 128 * DEFAULT_RCLK, 2}, 125383227f1SEitan Adler { 0x14e4, 0x4344, 0xffff, 0, "Sony Ericsson GC89 PC Card", 0x10}, 126ab2b8832SMarcel Moolenaar { 0x151f, 0x0000, 0xffff, 0, "TOPIC Semiconductor TP560 56k modem", 0x10 }, 1271bfa40d2SColin Percival { 0x1d0f, 0x8250, 0x0000, 0, "Amazon PCI serial device", 0x10 }, 128189bd7a9SColin Percival { 0x1d0f, 0x8250, 0x1d0f, 0, "Amazon PCI serial device", 0x10 }, 12950c0e894SMarius Strobl { 0x1fd4, 0x1999, 0x1fd4, 0x0001, "Sunix SER5xxxx Serial Port", 0x10, 13050c0e894SMarius Strobl 8 * DEFAULT_RCLK }, 1319308005eSMarcel Moolenaar { 0x8086, 0x0f0a, 0xffff, 0, "Intel ValleyView LPIO1 HSUART#1", 0x10, 1329308005eSMarcel Moolenaar 24 * DEFAULT_RCLK, 2 }, 1339308005eSMarcel Moolenaar { 0x8086, 0x0f0c, 0xffff, 0, "Intel ValleyView LPIO1 HSUART#2", 0x10, 1349308005eSMarcel Moolenaar 24 * DEFAULT_RCLK, 2 }, 135ef7161e7SEd Maste { 0x8086, 0x108f, 0xffff, 0, "Intel AMT - SOL", 0x10 }, 136f37cc713SJustin Hibbits { 0x8086, 0x19d8, 0xffff, 0, "Intel Denverton UART", 0x10 }, 13784f94128SKonstantin Belousov { 0x8086, 0x1c3d, 0xffff, 0, "Intel AMT - KT Controller", 0x10 }, 1385b8b6b26SJose Luis Duran { 0x8086, 0x1d3d, 0xffff, 0, "Intel C600/X79 Series Chipset KT Controller", 1395b8b6b26SJose Luis Duran 0x10 }, 1400a5c75e5SAlexander Motin { 0x8086, 0x1e3d, 0xffff, 0, "Intel Panther Point KT Controller", 0x10 }, 141cb3c7e7fSSean Bruno { 0x8086, 0x228a, 0xffff, 0, "Intel Cherryview SIO HSUART#1", 0x10, 142cb3c7e7fSSean Bruno 24 * DEFAULT_RCLK, 2 }, 143cb3c7e7fSSean Bruno { 0x8086, 0x228c, 0xffff, 0, "Intel Cherryview SIO HSUART#2", 0x10, 144cb3c7e7fSSean Bruno 24 * DEFAULT_RCLK, 2 }, 145aa475e14SSean Bruno { 0x8086, 0x2a07, 0xffff, 0, "Intel AMT - PM965/GM965 KT Controller", 0x10 }, 146a1d18b66SJohn Baldwin { 0x8086, 0x2a47, 0xffff, 0, "Mobile 4 Series Chipset KT Controller", 0x10 }, 14777b5f5c8SKonstantin Belousov { 0x8086, 0x2e17, 0xffff, 0, "4 Series Chipset Serial KT Controller", 0x10 }, 148f5793e6fSKonstantin Belousov { 0x8086, 0x3b67, 0xffff, 0, "5 Series/3400 Series Chipset KT Controller", 149f5793e6fSKonstantin Belousov 0x10 }, 150*8f156243SJose Luis Duran { 0x8086, 0x5abc, 0xffff, 0, "Intel Apollo Lake SIO/LPSS UART 0", 0x10, 151*8f156243SJose Luis Duran 24 * DEFAULT_RCLK, 2 }, 152*8f156243SJose Luis Duran { 0x8086, 0x5abe, 0xffff, 0, "Intel Apollo Lake SIO/LPSS UART 1", 0x10, 153*8f156243SJose Luis Duran 24 * DEFAULT_RCLK, 2 }, 154*8f156243SJose Luis Duran { 0x8086, 0x5ac0, 0xffff, 0, "Intel Apollo Lake SIO/LPSS UART 2", 0x10, 155*8f156243SJose Luis Duran 24 * DEFAULT_RCLK, 2 }, 156*8f156243SJose Luis Duran { 0x8086, 0x5aee, 0xffff, 0, "Intel Apollo Lake SIO/LPSS UART 3", 0x10, 157*8f156243SJose Luis Duran 24 * DEFAULT_RCLK, 2 }, 1581a74905fSKevin Lo { 0x8086, 0x8811, 0xffff, 0, "Intel EG20T Serial Port 0", 0x10 }, 1591a74905fSKevin Lo { 0x8086, 0x8812, 0xffff, 0, "Intel EG20T Serial Port 1", 0x10 }, 1601a74905fSKevin Lo { 0x8086, 0x8813, 0xffff, 0, "Intel EG20T Serial Port 2", 0x10 }, 1611a74905fSKevin Lo { 0x8086, 0x8814, 0xffff, 0, "Intel EG20T Serial Port 3", 0x10 }, 162f478527dSSean Bruno { 0x8086, 0x8c3d, 0xffff, 0, "Intel Lynx Point KT Controller", 0x10 }, 163e67f3becSAlexander Motin { 0x8086, 0x8cbd, 0xffff, 0, "Intel Wildcat Point KT Controller", 0x10 }, 1644abd2509SSean Bruno { 0x8086, 0x9c3d, 0xffff, 0, "Intel Lynx Point-LP HECI KT", 0x10 }, 1657b4386c6SAlexander Motin { 0x9710, 0x9820, 0x1000, 1, "NetMos NM9820 Serial Port", 0x10 }, 166843994aeSJohn Baldwin { 0x9710, 0x9835, 0x1000, 1, "NetMos NM9835 Serial Port", 0x10 }, 1671d864e0dSMarcel Moolenaar { 0x9710, 0x9865, 0xa000, 0x1000, "NetMos NM9865 Serial Port", 0x10 }, 16824f4fe9aSHans Petter Selasky { 0x9710, 0x9900, 0xa000, 0x1000, 16924f4fe9aSHans Petter Selasky "MosChip MCS9900 PCIe to Peripheral Controller", 0x10 }, 170506b3c39SXin LI { 0x9710, 0x9901, 0xa000, 0x1000, 171506b3c39SXin LI "MosChip MCS9901 PCIe to Peripheral Controller", 0x10 }, 172c8e72d0cSRemko Lodder { 0x9710, 0x9904, 0xa000, 0x1000, 173c8e72d0cSRemko Lodder "MosChip MCS9904 PCIe to Peripheral Controller", 0x10 }, 17439367742SMarius Strobl { 0x9710, 0x9922, 0xa000, 0x1000, 17539367742SMarius Strobl "MosChip MCS9922 PCIe to Peripheral Controller", 0x10 }, 17624f9da03SMarcel Moolenaar { 0xdeaf, 0x9051, 0xffff, 0, "Middle Digital PC Weasel Serial Port", 0x10 }, 17724f9da03SMarcel Moolenaar { 0xffff, 0, 0xffff, 0, NULL, 0, 0} 17827d5dc18SMarcel Moolenaar }; 17927d5dc18SMarcel Moolenaar 180dec28016SMarius Strobl const static struct pci_id * 181dec28016SMarius Strobl uart_pci_match(device_t dev, const struct pci_id *id) 18227d5dc18SMarcel Moolenaar { 18324f9da03SMarcel Moolenaar uint16_t device, subdev, subven, vendor; 18427d5dc18SMarcel Moolenaar 18524f9da03SMarcel Moolenaar vendor = pci_get_vendor(dev); 18624f9da03SMarcel Moolenaar device = pci_get_device(dev); 18724f9da03SMarcel Moolenaar while (id->vendor != 0xffff && 18824f9da03SMarcel Moolenaar (id->vendor != vendor || id->device != device)) 18927d5dc18SMarcel Moolenaar id++; 19024f9da03SMarcel Moolenaar if (id->vendor == 0xffff) 19124f9da03SMarcel Moolenaar return (NULL); 19224f9da03SMarcel Moolenaar if (id->subven == 0xffff) 19324f9da03SMarcel Moolenaar return (id); 19424f9da03SMarcel Moolenaar subven = pci_get_subvendor(dev); 19524f9da03SMarcel Moolenaar subdev = pci_get_subdevice(dev); 19624f9da03SMarcel Moolenaar while (id->vendor == vendor && id->device == device && 19724f9da03SMarcel Moolenaar (id->subven != subven || id->subdev != subdev)) 19824f9da03SMarcel Moolenaar id++; 19924f9da03SMarcel Moolenaar return ((id->vendor == vendor && id->device == device) ? id : NULL); 20027d5dc18SMarcel Moolenaar } 20127d5dc18SMarcel Moolenaar 20227d5dc18SMarcel Moolenaar static int 20327d5dc18SMarcel Moolenaar uart_pci_probe(device_t dev) 20427d5dc18SMarcel Moolenaar { 20527d5dc18SMarcel Moolenaar struct uart_softc *sc; 206dec28016SMarius Strobl const struct pci_id *id; 207a177309fSMarcel Moolenaar int result; 20827d5dc18SMarcel Moolenaar 20927d5dc18SMarcel Moolenaar sc = device_get_softc(dev); 21027d5dc18SMarcel Moolenaar 21124f9da03SMarcel Moolenaar id = uart_pci_match(dev, pci_ns8250_ids); 21227d5dc18SMarcel Moolenaar if (id != NULL) { 21327d5dc18SMarcel Moolenaar sc->sc_class = &uart_ns8250_class; 21427d5dc18SMarcel Moolenaar goto match; 21527d5dc18SMarcel Moolenaar } 21627d5dc18SMarcel Moolenaar /* Add checks for non-ns8250 IDs here. */ 21727d5dc18SMarcel Moolenaar return (ENXIO); 21827d5dc18SMarcel Moolenaar 21927d5dc18SMarcel Moolenaar match: 220381388b9SMatt Macy result = uart_bus_probe(dev, id->regshft, 0, id->rclk, id->rid, 0, 0); 221a177309fSMarcel Moolenaar /* Bail out on error. */ 222a177309fSMarcel Moolenaar if (result > 0) 223a177309fSMarcel Moolenaar return (result); 224a177309fSMarcel Moolenaar /* Set/override the device description. */ 22527d5dc18SMarcel Moolenaar if (id->desc) 22627d5dc18SMarcel Moolenaar device_set_desc(dev, id->desc); 227a177309fSMarcel Moolenaar return (result); 22827d5dc18SMarcel Moolenaar } 22927d5dc18SMarcel Moolenaar 230fb1d9b7fSBruce M Simpson static int 231fb1d9b7fSBruce M Simpson uart_pci_attach(device_t dev) 232fb1d9b7fSBruce M Simpson { 233fb1d9b7fSBruce M Simpson struct uart_softc *sc; 234fb1d9b7fSBruce M Simpson int count; 235fb1d9b7fSBruce M Simpson 236fb1d9b7fSBruce M Simpson sc = device_get_softc(dev); 237fb1d9b7fSBruce M Simpson 238fb1d9b7fSBruce M Simpson /* 239955b6109SWarner Losh * Use MSI in preference to legacy IRQ if available. However, experience 240955b6109SWarner Losh * suggests this is only reliable when one MSI vector is advertised. 241fb1d9b7fSBruce M Simpson */ 242955b6109SWarner Losh if (pci_msi_count(dev) == 1) { 243fb1d9b7fSBruce M Simpson count = 1; 244fb1d9b7fSBruce M Simpson if (pci_alloc_msi(dev, &count) == 0) { 245fb1d9b7fSBruce M Simpson sc->sc_irid = 1; 246fb1d9b7fSBruce M Simpson device_printf(dev, "Using %d MSI message\n", count); 247fb1d9b7fSBruce M Simpson } 248fb1d9b7fSBruce M Simpson } 249fb1d9b7fSBruce M Simpson 250fb1d9b7fSBruce M Simpson return (uart_bus_attach(dev)); 251fb1d9b7fSBruce M Simpson } 252fb1d9b7fSBruce M Simpson 253fb1d9b7fSBruce M Simpson static int 254fb1d9b7fSBruce M Simpson uart_pci_detach(device_t dev) 255fb1d9b7fSBruce M Simpson { 256fb1d9b7fSBruce M Simpson struct uart_softc *sc; 257fb1d9b7fSBruce M Simpson 258fb1d9b7fSBruce M Simpson sc = device_get_softc(dev); 259fb1d9b7fSBruce M Simpson 260fb1d9b7fSBruce M Simpson if (sc->sc_irid != 0) 261fb1d9b7fSBruce M Simpson pci_release_msi(dev); 262fb1d9b7fSBruce M Simpson 263fb1d9b7fSBruce M Simpson return (uart_bus_detach(dev)); 264fb1d9b7fSBruce M Simpson } 265fb1d9b7fSBruce M Simpson 266dec28016SMarius Strobl DRIVER_MODULE(uart, pci, uart_pci_driver, uart_devclass, NULL, NULL); 267