summaryrefslogtreecommitdiffstats
path: root/sys/dev/atkbdc/atkbd.c
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2005-06-10 20:56:38 +0000
committermarius <marius@FreeBSD.org>2005-06-10 20:56:38 +0000
commit9afc57a1d6b7a82c8cce67a9b6da734e64da5fef (patch)
tree73faadc85aaf50514c90a2b39f6e6c558347a47d /sys/dev/atkbdc/atkbd.c
parenta23214e059e07a8642c27d57c541ce60479d3d53 (diff)
downloadFreeBSD-src-9afc57a1d6b7a82c8cce67a9b6da734e64da5fef.zip
FreeBSD-src-9afc57a1d6b7a82c8cce67a9b6da734e64da5fef.tar.gz
- Hook up the new locations of the atkbdc(4), atkbd(4) and psm(4) source
files after they were repo-copied to sys/dev/atkbdc. The sources of atkbdc(4) and its children were moved to the new location in preparation for adding an EBus front-end to atkbdc(4) for use on sparc64; i.e. in order to not further scatter them over the whole tree which would have been the result of adding atkbdc_ebus.c in e.g. sys/sparc64/ebus. Another reason for the repo-copies was that some of the sources were misfiled, e.g. sys/isa/atkbd_isa.c wasn't ISA-specific at all but for hanging atkbd(4) off of atkbdc(4) and was renamed to atkbd_atkbdc.c accordingly. Most of sys/isa/psm.c, i.e. expect for its PSMC PNP part, also isn't ISA-specific. - Separate the parts of atkbdc_isa.c which aren't actually ISA-specific but are shareable between different atkbdc(4) bus front-ends into atkbdc_subr.c (repo-copied from atkbdc_isa.c). While here use bus_generic_rl_alloc_resource() and bus_generic_rl_release_resource() respectively in atkbdc_isa.c instead of rolling own versions. - Add sparc64 MD bits to atkbdc(4) and atkbd(4) and an EBus front-end for atkbdc(4). PS/2 controllers and input devices are used on a couple of Sun OEM boards and occur on either the EBus or the ISA bus. Depending on the board it's either the only on-board mean to connect a keyboard and mouse or an alternative to either RS232 or USB devices. - Wrap the PSMC PNP part of psm.c in #ifdef DEV_ISA so it can be compiled without isa(4) (e.g. for EBus-only machines). This ISA-specific part isn't separated into its own source file, yet, as it requires more work than was feasible for 6.0 in order to do it in a clean way. Actually philip@ is working on a rewrite of psm(4) so a more comprehensive clean-up and separation of hardware dependent and independent parts is expected to happen after 6.0. Tested on: i386, sparc64 (AX1105, AXe and AXi boards) Reviewed by: philip
Diffstat (limited to 'sys/dev/atkbdc/atkbd.c')
-rw-r--r--sys/dev/atkbdc/atkbd.c43
1 files changed, 36 insertions, 7 deletions
diff --git a/sys/dev/atkbdc/atkbd.c b/sys/dev/atkbdc/atkbd.c
index 670a8de..eedc469 100644
--- a/sys/dev/atkbdc/atkbd.c
+++ b/sys/dev/atkbdc/atkbd.c
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
+#include <sys/eventhandler.h>
#include <sys/proc.h>
#include <sys/limits.h>
#include <sys/malloc.h>
@@ -51,16 +52,17 @@ __FBSDID("$FreeBSD$");
#include <vm/vm.h>
#include <vm/pmap.h>
#include <vm/vm_param.h>
+
+#include <isa/isareg.h>
#endif /* __i386__ */
#include <sys/kbio.h>
#include <dev/kbd/kbdreg.h>
-#include <dev/kbd/atkbdreg.h>
-#include <dev/kbd/atkbdcreg.h>
-
-#include <isa/isareg.h>
+#include <dev/atkbdc/atkbdreg.h>
+#include <dev/atkbdc/atkbdcreg.h>
static timeout_t atkbd_timeout;
+static void atkbd_shutdown_final(void *v);
int
atkbd_probe_unit(int unit, int ctlr, int irq, int flags)
@@ -119,6 +121,10 @@ atkbd_attach_unit(int unit, keyboard_t **kbd, int ctlr, int irq, int flags)
if (bootverbose)
(*sw->diag)(*kbd, bootverbose);
+
+ EVENTHANDLER_REGISTER(shutdown_final, atkbd_shutdown_final, *kbd,
+ SHUTDOWN_PRI_DEFAULT);
+
return 0;
}
@@ -839,7 +845,7 @@ atkbd_check_char(keyboard_t *kbd)
static int
atkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
{
- /* trasnlate LED_XXX bits into the device specific bits */
+ /* translate LED_XXX bits into the device specific bits */
static u_char ledmap[8] = {
0, 4, 2, 6, 1, 5, 3, 7,
};
@@ -1021,6 +1027,30 @@ atkbd_poll(keyboard_t *kbd, int on)
return 0;
}
+static void
+atkbd_shutdown_final(void *v)
+{
+#ifdef __sparc64__
+ keyboard_t *kbd = v;
+ KBDC kbdc = ((atkbd_state_t *)kbd->kb_data)->kbdc;
+
+ /*
+ * Turn off the translation in preparation for handing the keyboard
+ * over to the OFW as the OBP driver doesn't use translation and
+ * also doesn't disable it itself resulting in a broken keymap at
+ * the boot prompt. Also disable the aux port and the interrupts as
+ * the OBP driver doesn't use them, i.e. polls the keyboard. Not
+ * disabling the interrupts doesn't cause real problems but the
+ * responsiveness is a bit better when they are turned off.
+ */
+ send_kbd_command(kbdc, KBDC_DISABLE_KBD);
+ set_controller_command_byte(kbdc,
+ KBD_AUX_CONTROL_BITS | KBD_KBD_CONTROL_BITS | KBD_TRANSLATION,
+ KBD_DISABLE_AUX_PORT | KBD_DISABLE_KBD_INT | KBD_ENABLE_KBD_PORT);
+ send_kbd_command(kbdc, KBDC_ENABLE_KBD);
+#endif
+}
+
/* local functions */
static int
@@ -1299,11 +1329,10 @@ init_keyboard(KBDC kbdc, int *type, int flags)
}
}
-#ifdef __alpha__
+#if defined(__alpha__) || defined(__sparc64__)
if (send_kbd_command_and_data(
kbdc, KBDC_SET_SCANCODE_SET, 2) != KBD_ACK) {
printf("atkbd: can't set translation.\n");
-
}
c |= KBD_TRANSLATION;
#endif
OpenPOWER on IntegriCloud