uart_bus_acpi.c revision 119815
113687Swosch/* 213687Swosch * Copyright (c) 2001 M. Warner Losh. All rights reserved. 313687Swosch * 415714Sache * Redistribution and use in source and binary forms, with or without 513687Swosch * modification, are permitted provided that the following conditions 613687Swosch * are met: 713842Swosch * 1. Redistributions of source code must retain the above copyright 813842Swosch * notice, this list of conditions and the following disclaimer. 913687Swosch * 2. Redistributions in binary form must reproduce the above copyright 1015714Sache * notice, this list of conditions and the following disclaimer in the 1115714Sache * documentation and/or other materials provided with the distribution. 1213687Swosch * 1313687Swosch * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1413687Swosch * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1513687Swosch * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1613687Swosch * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1713687Swosch * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 1813687Swosch * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1913687Swosch * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2013687Swosch * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2113687Swosch * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2213687Swosch * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2313687Swosch */ 2413687Swosch 2513687Swosch#include <sys/cdefs.h> 2613687Swosch__FBSDID("$FreeBSD: head/sys/dev/uart/uart_bus_acpi.c 119815 2003-09-06 23:13:47Z marcel $"); 2713842Swosch 2813687Swosch#include <sys/param.h> 2913842Swosch#include <sys/systm.h> 3013842Swosch#include <sys/bus.h> 3113842Swosch#include <sys/conf.h> 3213842Swosch#include <sys/kernel.h> 3313687Swosch#include <sys/module.h> 3413687Swosch#include <machine/bus.h> 3513687Swosch#include <sys/rman.h> 3613842Swosch#include <machine/resource.h> 37 38#include <isa/isavar.h> 39 40#include <dev/uart/uart.h> 41#include <dev/uart/uart_bus.h> 42 43static int uart_acpi_probe(device_t dev); 44 45static device_method_t uart_acpi_methods[] = { 46 /* Device interface */ 47 DEVMETHOD(device_probe, uart_acpi_probe), 48 DEVMETHOD(device_attach, uart_bus_attach), 49 DEVMETHOD(device_detach, uart_bus_detach), 50 { 0, 0 } 51}; 52 53static driver_t uart_acpi_driver = { 54 uart_driver_name, 55 uart_acpi_methods, 56 sizeof(struct uart_softc), 57}; 58 59static struct isa_pnp_id acpi_ns8250_ids[] = { 60 {0x0005d041, "Standard PC COM port"}, /* PNP0500 */ 61 {0x0105d041, "16550A-compatible COM port"}, /* PNP0501 */ 62 {0} 63}; 64 65static int 66uart_acpi_probe(device_t dev) 67{ 68 struct uart_softc *sc; 69 device_t parent; 70 71 parent = device_get_parent(dev); 72 sc = device_get_softc(dev); 73 74 if (!ISA_PNP_PROBE(parent, dev, acpi_ns8250_ids)) { 75 sc->sc_class = &uart_ns8250_class; 76 return (uart_bus_probe(dev, 0, 0, 0)); 77 } 78 79 /* Add checks for non-ns8250 IDs here. */ 80 return (ENXIO); 81} 82 83DRIVER_MODULE(uart, acpi, uart_acpi_driver, uart_devclass, 0, 0); 84