ofwbus.c (256969) | ofwbus.c (256994) |
---|---|
1/*- 2 * Copyright 1998 Massachusetts Institute of Technology 3 * Copyright 2001 by Thomas Moestl <tmm@FreeBSD.org>. 4 * Copyright 2006 by Marius Strobl <marius@FreeBSD.org>. 5 * All rights reserved. 6 * 7 * Permission to use, copy, modify, and distribute this software and 8 * its documentation for any purpose and without fee is hereby --- 19 unchanged lines hidden (view full) --- 28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 29 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * from: FreeBSD: src/sys/i386/i386/nexus.c,v 1.43 2001/02/09 33 */ 34 35#include <sys/cdefs.h> | 1/*- 2 * Copyright 1998 Massachusetts Institute of Technology 3 * Copyright 2001 by Thomas Moestl <tmm@FreeBSD.org>. 4 * Copyright 2006 by Marius Strobl <marius@FreeBSD.org>. 5 * All rights reserved. 6 * 7 * Permission to use, copy, modify, and distribute this software and 8 * its documentation for any purpose and without fee is hereby --- 19 unchanged lines hidden (view full) --- 28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 29 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * from: FreeBSD: src/sys/i386/i386/nexus.c,v 1.43 2001/02/09 33 */ 34 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/powerpc/powerpc/nexus.c 256969 2013-10-23 14:06:41Z nwhitehorn $"); | 36__FBSDID("$FreeBSD: head/sys/powerpc/powerpc/nexus.c 256994 2013-10-23 17:24:21Z nwhitehorn $"); |
37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/bus.h> 41#include <sys/kernel.h> 42#include <sys/malloc.h> 43#include <sys/module.h> 44#include <sys/pcpu.h> --- 46 unchanged lines hidden (view full) --- 91static bus_deactivate_resource_t nexus_deactivate_resource; 92static bus_adjust_resource_t nexus_adjust_resource; 93static bus_release_resource_t nexus_release_resource; 94static bus_get_resource_list_t nexus_get_resource_list; 95#ifdef SMP 96static bus_bind_intr_t nexus_bind_intr; 97#endif 98static bus_config_intr_t nexus_config_intr; | 37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/bus.h> 41#include <sys/kernel.h> 42#include <sys/malloc.h> 43#include <sys/module.h> 44#include <sys/pcpu.h> --- 46 unchanged lines hidden (view full) --- 91static bus_deactivate_resource_t nexus_deactivate_resource; 92static bus_adjust_resource_t nexus_adjust_resource; 93static bus_release_resource_t nexus_release_resource; 94static bus_get_resource_list_t nexus_get_resource_list; 95#ifdef SMP 96static bus_bind_intr_t nexus_bind_intr; 97#endif 98static bus_config_intr_t nexus_config_intr; |
99static ofw_bus_map_intr_t nexus_ofw_map_intr; 100static ofw_bus_config_intr_t nexus_ofw_config_intr; |
|
99static ofw_bus_get_devinfo_t nexus_get_devinfo; 100 101static int nexus_inlist(const char *, const char *const *); 102static struct nexus_devinfo * nexus_setup_dinfo(device_t, phandle_t); 103static void nexus_destroy_dinfo(struct nexus_devinfo *); 104static int nexus_print_res(struct nexus_devinfo *); 105 106static device_method_t nexus_methods[] = { --- 29 unchanged lines hidden (view full) --- 136 137 /* ofw_bus interface */ 138 DEVMETHOD(ofw_bus_get_devinfo, nexus_get_devinfo), 139 DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), 140 DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), 141 DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), 142 DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), 143 DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), | 101static ofw_bus_get_devinfo_t nexus_get_devinfo; 102 103static int nexus_inlist(const char *, const char *const *); 104static struct nexus_devinfo * nexus_setup_dinfo(device_t, phandle_t); 105static void nexus_destroy_dinfo(struct nexus_devinfo *); 106static int nexus_print_res(struct nexus_devinfo *); 107 108static device_method_t nexus_methods[] = { --- 29 unchanged lines hidden (view full) --- 138 139 /* ofw_bus interface */ 140 DEVMETHOD(ofw_bus_get_devinfo, nexus_get_devinfo), 141 DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), 142 DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), 143 DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), 144 DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), 145 DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), |
146 DEVMETHOD(ofw_bus_map_intr, nexus_ofw_map_intr), 147 DEVMETHOD(ofw_bus_config_intr, nexus_ofw_config_intr), |
|
144 145 DEVMETHOD_END 146}; 147 148static devclass_t nexus_devclass; 149 150DEFINE_CLASS_0(nexus, nexus_driver, nexus_methods, sizeof(struct nexus_softc)); 151EARLY_DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0, --- 213 unchanged lines hidden (view full) --- 365static int 366nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, 367 enum intr_polarity pol) 368{ 369 370 return (powerpc_config_intr(irq, trig, pol)); 371} 372 | 148 149 DEVMETHOD_END 150}; 151 152static devclass_t nexus_devclass; 153 154DEFINE_CLASS_0(nexus, nexus_driver, nexus_methods, sizeof(struct nexus_softc)); 155EARLY_DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0, --- 213 unchanged lines hidden (view full) --- 369static int 370nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, 371 enum intr_polarity pol) 372{ 373 374 return (powerpc_config_intr(irq, trig, pol)); 375} 376 |
377static int 378nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, int irq) 379{ 380 return (MAP_IRQ(iparent, irq)); 381} 382 383static int 384nexus_ofw_config_intr(device_t dev, device_t child, int irq, int sense) 385{ 386 387 return (bus_generic_config_intr(child, irq, (sense & 1) ? 388 INTR_TRIGGER_LEVEL : INTR_TRIGGER_EDGE, 389 INTR_POLARITY_LOW)); 390} 391 |
|
373static struct resource * 374nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, 375 u_long start, u_long end, u_long count, u_int flags) 376{ 377 struct nexus_softc *sc; 378 struct rman *rm; 379 struct resource *rv; 380 struct resource_list_entry *rle; --- 214 unchanged lines hidden (view full) --- 595 (void **)&intr); 596 if (nintr > 0) { 597 iparent = 0; 598 OF_searchprop(node, "interrupt-parent", &iparent, 599 sizeof(iparent)); 600 OF_searchprop(iparent, "#interrupt-cells", &icells, 601 sizeof(icells)); 602 for (i = 0; i < nintr; i+= icells) { | 392static struct resource * 393nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, 394 u_long start, u_long end, u_long count, u_int flags) 395{ 396 struct nexus_softc *sc; 397 struct rman *rm; 398 struct resource *rv; 399 struct resource_list_entry *rle; --- 214 unchanged lines hidden (view full) --- 614 (void **)&intr); 615 if (nintr > 0) { 616 iparent = 0; 617 OF_searchprop(node, "interrupt-parent", &iparent, 618 sizeof(iparent)); 619 OF_searchprop(iparent, "#interrupt-cells", &icells, 620 sizeof(icells)); 621 for (i = 0; i < nintr; i+= icells) { |
603 intr[i] = MAP_IRQ(iparent, intr[i]); | 622 intr[i] = ofw_bus_map_intr(dev, iparent, intr[i]); |
604 resource_list_add(&ndi->ndi_rl, SYS_RES_IRQ, i, intr[i], 605 intr[i], 1); | 623 resource_list_add(&ndi->ndi_rl, SYS_RES_IRQ, i, intr[i], 624 intr[i], 1); |
606 if (icells > 1) { 607 powerpc_config_intr(intr[i], (intr[i+1] & 1) ? 608 INTR_TRIGGER_LEVEL : INTR_TRIGGER_EDGE, 609 INTR_POLARITY_LOW); 610 } | 625 if (icells > 1) 626 ofw_bus_config_intr(dev, intr[i], intr[i+1]); |
611 } 612 free(intr, M_OFWPROP); 613 } 614 615 return (ndi); 616} 617 618static void --- 21 unchanged lines hidden --- | 627 } 628 free(intr, M_OFWPROP); 629 } 630 631 return (ndi); 632} 633 634static void --- 21 unchanged lines hidden --- |