1139735Simp/*- 2135669Scognet * Copyright (c) 2004 Olivier Houchard. All rights reserved. 3135669Scognet * 4135669Scognet * Redistribution and use in source and binary forms, with or without 5135669Scognet * modification, are permitted provided that the following conditions 6135669Scognet * are met: 7135669Scognet * 1. Redistributions of source code must retain the above copyright 8135669Scognet * notice, this list of conditions and the following disclaimer. 9135669Scognet * 2. Redistributions in binary form must reproduce the above copyright 10135669Scognet * notice, this list of conditions and the following disclaimer in the 11135669Scognet * documentation and/or other materials provided with the distribution. 12135669Scognet * 13135669Scognet * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14135669Scognet * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15135669Scognet * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16135669Scognet * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17135669Scognet * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18135669Scognet * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19135669Scognet * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20135669Scognet * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21135669Scognet * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22135669Scognet * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23135669Scognet */ 24135669Scognet 25135669Scognet#include <sys/cdefs.h> 26135669Scognet__FBSDID("$FreeBSD$"); 27135669Scognet 28135669Scognet#include <sys/param.h> 29135669Scognet#include <sys/systm.h> 30135669Scognet#include <sys/bus.h> 31135669Scognet#include <sys/conf.h> 32135669Scognet#include <sys/kernel.h> 33135669Scognet#include <sys/module.h> 34135669Scognet#include <machine/bus.h> 35135669Scognet#include <sys/rman.h> 36135669Scognet#include <machine/resource.h> 37135669Scognet 38135669Scognet#include <dev/pci/pcivar.h> 39135669Scognet 40135669Scognet#include <dev/uart/uart.h> 41135669Scognet#include <dev/uart/uart_bus.h> 42135669Scognet#include <dev/uart/uart_cpu.h> 43135669Scognet 44135669Scognet#include "uart_if.h" 45135669Scognet 46135669Scognetstatic int uart_i80321_probe(device_t dev); 47135669Scognet 48135669Scognetstatic device_method_t uart_i80321_methods[] = { 49135669Scognet /* Device interface */ 50135669Scognet DEVMETHOD(device_probe, uart_i80321_probe), 51135669Scognet DEVMETHOD(device_attach, uart_bus_attach), 52135669Scognet DEVMETHOD(device_detach, uart_bus_detach), 53135669Scognet { 0, 0 } 54135669Scognet}; 55135669Scognet 56135669Scognetstatic driver_t uart_i80321_driver = { 57135669Scognet uart_driver_name, 58135669Scognet uart_i80321_methods, 59135669Scognet sizeof(struct uart_softc), 60135669Scognet}; 61135669Scognet 62135669Scognetextern SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs; 63135669Scognetstatic int 64135669Scognetuart_i80321_probe(device_t dev) 65135669Scognet{ 66135669Scognet struct uart_softc *sc; 67135669Scognet 68135669Scognet sc = device_get_softc(dev); 69135669Scognet sc->sc_sysdev = SLIST_FIRST(&uart_sysdevs); 70138021Scognet sc->sc_class = &uart_ns8250_class; 71135669Scognet bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas)); 72135669Scognet return(uart_bus_probe(dev, 0, 0, 0, 0)); 73135669Scognet} 74135669Scognet 75135669Scognet 76135669ScognetDRIVER_MODULE(uart, obio, uart_i80321_driver, uart_devclass, 0, 0); 77