cfi_bus_nexus.c revision 265959
1170530Ssam/*- 2178354Ssam * Copyright (c) 2012 SRI International 3170530Ssam * Copyright (c) 2009 Roelof Jonkman, Carlson Wireless Inc. 4170530Ssam * Copyright (c) 2009 Sam Leffler, Errno Consulting 5170530Ssam * All rights reserved. 6170530Ssam * 7170530Ssam * Portions of this software were developed by SRI International and the 8170530Ssam * University of Cambridge Computer Laboratory under DARPA/AFRL contract 9170530Ssam * (FA8750-10-C-0237) ("CTSRD"), as part of the DARPA CRASH research 10170530Ssam * programme. 11170530Ssam * 12170530Ssam * Redistribution and use in source and binary forms, with or without 13170530Ssam * modification, are permitted provided that the following conditions 14170530Ssam * are met: 15170530Ssam * 1. Redistributions of source code must retain the above copyright 16170530Ssam * notice, this list of conditions and the following disclaimer. 17170530Ssam * 2. Redistributions in binary form must reproduce the above copyright 18170530Ssam * notice, this list of conditions and the following disclaimer in the 19170530Ssam * documentation and/or other materials provided with the distribution. 20170530Ssam * 21170530Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22170530Ssam * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23170530Ssam * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24170530Ssam * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25170530Ssam * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26170530Ssam * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27170530Ssam * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28170530Ssam * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29170530Ssam * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30170530Ssam * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31170530Ssam */ 32170530Ssam 33170530Ssam#include <sys/cdefs.h> 34170530Ssam__FBSDID("$FreeBSD: stable/10/sys/dev/cfi/cfi_bus_nexus.c 265959 2014-05-13 17:12:07Z ian $"); 35173273Ssam 36173273Ssam#include <sys/param.h> 37170530Ssam#include <sys/systm.h> 38170530Ssam#include <sys/bus.h> 39170530Ssam#include <sys/conf.h> 40170530Ssam#include <sys/kernel.h> 41184280Ssam#include <sys/malloc.h> 42170530Ssam#include <sys/module.h> 43170530Ssam#include <sys/rman.h> 44170530Ssam#include <sys/sysctl.h> 45170530Ssam 46170530Ssam#include <machine/bus.h> 47173273Ssam 48184280Ssam#include <dev/cfi/cfi_var.h> 49170530Ssam 50170530Ssamstatic int 51178354Ssamcfi_nexus_probe(device_t dev) 52178354Ssam{ 53178354Ssam return (BUS_PROBE_NOWILDCARD); 54170530Ssam} 55170530Ssam 56183245Ssamstatic int 57183245Ssamcfi_nexus_attach(device_t dev) 58170530Ssam{ 59184280Ssam int error; 60184280Ssam 61170530Ssam error = cfi_probe(dev); 62175880Ssam if (error != 0) 63170530Ssam return (error); 64170530Ssam 65170530Ssam return cfi_attach(dev); 66170530Ssam} 67170530Ssam 68170530Ssamstatic device_method_t cfi_nexus_methods[] = { 69170530Ssam /* device interface */ 70170530Ssam DEVMETHOD(device_probe, cfi_nexus_probe), 71170530Ssam DEVMETHOD(device_attach, cfi_nexus_attach), 72173273Ssam DEVMETHOD(device_detach, cfi_detach), 73170530Ssam 74178354Ssam {0, 0} 75178354Ssam}; 76178354Ssam 77178354Ssamstatic driver_t cfi_nexus_driver = { 78178354Ssam cfi_driver_name, 79178354Ssam cfi_nexus_methods, 80178354Ssam sizeof(struct cfi_softc), 81178354Ssam}; 82178354SsamDRIVER_MODULE(cfi, nexus, cfi_nexus_driver, cfi_devclass, 0, 0); 83178354Ssam