/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright 2002 by Peter Grehan. All rights reserved.4*5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions7* are met:8* 1. Redistributions of source code must retain the above copyright9* notice, this list of conditions and the following disclaimer.10* 2. Redistributions in binary form must reproduce the above copyright11* notice, this list of conditions and the following disclaimer in the12* documentation and/or other materials provided with the distribution.13* 3. The name of the author may not be used to endorse or promote products14* derived from this software without specific prior written permission.15*16* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR17* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES18* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.19* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,20* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,21* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED23* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,24* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY25* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF26* SUCH DAMAGE.27*/2829/*30* PSIM local bus 1655031*/3233#include <sys/param.h>34#include <sys/systm.h>35#include <sys/bus.h>36#include <sys/conf.h>37#include <sys/kernel.h>38#include <sys/lock.h>39#include <sys/malloc.h>40#include <sys/mutex.h>41#include <sys/module.h>42#include <machine/bus.h>43#include <sys/timepps.h>4445#include <dev/ofw/openfirm.h>46#include <powerpc/psim/iobusvar.h>4748#include <dev/uart/uart.h>49#include <dev/uart/uart_bus.h>5051static int uart_iobus_probe(device_t dev);5253static device_method_t uart_iobus_methods[] = {54/* Device interface */55DEVMETHOD(device_probe, uart_iobus_probe),56DEVMETHOD(device_attach, uart_bus_attach),57DEVMETHOD(device_detach, uart_bus_detach),58{ 0, 0 }59};6061static driver_t uart_iobus_driver = {62uart_driver_name,63uart_iobus_methods,64sizeof(struct uart_softc),65};6667static int68uart_iobus_probe(device_t dev)69{70struct uart_softc *sc;71char *type;7273type = iobus_get_name(dev);74if (strncmp(type, "com", 3) != 0)75return (ENXIO);7677sc = device_get_softc(dev);78sc->sc_class = &uart_ns8250_class;7980device_set_desc(dev, "PSIM serial port");81return (uart_bus_probe(dev, 0, 0, 0, 0, 0, 0));82}8384DRIVER_MODULE(uart, iobus, uart_iobus_driver, 0, 0);858687