diff options
Diffstat (limited to 'sys/sparc64/isa/ofw_isa.c')
-rw-r--r-- | sys/sparc64/isa/ofw_isa.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/sys/sparc64/isa/ofw_isa.c b/sys/sparc64/isa/ofw_isa.c index a87665e..986220d 100644 --- a/sys/sparc64/isa/ofw_isa.c +++ b/sys/sparc64/isa/ofw_isa.c @@ -1,6 +1,6 @@ /* * Copyright (c) 1999, 2000 Matthew R. Green - * Copyright (c) 2001 Thomas Moestl <tmm@FreeBSD.org> + * Copyright (c) 2001, 2003 Thomas Moestl <tmm@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,6 +35,8 @@ * Helper functions which can be used in both ISA and EBus code. */ +#include "opt_ofw_pci.h" + #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> @@ -42,11 +44,14 @@ #include <ofw/openfirm.h> #include <ofw/ofw_pci.h> +#include <machine/bus.h> #include <machine/resource.h> #include <machine/ofw_bus.h> -#include <sparc64/isa/ofw_isa.h> #include <sparc64/pci/ofw_pci.h> +#include <sparc64/isa/ofw_isa.h> + +#include "pcib_if.h" /* XXX: this only supports PCI as parent bus right now. */ int @@ -86,3 +91,27 @@ ofw_isa_map_iorange(struct isa_ranges *range, int nrange, u_long *start, panic("ofw_isa_map_iorange: could not map range %#lx - %#lx", *start, *end); } + +#ifdef OFW_NEWPCI +ofw_pci_intr_t +ofw_isa_route_intr(device_t bridge, phandle_t node, struct ofw_bus_iinfo *ii, + ofw_isa_intr_t intr) +{ + struct isa_regs reg; + u_int8_t maskbuf[sizeof(reg) + sizeof(intr)]; + device_t pbridge; + ofw_isa_intr_t mintr; + + pbridge = device_get_parent(device_get_parent(bridge)); + /* + * If we get a match from using the map, the resulting INO is + * fully specified, so we may not continue to map. + */ + if (!ofw_bus_lookup_imap(node, ii, ®, sizeof(reg), + &intr, sizeof(intr), &mintr, sizeof(mintr), maskbuf)) { + /* Try routing at the parent bridge. */ + mintr = PCIB_ROUTE_INTERRUPT(pbridge, bridge, intr); + } + return (mintr); +} +#endif /* OFW_NEWPCI */ |