1203845Smarius/*- 2203845Smarius * Copyright (c) 2010 Marius Strobl <marius@FreeBSD.org> 3203845Smarius * All rights reserved. 4203845Smarius * 5203845Smarius * Redistribution and use in source and binary forms, with or without 6203845Smarius * modification, are permitted provided that the following conditions 7203845Smarius * are met: 8203845Smarius * 1. Redistributions of source code must retain the above copyright 9203845Smarius * notice, this list of conditions and the following disclaimer. 10203845Smarius * 2. Redistributions in binary form must reproduce the above copyright 11203845Smarius * notice, this list of conditions and the following disclaimer in the 12203845Smarius * documentation and/or other materials provided with the distribution. 13203845Smarius * 14203845Smarius * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15203845Smarius * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16203845Smarius * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17203845Smarius * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18203845Smarius * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19203845Smarius * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20203845Smarius * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21203845Smarius * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22203845Smarius * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23203845Smarius * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24203845Smarius * SUCH DAMAGE. 25203845Smarius */ 26203845Smarius 27203845Smarius#include <sys/cdefs.h> 28203845Smarius__FBSDID("$FreeBSD$"); 29203845Smarius 30203845Smarius/* 31203845Smarius * Glue allowing devices beneath the scalable shared memory node to be 32203845Smarius * treated like nexus(4) children 33203845Smarius */ 34203845Smarius 35203845Smarius#include <sys/param.h> 36203845Smarius#include <sys/systm.h> 37203845Smarius#include <sys/bus.h> 38203845Smarius#include <sys/kernel.h> 39203845Smarius#include <sys/module.h> 40203845Smarius 41203845Smarius#include <dev/ofw/ofw_bus.h> 42203845Smarius 43203845Smarius#include <machine/nexusvar.h> 44203845Smarius 45203845Smariusstatic device_probe_t ssm_probe; 46203845Smarius 47203845Smariusstatic device_method_t ssm_methods[] = { 48203845Smarius /* Device interface */ 49203845Smarius DEVMETHOD(device_probe, ssm_probe), 50203845Smarius 51203845Smarius /* Bus interface */ 52203845Smarius 53203845Smarius /* ofw_bus interface */ 54203845Smarius 55227848Smarius DEVMETHOD_END 56203845Smarius}; 57203845Smarius 58203845Smariusstatic devclass_t ssm_devclass; 59203845Smarius 60203845SmariusDEFINE_CLASS_1(ssm, ssm_driver, ssm_methods, 1 /* no softc */, nexus_driver); 61203845SmariusEARLY_DRIVER_MODULE(ssm, nexus, ssm_driver, ssm_devclass, 0, 0, BUS_PASS_BUS); 62203845SmariusMODULE_DEPEND(ssm, nexus, 1, 1, 1); 63203845SmariusMODULE_VERSION(ssm, 1); 64203845Smarius 65203845Smariusstatic int 66203845Smariusssm_probe(device_t dev) 67203845Smarius{ 68203845Smarius 69203845Smarius if (strcmp(ofw_bus_get_name(dev), "ssm") == 0) { 70203845Smarius device_set_desc(dev, "Scalable Shared Memory"); 71203845Smarius return (BUS_PROBE_DEFAULT); 72203845Smarius } 73203845Smarius return (ENXIO); 74203845Smarius} 75