summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2006-09-27 19:57:02 +0000
committerru <ru@FreeBSD.org>2006-09-27 19:57:02 +0000
commit4ef62e4ca582414062d69e20a1ccdade4a110938 (patch)
treea886251dab8c19f71a5bfd0199ec1d9b327b3513 /sys/dev/uart
parentf6b387ce531fb4ba91958db5aadcb53f89d4ed1b (diff)
downloadFreeBSD-src-4ef62e4ca582414062d69e20a1ccdade4a110938.zip
FreeBSD-src-4ef62e4ca582414062d69e20a1ccdade4a110938.tar.gz
Fix our ioctl(2) implementation when the argument is "int". New
ioctls passing integer arguments should use the _IOWINT() macro. This fixes a lot of ioctl's not working on sparc64, most notable being keyboard/syscons ioctls. Full ABI compatibility is provided, with the bonus of fixing the handling of old ioctls on sparc64. Reviewed by: bde (with contributions) Tested by: emax, marius MFC after: 1 week
Diffstat (limited to 'sys/dev/uart')
-rw-r--r--sys/dev/uart/uart_kbd_sun.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/sys/dev/uart/uart_kbd_sun.c b/sys/dev/uart/uart_kbd_sun.c
index 02db9c6..81dde39 100644
--- a/sys/dev/uart/uart_kbd_sun.c
+++ b/sys/dev/uart/uart_kbd_sun.c
@@ -27,6 +27,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_compat.h"
#include "opt_kbd.h"
#include <sys/param.h>
@@ -425,6 +426,9 @@ sunkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data)
{
struct sunkbd_softc *sc;
int error;
+#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5)
+ int ival;
+#endif
sc = (struct sunkbd_softc *)kbd;
error = 0;
@@ -432,6 +436,12 @@ sunkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data)
case KDGKBMODE:
*(int *)data = sc->sc_mode;
break;
+#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5)
+ case _IO('K', 7):
+ ival = IOCPARM_IVAL(data);
+ data = (caddr_t)&ival;
+ /* FALLTHROUGH */
+#endif
case KDSKBMODE:
switch (*(int *)data) {
case K_XLATE:
@@ -456,6 +466,12 @@ sunkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data)
case KDGETLED:
*(int *)data = KBD_LED_VAL(kbd);
break;
+#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5)
+ case _IO('K', 66):
+ ival = IOCPARM_IVAL(data);
+ data = (caddr_t)&ival;
+ /* FALLTHROUGH */
+#endif
case KDSETLED:
if (*(int *)data & ~LOCK_MASK) {
error = EINVAL;
@@ -478,6 +494,12 @@ sunkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data)
case KDGKBSTATE:
*(int *)data = sc->sc_state & LOCK_MASK;
break;
+#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5)
+ case _IO('K', 20):
+ ival = IOCPARM_IVAL(data);
+ data = (caddr_t)&ival;
+ /* FALLTHROUGH */
+#endif
case KDSKBSTATE:
if (*(int *)data & ~LOCK_MASK) {
error = EINVAL;
@@ -485,7 +507,8 @@ sunkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data)
}
sc->sc_state &= ~LOCK_MASK;
sc->sc_state |= *(int *)data;
- break;
+ /* set LEDs and quit */
+ return (sunkbd_ioctl(kbd, KDSETLED, data));
case KDSETREPEAT:
case KDSETRAD:
break;
OpenPOWER on IntegriCloud