central.c (154870) | central.c (167308) |
---|---|
1/*- 2 * Copyright (c) 2003 Jake Burkholder. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2003 Jake Burkholder. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/sparc64/central/central.c 154870 2006-01-26 21:14:32Z marius $"); | 28__FBSDID("$FreeBSD: head/sys/sparc64/central/central.c 167308 2007-03-07 21:13:51Z marius $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/bus.h> 33#include <sys/kernel.h> 34#include <sys/malloc.h> 35#include <sys/module.h> 36 37#include <dev/ofw/ofw_bus.h> 38#include <dev/ofw/ofw_bus_subr.h> 39#include <dev/ofw/openfirm.h> 40 41#include <machine/bus.h> | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/bus.h> 33#include <sys/kernel.h> 34#include <sys/malloc.h> 35#include <sys/module.h> 36 37#include <dev/ofw/ofw_bus.h> 38#include <dev/ofw/ofw_bus_subr.h> 39#include <dev/ofw/openfirm.h> 40 41#include <machine/bus.h> |
42#include <machine/nexusvar.h> 43#include <machine/ofw_upa.h> | |
44#include <machine/resource.h> 45 46#include <sys/rman.h> 47 48#include <sparc64/sbus/ofw_sbus.h> 49 50struct central_devinfo { 51 struct ofw_bus_devinfo cdi_obdinfo; --- 11 unchanged lines hidden (view full) --- 63static bus_probe_nomatch_t central_probe_nomatch; 64static bus_alloc_resource_t central_alloc_resource; 65static bus_get_resource_list_t central_get_resource_list; 66static ofw_bus_get_devinfo_t central_get_devinfo; 67 68static int central_print_res(struct central_devinfo *); 69 70static device_method_t central_methods[] = { | 42#include <machine/resource.h> 43 44#include <sys/rman.h> 45 46#include <sparc64/sbus/ofw_sbus.h> 47 48struct central_devinfo { 49 struct ofw_bus_devinfo cdi_obdinfo; --- 11 unchanged lines hidden (view full) --- 61static bus_probe_nomatch_t central_probe_nomatch; 62static bus_alloc_resource_t central_alloc_resource; 63static bus_get_resource_list_t central_get_resource_list; 64static ofw_bus_get_devinfo_t central_get_devinfo; 65 66static int central_print_res(struct central_devinfo *); 67 68static device_method_t central_methods[] = { |
71 /* Device interface. */ | 69 /* Device interface */ |
72 DEVMETHOD(device_probe, central_probe), 73 DEVMETHOD(device_attach, central_attach), 74 DEVMETHOD(device_shutdown, bus_generic_shutdown), 75 DEVMETHOD(device_suspend, bus_generic_suspend), 76 DEVMETHOD(device_resume, bus_generic_resume), 77 | 70 DEVMETHOD(device_probe, central_probe), 71 DEVMETHOD(device_attach, central_attach), 72 DEVMETHOD(device_shutdown, bus_generic_shutdown), 73 DEVMETHOD(device_suspend, bus_generic_suspend), 74 DEVMETHOD(device_resume, bus_generic_resume), 75 |
78 /* Bus interface. */ | 76 /* Bus interface */ |
79 DEVMETHOD(bus_print_child, central_print_child), 80 DEVMETHOD(bus_probe_nomatch, central_probe_nomatch), 81 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), 82 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), 83 DEVMETHOD(bus_alloc_resource, central_alloc_resource), 84 DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), 85 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), 86 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), --- 20 unchanged lines hidden (view full) --- 107static devclass_t central_devclass; 108 109DRIVER_MODULE(central, nexus, central_driver, central_devclass, 0, 0); 110 111static int 112central_probe(device_t dev) 113{ 114 | 77 DEVMETHOD(bus_print_child, central_print_child), 78 DEVMETHOD(bus_probe_nomatch, central_probe_nomatch), 79 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), 80 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), 81 DEVMETHOD(bus_alloc_resource, central_alloc_resource), 82 DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), 83 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), 84 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), --- 20 unchanged lines hidden (view full) --- 105static devclass_t central_devclass; 106 107DRIVER_MODULE(central, nexus, central_driver, central_devclass, 0, 0); 108 109static int 110central_probe(device_t dev) 111{ 112 |
115 if (strcmp(nexus_get_name(dev), "central") == 0) { | 113 if (strcmp(ofw_bus_get_name(dev), "central") == 0) { |
116 device_set_desc(dev, "central"); 117 return (0); 118 } 119 return (ENXIO); 120} 121 122static int 123central_attach(device_t dev) 124{ 125 struct central_devinfo *cdi; 126 struct sbus_regs *reg; 127 struct central_softc *sc; 128 phandle_t child; 129 phandle_t node; 130 device_t cdev; 131 int nreg; 132 int i; 133 134 sc = device_get_softc(dev); | 114 device_set_desc(dev, "central"); 115 return (0); 116 } 117 return (ENXIO); 118} 119 120static int 121central_attach(device_t dev) 122{ 123 struct central_devinfo *cdi; 124 struct sbus_regs *reg; 125 struct central_softc *sc; 126 phandle_t child; 127 phandle_t node; 128 device_t cdev; 129 int nreg; 130 int i; 131 132 sc = device_get_softc(dev); |
135 node = nexus_get_node(dev); | 133 node = ofw_bus_get_node(dev); |
136 137 sc->sc_nrange = OF_getprop_alloc(node, "ranges", 138 sizeof(*sc->sc_ranges), (void **)&sc->sc_ranges); 139 if (sc->sc_nrange == -1) { 140 device_printf(dev, "can't get ranges\n"); 141 return (ENXIO); 142 } 143 --- 143 unchanged lines hidden --- | 134 135 sc->sc_nrange = OF_getprop_alloc(node, "ranges", 136 sizeof(*sc->sc_ranges), (void **)&sc->sc_ranges); 137 if (sc->sc_nrange == -1) { 138 device_printf(dev, "can't get ranges\n"); 139 return (ENXIO); 140 } 141 --- 143 unchanged lines hidden --- |