/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright 2008 by Nathan Whitehorn. 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*14* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR15* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES16* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.17* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,18* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,19* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;20* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED21* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,22* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY23* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF24* SUCH DAMAGE.25*26*/2728#include <sys/param.h>29#include <sys/systm.h>30#include <sys/module.h>31#include <sys/bus.h>32#include <sys/conf.h>33#include <sys/kernel.h>3435#include <dev/ofw/ofw_bus.h>36#include <dev/ofw/openfirm.h>3738#include <machine/bus.h>3940#include <vm/vm.h>41#include <vm/pmap.h>4243#include <sys/rman.h>4445/*46* Mambo interface47*/48static int mambobus_probe(device_t);49static int mambobus_attach(device_t);5051static device_method_t mambobus_methods[] = {52/* Device interface */53DEVMETHOD(device_probe, mambobus_probe),54DEVMETHOD(device_attach, mambobus_attach),5556/* Bus interface */57DEVMETHOD(bus_add_child, bus_generic_add_child),58DEVMETHOD(bus_read_ivar, bus_generic_read_ivar),59DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),60DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),61DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),62DEVMETHOD(bus_release_resource, bus_generic_release_resource),63DEVMETHOD(bus_activate_resource,bus_generic_activate_resource),6465DEVMETHOD_END66};6768static driver_t mambobus_driver = {69"mambo",70mambobus_methods,71072};7374DRIVER_MODULE(mambo, ofwbus, mambobus_driver, 0, 0);7576static int77mambobus_probe(device_t dev)78{79const char *name = ofw_bus_get_name(dev);8081if (name && !strcmp(name, "mambo")) {82device_set_desc(dev, "Mambo Simulator");83return (0);84}8586return (ENXIO);87}8889static int90mambobus_attach(device_t dev)91{92bus_identify_children(dev);93bus_attach_children(dev);94return (0);95}969798