xref: /freebsd/sys/dev/cfi/cfi_bus_nexus.c (revision 40a8ac8f62b535d30349faf28cf47106b7041b83)
1 /*-
2  * Copyright (c) 2012 SRI International
3  * Copyright (c) 2009 Roelof Jonkman, Carlson Wireless Inc.
4  * Copyright (c) 2009 Sam Leffler, Errno Consulting
5  * All rights reserved.
6  *
7  * Portions of this software were developed by SRI International and the
8  * University of Cambridge Computer Laboratory under DARPA/AFRL contract
9  * (FA8750-10-C-0237) ("CTSRD"), as part of the DARPA CRASH research
10  * programme.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #include <sys/cdefs.h>
34 __FBSDID("$FreeBSD$");
35 
36 #include <sys/param.h>
37 #include <sys/systm.h>
38 #include <sys/bus.h>
39 #include <sys/conf.h>
40 #include <sys/kernel.h>
41 #include <sys/malloc.h>
42 #include <sys/module.h>
43 #include <sys/rman.h>
44 #include <sys/sysctl.h>
45 
46 #include <machine/bus.h>
47 
48 #include <dev/cfi/cfi_var.h>
49 
50 static int
51 cfi_nexus_probe(device_t dev)
52 {
53 	return (BUS_PROBE_NOWILDCARD);
54 }
55 
56 static int
57 cfi_nexus_attach(device_t dev)
58 {
59 	int error;
60 
61 	error = cfi_probe(dev);
62 	if (error != 0)
63 		return (error);
64 
65 	return cfi_attach(dev);
66 }
67 
68 static device_method_t cfi_nexus_methods[] = {
69 	/* device interface */
70 	DEVMETHOD(device_probe,		cfi_nexus_probe),
71 	DEVMETHOD(device_attach,	cfi_nexus_attach),
72 	DEVMETHOD(device_detach,	cfi_detach),
73 
74 	{0, 0}
75 };
76 
77 static driver_t cfi_nexus_driver = {
78 	cfi_driver_name,
79 	cfi_nexus_methods,
80 	sizeof(struct cfi_softc),
81 };
82 DRIVER_MODULE(cfi, nexus, cfi_nexus_driver, cfi_devclass, 0, 0);
83