summaryrefslogtreecommitdiffstats
path: root/sys/sparc64/isa/ofw_isa.c
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2004-04-28 13:06:46 +0000
committertmm <tmm@FreeBSD.org>2004-04-28 13:06:46 +0000
commit0405135634ee9cf5c681b70ec4eb28d5585effb8 (patch)
treecc4413b93d0e5bbc9943f6f574c14c608433cea9 /sys/sparc64/isa/ofw_isa.c
parent7dbddb6c208ab82ee48611df655b0f9488754ec5 (diff)
downloadFreeBSD-src-0405135634ee9cf5c681b70ec4eb28d5585effb8.zip
FreeBSD-src-0405135634ee9cf5c681b70ec4eb28d5585effb8.tar.gz
Fix the EBus driver to work with the new PCI code. Unlike other PCI
bridges, the EBus bridge has resource ranges it claims exclusively to map its children into in its BARs. Hence, we need to allocate these completely and manage them for the children, instead of just passing allocations through to the PCI layer as we did before. While being there, split ebus_probe(), which did also contain code normally belonging into the attach method, into ebus_probe() and ebus_attach(), and perform some minor cleanups.
Diffstat (limited to 'sys/sparc64/isa/ofw_isa.c')
-rw-r--r--sys/sparc64/isa/ofw_isa.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/sys/sparc64/isa/ofw_isa.c b/sys/sparc64/isa/ofw_isa.c
index b5e746c..c6cff52 100644
--- a/sys/sparc64/isa/ofw_isa.c
+++ b/sys/sparc64/isa/ofw_isa.c
@@ -53,18 +53,35 @@
#include "pcib_if.h"
+int
+ofw_isa_range_restype(struct isa_ranges *range)
+{
+ int ps = ISA_RANGE_PS(range);
+
+ switch (ps) {
+ case PCI_CS_IO:
+ return (SYS_RES_IOPORT);
+ case PCI_CS_MEM32:
+ return (SYS_RES_MEMORY);
+ default:
+ panic("ofw_isa_range_restype: illegal space %x", ps);
+ }
+
+}
+
/* XXX: this only supports PCI as parent bus right now. */
int
-ofw_isa_map_iorange(struct isa_ranges *range, int nrange, u_long *start,
- u_long *end)
+ofw_isa_range_map(struct isa_ranges *range, int nrange, u_long *start,
+ u_long *end, int *which)
{
+ struct isa_ranges *r;
u_int64_t offs, cstart, cend;
int i;
for (i = 0; i < nrange; i++) {
- cstart = ((u_int64_t)range[i].child_hi << 32) |
- range[i].child_lo;
- cend = cstart + range[i].size;
+ r = &range[i];
+ cstart = ISA_RANGE_CHILD(r);
+ cend = cstart + r->size;
if (*start < cstart || *start > cend)
continue;
if (*end < cstart || *end > cend) {
@@ -72,21 +89,12 @@ ofw_isa_map_iorange(struct isa_ranges *range, int nrange, u_long *start,
"ranges (%#lx not in %#lx - %#lx)", *end, cstart,
cend);
}
- offs = (((u_int64_t)range[i].phys_mid << 32) |
- range[i].phys_lo);
+ offs = ISA_RANGE_PHYS(r);
*start = *start + offs - cstart;
*end = *end + offs - cstart;
- /* Isolate address space and find the right tag */
- switch (ISA_RANGE_PS(&range[i])) {
- case PCI_CS_IO:
- return (SYS_RES_IOPORT);
- case PCI_CS_MEM32:
- return (SYS_RES_MEMORY);
- default:
- panic("ofw_isa_map_iorange: illegal space %x",
- ISA_RANGE_PS(&range[i]));
- break;
- }
+ if (which != NULL)
+ *which = i;
+ return (ofw_isa_range_restype(r));
}
panic("ofw_isa_map_iorange: could not map range %#lx - %#lx",
*start, *end);
OpenPOWER on IntegriCloud