diff options
author | Henric Jungheim <henric@cvs.openbsd.org> | 2003-02-17 01:29:22 +0000 |
---|---|---|
committer | Henric Jungheim <henric@cvs.openbsd.org> | 2003-02-17 01:29:22 +0000 |
commit | ecebaec0fd1a08a0975b8f756936722a40ae03a6 (patch) | |
tree | 59277d25c05e37b02700a112ccaf0a5859342f3b /sys/arch/sparc64/dev/com_ebus.c | |
parent | 914c2239132eb3f27af97793d1c7534d2e08045d (diff) |
Add support for the Sun Enterprise 450
Reduce the size of a GENERIC kernel by ~190k
Remove the nasty pointer/bus_space_handle_t casts
Adds debug bus_space code including the ability to trace
bus operations (it actually works now).
The following rules are now followed (and verfified by the debug
code):
1. A "bus_space_handle_t" may only be used with the
"bus_space_tag_t" that created it.
2. Only "bus_space_map()" may create "bus_space_handle_t"s.
3. A "bus_space_handle_t" may not be modified after it has
been created (other than being destroyed by "bus_space_unmap()").
Thanks to help from mcbride, marc, jason, drahn, to anyone that might
have slipped my mind at the moment.
ok jason@, deraadt@
Diffstat (limited to 'sys/arch/sparc64/dev/com_ebus.c')
-rw-r--r-- | sys/arch/sparc64/dev/com_ebus.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/sys/arch/sparc64/dev/com_ebus.c b/sys/arch/sparc64/dev/com_ebus.c index 7b5b2ca7c02..1afdc6553c8 100644 --- a/sys/arch/sparc64/dev/com_ebus.c +++ b/sys/arch/sparc64/dev/com_ebus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com_ebus.c,v 1.7 2002/06/04 19:26:49 jason Exp $ */ +/* $OpenBSD: com_ebus.c,v 1.8 2003/02/17 01:29:20 henric Exp $ */ /* $NetBSD: com_ebus.c,v 1.6 2001/07/24 19:27:10 eeh Exp $ */ /* @@ -106,10 +106,9 @@ com_ebus_attach(parent, self, aux) struct ebus_attach_args *ea = aux; int i, com_is_input, com_is_output; - sc->sc_iot = ea->ea_bustag; sc->sc_iobase = EBUS_PADDR_FROM_REG(&ea->ea_regs[0]); /* - * Addresses that shoud be supplied by the prom: + * Addresses that should be supplied by the prom: * - normal com registers * - ns873xx configuration registers * - DMA space @@ -119,22 +118,31 @@ com_ebus_attach(parent, self, aux) * * Use the prom address if there. */ - if (ea->ea_nvaddrs) - sc->sc_ioh = (bus_space_handle_t)ea->ea_vaddrs[0]; - else if (ebus_bus_map(sc->sc_iot, 0, - EBUS_PADDR_FROM_REG(&ea->ea_regs[0]), - ea->ea_regs[0].size, - BUS_SPACE_MAP_LINEAR, - 0, &sc->sc_ioh) != 0) { + if (ea->ea_nvaddrs) { + if (bus_space_map(ea->ea_memtag, ea->ea_vaddrs[0], 0, + BUS_SPACE_MAP_PROMADDRESS, &sc->sc_ioh) == 0) { + printf(": can't map register space\n"); + return; + } + sc->sc_iot = ea->ea_memtag; + } else if (ebus_bus_map(ea->ea_memtag, 0, + EBUS_PADDR_FROM_REG(&ea->ea_regs[0]), + ea->ea_regs[0].size, 0, 0, &sc->sc_ioh) == 0) { + sc->sc_iot = ea->ea_memtag; + } else if (ebus_bus_map(ea->ea_iotag, 0, + EBUS_PADDR_FROM_REG(&ea->ea_regs[0]), + ea->ea_regs[0].size, 0, 0, &sc->sc_ioh) == 0) { + sc->sc_iot = ea->ea_iotag; + } else { printf(": can't map register space\n"); - return; + return; } sc->sc_hwflags = 0; sc->sc_swflags = 0; sc->sc_frequency = BAUD_BASE; for (i = 0; i < ea->ea_nintrs; i++) - bus_intr_establish(ea->ea_bustag, ea->ea_intrs[i], + bus_intr_establish(sc->sc_iot, ea->ea_intrs[i], IPL_TTY, 0, comintr, sc); /* Figure out if we're the console. */ |