ebus.c (111119) | ebus.c (115417) |
---|---|
1/* 2 * Copyright (c) 1999, 2000 Matthew R. Green 3 * Copyright (c) 2001 Thomas Moestl <tmm@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 14 unchanged lines hidden (view full) --- 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * from: NetBSD: ebus.c,v 1.26 2001/09/10 16:27:53 eeh Exp 30 * | 1/* 2 * Copyright (c) 1999, 2000 Matthew R. Green 3 * Copyright (c) 2001 Thomas Moestl <tmm@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 14 unchanged lines hidden (view full) --- 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * from: NetBSD: ebus.c,v 1.26 2001/09/10 16:27:53 eeh Exp 30 * |
31 * $FreeBSD: head/sys/sparc64/ebus/ebus.c 111119 2003-02-19 05:47:46Z imp $ | 31 * $FreeBSD: head/sys/sparc64/ebus/ebus.c 115417 2003-05-30 20:48:05Z tmm $ |
32 */ 33 34#include "opt_ebus.h" 35 36/* 37 * UltraSPARC 5 and beyond ebus support. 38 * 39 * note that this driver is not complete: --- 67 unchanged lines hidden (view full) --- 107static int ebus_print_child(device_t, device_t); 108static void ebus_probe_nomatch(device_t, device_t); 109static int ebus_read_ivar(device_t, device_t, int, uintptr_t *); 110static int ebus_write_ivar(device_t, device_t, int, uintptr_t); 111static struct resource *ebus_alloc_resource(device_t, device_t, int, int *, 112 u_long, u_long, u_long, u_int); 113static struct resource_list *ebus_get_resource_list(device_t, device_t); 114 | 32 */ 33 34#include "opt_ebus.h" 35 36/* 37 * UltraSPARC 5 and beyond ebus support. 38 * 39 * note that this driver is not complete: --- 67 unchanged lines hidden (view full) --- 107static int ebus_print_child(device_t, device_t); 108static void ebus_probe_nomatch(device_t, device_t); 109static int ebus_read_ivar(device_t, device_t, int, uintptr_t *); 110static int ebus_write_ivar(device_t, device_t, int, uintptr_t); 111static struct resource *ebus_alloc_resource(device_t, device_t, int, int *, 112 u_long, u_long, u_long, u_int); 113static struct resource_list *ebus_get_resource_list(device_t, device_t); 114 |
115static struct ebus_devinfo *ebus_setup_dinfo(struct ebus_softc *, | 115static struct ebus_devinfo *ebus_setup_dinfo(device_t, struct ebus_softc *, |
116 phandle_t, char *); 117static void ebus_destroy_dinfo(struct ebus_devinfo *); 118static int ebus_print_res(struct ebus_devinfo *); 119 120static device_method_t ebus_methods[] = { 121 /* Device interface */ 122 DEVMETHOD(device_probe, ebus_probe), 123 DEVMETHOD(device_attach, bus_generic_attach), --- 71 unchanged lines hidden (view full) --- 195 /* 196 * now attach all our children 197 */ 198 DPRINTF(EDB_CHILD, ("ebus node %08x, searching children...\n", node)); 199 for (node = OF_child(node); node > 0; node = OF_peer(node)) { 200 if ((OF_getprop_alloc(node, "name", 1, (void **)&cname)) == -1) 201 continue; 202 | 116 phandle_t, char *); 117static void ebus_destroy_dinfo(struct ebus_devinfo *); 118static int ebus_print_res(struct ebus_devinfo *); 119 120static device_method_t ebus_methods[] = { 121 /* Device interface */ 122 DEVMETHOD(device_probe, ebus_probe), 123 DEVMETHOD(device_attach, bus_generic_attach), --- 71 unchanged lines hidden (view full) --- 195 /* 196 * now attach all our children 197 */ 198 DPRINTF(EDB_CHILD, ("ebus node %08x, searching children...\n", node)); 199 for (node = OF_child(node); node > 0; node = OF_peer(node)) { 200 if ((OF_getprop_alloc(node, "name", 1, (void **)&cname)) == -1) 201 continue; 202 |
203 if ((edi = ebus_setup_dinfo(sc, node, cname)) == NULL) { | 203 if ((edi = ebus_setup_dinfo(dev, sc, node, cname)) == NULL) { |
204 device_printf(dev, "<%s>: incomplete\n", cname); 205 free(cname, M_OFWPROP); 206 continue; 207 } 208 if ((cdev = device_add_child(dev, NULL, -1)) == NULL) 209 panic("ebus_attach: device_add_child failed"); 210 device_set_ivars(cdev, edi); 211 } --- 146 unchanged lines hidden (view full) --- 358{ 359 struct ebus_devinfo *edi; 360 361 edi = device_get_ivars(child); 362 return (&edi->edi_rl); 363} 364 365static struct ebus_devinfo * | 204 device_printf(dev, "<%s>: incomplete\n", cname); 205 free(cname, M_OFWPROP); 206 continue; 207 } 208 if ((cdev = device_add_child(dev, NULL, -1)) == NULL) 209 panic("ebus_attach: device_add_child failed"); 210 device_set_ivars(cdev, edi); 211 } --- 146 unchanged lines hidden (view full) --- 358{ 359 struct ebus_devinfo *edi; 360 361 edi = device_get_ivars(child); 362 return (&edi->edi_rl); 363} 364 365static struct ebus_devinfo * |
366ebus_setup_dinfo(struct ebus_softc *sc, phandle_t node, char *name) | 366ebus_setup_dinfo(device_t dev, struct ebus_softc *sc, phandle_t node, 367 char *name) |
367{ 368 struct ebus_devinfo *edi; 369 struct isa_regs *reg; 370 u_int32_t *intrs, intr; 371 u_int64_t start; 372 int nreg, nintr, i; 373 374 edi = malloc(sizeof(*edi), M_DEVBUF, M_ZERO | M_WAITOK); --- 18 unchanged lines hidden (view full) --- 393 */ 394 resource_list_add(&edi->edi_rl, SYS_RES_IOPORT, i, 395 start, start + reg[i].size - 1, reg[i].size); 396 } 397 398 nintr = OF_getprop_alloc(node, "interrupts", sizeof(*intrs), 399 (void **)&intrs); 400 for (i = 0; i < nintr; i++) { | 368{ 369 struct ebus_devinfo *edi; 370 struct isa_regs *reg; 371 u_int32_t *intrs, intr; 372 u_int64_t start; 373 int nreg, nintr, i; 374 375 edi = malloc(sizeof(*edi), M_DEVBUF, M_ZERO | M_WAITOK); --- 18 unchanged lines hidden (view full) --- 394 */ 395 resource_list_add(&edi->edi_rl, SYS_RES_IOPORT, i, 396 start, start + reg[i].size - 1, reg[i].size); 397 } 398 399 nintr = OF_getprop_alloc(node, "interrupts", sizeof(*intrs), 400 (void **)&intrs); 401 for (i = 0; i < nintr; i++) { |
401 intr = ofw_bus_route_intr(node, intrs[i], ofw_pci_orb_callback); | 402 intr = ofw_bus_route_intr(node, intrs[i], ofw_pci_orb_callback, 403 dev); |
402 if (intr == ORIR_NOTFOUND) { 403 panic("ebus_setup_dinfo: could not map ebus " 404 "interrupt %d", intrs[i]); 405 } 406 resource_list_add(&edi->edi_rl, SYS_RES_IRQ, i, 407 intr, intr, 1); 408 } 409 free(reg, M_OFWPROP); --- 29 unchanged lines hidden --- | 404 if (intr == ORIR_NOTFOUND) { 405 panic("ebus_setup_dinfo: could not map ebus " 406 "interrupt %d", intrs[i]); 407 } 408 resource_list_add(&edi->edi_rl, SYS_RES_IRQ, i, 409 intr, intr, 1); 410 } 411 free(reg, M_OFWPROP); --- 29 unchanged lines hidden --- |