From 3ae73ab021de45e46c7a0dd0287407136ad91cbb Mon Sep 17 00:00:00 2001 From: brad Date: Mon, 18 Aug 2008 20:29:37 +0000 Subject: [PATCH] Add sparc_bus_addr function for schizo to allow CardBus to work. ok kettenis@ --- sys/arch/sparc64/dev/schizo.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/sys/arch/sparc64/dev/schizo.c b/sys/arch/sparc64/dev/schizo.c index 77c2d170058..0f4d772a9d9 100644 --- a/sys/arch/sparc64/dev/schizo.c +++ b/sys/arch/sparc64/dev/schizo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: schizo.c,v 1.54 2008/07/07 23:22:27 kettenis Exp $ */ +/* $OpenBSD: schizo.c,v 1.55 2008/08/18 20:29:37 brad Exp $ */ /* * Copyright (c) 2002 Jason L. Wright (jason@thought.net) @@ -93,6 +93,8 @@ int schizo_bus_map(bus_space_tag_t, bus_space_tag_t, bus_addr_t, bus_size_t, int, bus_space_handle_t *); paddr_t schizo_bus_mmap(bus_space_tag_t, bus_space_tag_t, bus_addr_t, off_t, int, int); +bus_addr_t schizo_bus_addr(bus_space_tag_t, bus_space_tag_t, + bus_space_handle_t); void *schizo_intr_establish(bus_space_tag_t, bus_space_tag_t, int, int, int, int (*)(void *), void *, const char *); @@ -567,6 +569,7 @@ schizo_alloc_bus_tag(struct schizo_pbm *pbm, const char *name, int ss, bt->sasi = sasi; bt->sparc_bus_map = schizo_bus_map; bt->sparc_bus_mmap = schizo_bus_mmap; + bt->sparc_bus_addr = schizo_bus_addr; bt->sparc_intr_establish = schizo_intr_establish; return (bt); } @@ -695,6 +698,36 @@ schizo_bus_mmap(bus_space_tag_t t, bus_space_tag_t t0, bus_addr_t paddr, return (-1); } +bus_addr_t +schizo_bus_addr(bus_space_tag_t t, bus_space_tag_t t0, bus_space_handle_t h) +{ + struct schizo_pbm *pbm = t->cookie; + bus_addr_t addr; + int i, ss; + + ss = t->default_type; + + if (t->parent == 0 || t->parent->sparc_bus_addr == 0) { + printf("\nschizo_bus_addr: invalid parent"); + return (-1); + } + + t = t->parent; + + addr = ((*t->sparc_bus_addr)(t, t0, h)); + if (addr == -1) + return (-1); + + for (i = 0; i < pbm->sp_nrange; i++) { + if (((pbm->sp_range[i].cspace >> 24) & 0x03) != ss) + continue; + + return (BUS_ADDR_PADDR(addr) - pbm->sp_range[i].phys_lo); + } + + return (-1); +} + void * schizo_intr_establish(bus_space_tag_t t, bus_space_tag_t t0, int ihandle, int level, int flags, int (*handler)(void *), void *arg, const char *what) -- 2.20.1