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