summaryrefslogtreecommitdiffstats
path: root/sys/arch/sparc64/dev/comkbd_ebus.c
diff options
context:
space:
mode:
authorhenric <henric@openbsd.org>2003-02-17 01:29:19 +0000
committerhenric <henric@openbsd.org>2003-02-17 01:29:19 +0000
commiteb79e960df2d323f47be3c916d19f2570b9aacad (patch)
treec56e5883e53ec2ca6418a6e570d16e872915ab1c /sys/arch/sparc64/dev/comkbd_ebus.c
parentsync (diff)
downloadwireguard-openbsd-eb79e960df2d323f47be3c916d19f2570b9aacad.tar.xz
wireguard-openbsd-eb79e960df2d323f47be3c916d19f2570b9aacad.zip
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/comkbd_ebus.c')
-rw-r--r--sys/arch/sparc64/dev/comkbd_ebus.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/sys/arch/sparc64/dev/comkbd_ebus.c b/sys/arch/sparc64/dev/comkbd_ebus.c
index 4dd348f2769..68c0535b4a2 100644
--- a/sys/arch/sparc64/dev/comkbd_ebus.c
+++ b/sys/arch/sparc64/dev/comkbd_ebus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: comkbd_ebus.c,v 1.10 2002/12/22 16:13:30 miod Exp $ */
+/* $OpenBSD: comkbd_ebus.c,v 1.11 2003/02/17 01:29:20 henric Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -197,7 +197,7 @@ comkbd_attach(parent, self, aux)
timeout_set(&sc->sc_bellto, comkbd_bellstop, sc);
- sc->sc_iot = ea->ea_bustag;
+ sc->sc_iot = ea->ea_memtag;
sc->sc_rxget = sc->sc_rxput = sc->sc_rxbeg = sc->sc_rxbuf;
sc->sc_rxend = sc->sc_rxbuf + COMK_RX_RING;
@@ -215,34 +215,41 @@ comkbd_attach(parent, self, aux)
return;
}
- sc->sc_ih = bus_intr_establish(ea->ea_bustag,
+ /* Use prom address if available, otherwise map it. */
+ if (ea->ea_nvaddrs && bus_space_map(ea->ea_memtag, ea->ea_vaddrs[0], 0,
+ BUS_SPACE_MAP_PROMADDRESS, &sc->sc_ioh) == 0) {
+ 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;
+ }
+
+ sc->sc_ih = bus_intr_establish(sc->sc_iot,
ea->ea_intrs[0], IPL_TTY, 0, comkbd_intr, sc);
if (sc->sc_ih == NULL) {
printf(": can't get hard intr\n");
return;
}
- /* Use prom address if available, otherwise map it. */
- 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) {
- printf(": can't map register space\n");
- return;
- }
-
if (console) {
comkbd_init(sc);
cn_tab->cn_dev = makedev(77, sc->sc_dv.dv_unit); /* XXX */
cn_tab->cn_pollc = wskbd_cnpollc;
cn_tab->cn_getc = wskbd_cngetc;
if (ISTYPE5(sc->sc_layout)) {
- wskbd_cnattach(&comkbd_consops, sc, &sunkbd5_keymapdata);
+ wskbd_cnattach(&comkbd_consops, sc,
+ &sunkbd5_keymapdata);
} else {
- wskbd_cnattach(&comkbd_consops, sc, &sunkbd_keymapdata);
+ wskbd_cnattach(&comkbd_consops, sc,
+ &sunkbd_keymapdata);
}
sc->sc_ier = IER_ETXRDY | IER_ERXRDY;
COM_WRITE(sc, com_ier, sc->sc_ier);