diff options
Diffstat (limited to 'i386')
-rw-r--r-- | i386/i386at/autoconf.c | 9 | ||||
-rw-r--r-- | i386/i386at/kd_event.c | 192 | ||||
-rw-r--r-- | i386/i386at/kd_mouse.c | 160 | ||||
-rw-r--r-- | i386/i386at/lpr.c | 110 | ||||
-rw-r--r-- | i386/i386at/rtc.c | 24 |
5 files changed, 1 insertions, 494 deletions
diff --git a/i386/i386at/autoconf.c b/i386/i386at/autoconf.c index 7713dec..d1f2863 100644 --- a/i386/i386at/autoconf.c +++ b/i386/i386at/autoconf.c @@ -25,16 +25,7 @@ */ #include <kern/printf.h> -#ifdef MACH_KERNEL #include <mach/std_types.h> -#else /* MACH_KERNEL */ -#include <cpus.h> -#include <platforms.h> -#include <generic.h> -#include <sys/param.h> -#include <mach/machine.h> -#include <machine/cpu.h> -#endif /* MACH_KERNEL */ #include <i386/pic.h> #include <i386/ipl.h> #include <chips/busses.h> diff --git a/i386/i386at/kd_event.c b/i386/i386at/kd_event.c index 8ea313b..4d2ea00 100644 --- a/i386/i386at/kd_event.c +++ b/i386/i386at/kd_event.c @@ -59,20 +59,9 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <kern/printf.h> #include <string.h> -#ifdef MACH_KERNEL #include <device/ds_routines.h> #include <device/device_types.h> #include <device/io_req.h> -#else /* MACH_KERNEL */ -#include <sys/file.h> -#include <sys/errno.h> -#include <kern/thread.h> -#include <sys/user.h> -#include <sys/proc.h> -#include <sys/kernel.h> -#include <sys/ioctl.h> -#include <sys/tty.h> -#endif /* MACH_KERNEL */ #include <i386/machspl.h> #include <i386/pio.h> #include <i386at/kd.h> @@ -92,24 +81,12 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ kd_event_queue kbd_queue; /* queue of keyboard events */ -#ifdef MACH_KERNEL queue_head_t kbd_read_queue = { &kbd_read_queue, &kbd_read_queue }; -#else /* MACH_KERNEL */ -struct proc *kbd_sel = 0; /* selecting process, if any */ -short kbdpgrp = 0; /* process group leader when dev is open */ - -int kbdflag = 0; -#define KBD_COLL 1 /* select collision */ -#define KBD_ASYNC 2 /* user wants asynch notification */ -#define KBD_NBIO 4 /* user wants non-blocking I/O */ -#endif /* MACH_KERNEL */ void kbd_enqueue(); -#ifdef MACH_KERNEL io_return_t X_kdb_enter_init(); io_return_t X_kdb_exit_init(); -#endif /* MACH_KERNEL */ static boolean_t initialized = FALSE; @@ -147,14 +124,6 @@ kbdopen(dev, flags) splx(o_pri); kbdinit(); -#ifdef MACH_KERNEL -#else /* MACH_KERNEL */ - if (flags & FWRITE) - return(ENODEV); - - if (kbdpgrp == 0) - kbdpgrp = u.u_procp->p_pgrp; -#endif /* MACH_KERNEL */ return(0); } @@ -173,18 +142,11 @@ kbdclose(dev, flags) spl_t s = SPLKD(); kb_mode = KB_ASCII; -#ifdef MACH_KERNEL -#else /* MACH_KERNEL */ - kbdpgrp = 0; - kbdflag = 0; - kbd_sel = 0; -#endif /* MACH_KERNEL */ kdq_reset(&kbd_queue); splx(s); } -#ifdef MACH_KERNEL io_return_t kbdgetstat(dev, flavor, data, count) dev_t dev; int flavor; @@ -234,91 +196,12 @@ io_return_t kbdsetstat(dev, flavor, data, count) return (D_SUCCESS); } -#else /* MACH_KERNEL */ -/* - * kbdioctl - handling for asynch & non-blocking I/O. - */ - -/*ARGSUSED*/ -int -kbdioctl(dev, cmd, data, flag) - dev_t dev; - int cmd; - caddr_t data; - int flag; -{ - spl_t s = SPLKD(); - int err = 0; - - switch (cmd) { - case KDSKBDMODE: - kb_mode = *(int *)data; - /* XXX - what to do about unread events? */ - /* XXX - should check that "data" contains an OK value */ - break; - case KDGKBDTYPE: - *(int *)data = KB_VANILLAKB; - break; - case K_X_KDB_ENTER: - X_kdb_enter_init((struct X_kdb *) data); - break; - case K_X_KDB_EXIT: - X_kdb_exit_init( (struct X_kdb *) data); - break; - case FIONBIO: - if (*(int *)data) - kbdflag |= KBD_NBIO; - else - kbdflag &= ~KBD_NBIO; - break; - case FIOASYNC: - if (*(int *)data) - kbdflag |= KBD_ASYNC; - else - kbdflag &= ~KBD_ASYNC; - break; - default: - err = ENOTTY; - break; - } - - splx(s); - return(err); -} - - -/* - * kbdselect - */ - -/*ARGSUSED*/ -int -kbdselect(dev, rw) -{ - spl_t s = SPLKD(); - - if (!kdq_empty(&kbd_queue)) { - splx(s); - return(1); - } - - if (kbd_sel) - kbdflag |= KBD_COLL; - else - kbd_sel = (struct proc *)current_thread(); - /* eeeyuck */ - - splx(s); - return(0); -} -#endif /* MACH_KERNEL */ /* * kbdread - dequeue and return any queued events. */ -#ifdef MACH_KERNEL boolean_t kbd_read_done(); /* forward */ int @@ -391,44 +274,6 @@ boolean_t kbd_read_done(ior) return (TRUE); } -#else /* MACH_KERNEL */ -/*ARGSUSED*/ -kbdread(dev, uio) - dev_t dev; - struct uio *uio; -{ - int s = SPLKD(); - int err = 0; - kd_event *ev; - int i; - char *cp; - - if (kdq_empty(&kbd_queue)) - if (kbdflag & KBD_NBIO) { - err = EWOULDBLOCK; - goto done; - } else - while (kdq_empty(&kbd_queue)) { - splx(s); - sleep((caddr_t)&kbd_queue, TTIPRI); - s = SPLKD(); - } - - while (!kdq_empty(&kbd_queue) && uio->uio_resid >= sizeof(kd_event)) { - ev = kdq_get(&kbd_queue); - for (cp = (char *)ev, i = 0; i < sizeof(kd_event); - ++i, ++cp) { - err = ureadc(*cp, uio); - if (err) - goto done; - } - } - -done: - splx(s); - return(err); -} -#endif /* MACH_KERNEL */ /* @@ -462,22 +307,11 @@ kbd_enqueue(ev) else kdq_put(&kbd_queue, ev); -#ifdef MACH_KERNEL { register io_req_t ior; while ((ior = (io_req_t)dequeue_head(&kbd_read_queue)) != 0) iodone(ior); } -#else /* MACH_KERNEL */ - if (kbd_sel) { - selwakeup(kbd_sel, kbdflag & KBD_COLL); - kbd_sel = 0; - kbdflag &= ~KBD_COLL; - } - if (kbdflag & KBD_ASYNC) - gsignal(kbdpgrp, SIGIO); - wakeup((caddr_t)&kbd_queue); -#endif /* MACH_KERNEL */ } u_int X_kdb_enter_str[512], X_kdb_exit_str[512]; @@ -538,7 +372,6 @@ register u_int *u_ip, *endp; kdb_in_out(u_ip); } -#ifdef MACH_KERNEL io_return_t X_kdb_enter_init(data, count) u_int *data; @@ -564,28 +397,3 @@ X_kdb_exit_init(data, count) X_kdb_exit_len = count; return D_SUCCESS; } -#else /* MACH_KERNEL */ -void -X_kdb_enter_init(kp) -struct X_kdb *kp; -{ - if (kp->size > sizeof X_kdb_enter_str) - u.u_error = ENOENT; - else if(copyin(kp->ptr, X_kdb_enter_str, kp->size) == EFAULT) - u.u_error = EFAULT; - - X_kdb_enter_len = kp->size>>2; -} - -void -X_kdb_exit_init(kp) -struct X_kdb *kp; -{ - if (kp->size > sizeof X_kdb_exit_str) - u.u_error = ENOENT; - else if(copyin(kp->ptr, X_kdb_exit_str, kp->size) == EFAULT) - u.u_error = EFAULT; - - X_kdb_exit_len = kp->size>>2; -} -#endif /* MACH_KERNEL */ diff --git a/i386/i386at/kd_mouse.c b/i386/i386at/kd_mouse.c index 770a3fe..6e7b68a 100644 --- a/i386/i386at/kd_mouse.c +++ b/i386/i386at/kd_mouse.c @@ -67,21 +67,10 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <mach/boolean.h> #include <sys/types.h> #include <kern/printf.h> -#ifdef MACH_KERNEL #include <device/ds_routines.h> #include <device/device_types.h> #include <device/io_req.h> #include <device/subrs.h> -#else /* MACH_KERNEL */ -#include <sys/file.h> -#include <sys/errno.h> -#include <kern/thread.h> -#include <sys/user.h> -#include <sys/proc.h> -#include <sys/kernel.h> -#include <sys/ioctl.h> -#include <sys/tty.h> -#endif /* MACH_KERNEL */ #include <i386/ipl.h> #include <i386/pic.h> #include <i386/pio.h> @@ -100,20 +89,8 @@ extern struct bus_device *cominfo[]; kd_event_queue mouse_queue; /* queue of mouse events */ boolean_t mouse_in_use = FALSE; -#ifdef MACH_KERNEL queue_head_t mouse_read_queue = { &mouse_read_queue, &mouse_read_queue }; -#else /* MACH_KERNEL */ -struct proc *mouse_sel = 0; /* selecting process, if any */ -short mousepgrp = 0; /* process group leader when dev is open */ -#endif /* MACH_KERNEL */ - -#ifdef MACH_KERNEL -#else /* MACH_KERNEL */ -int mouseflag = 0; -#define MOUSE_COLL 1 /* select collision */ -#define MOUSE_ASYNC 2 /* user wants asynch notification */ -#define MOUSE_NBIO 4 /* user wants non-blocking I/O */ -#endif /* MACH_KERNEL */ + /* * The state of the 3 buttons is encoded in the low-order 3 bits (both @@ -176,20 +153,11 @@ mouseopen(dev, flags) dev_t dev; int flags; { -#ifdef MACH_KERNEL -#else /* MACH_KERNEL */ - if (flags & FWRITE) - return (D_NO_SUCH_DEVICE); -#endif /* MACH_KERNEL */ if (mouse_in_use) return (D_ALREADY_OPEN); mouse_in_use = TRUE; /* locking? */ kdq_reset(&mouse_queue); lastbuttons = MOUSE_ALL_UP; -#ifdef MACH_KERNEL -#else /* MACH_KERNEL */ - mousepgrp = u.u_procp->p_pgrp; -#endif /* MACH_KERNEL */ switch (mouse_type = ((minor(dev) & 0xf8) >> 3)) { case MICROSOFT_MOUSE7: @@ -294,12 +262,6 @@ mouseclose(dev, flags) kdq_reset(&mouse_queue); /* paranoia */ mouse_in_use = FALSE; -#ifdef MACH_KERNEL -#else /* MACH_KERNEL */ - mousepgrp = 0; - mouseflag = 0; - mouse_sel = 0; -#endif /* MACH_KERNEL */ } /*ARGSUSED*/ @@ -335,7 +297,6 @@ kd_mouse_close(dev, mouse_pic) splx(s); } -#ifdef MACH_KERNEL io_return_t mousegetstat(dev, flavor, data, count) dev_t dev; int flavor; @@ -354,75 +315,10 @@ io_return_t mousegetstat(dev, flavor, data, count) return D_SUCCESS; } -#else /* MACH_KERNEL */ -/* - * mouseioctl - handling for asynch & non-blocking I/O. - */ - -/*ARGSUSED*/ -int -mouseioctl(dev, cmd, data, flag) - dev_t dev; - int cmd; - caddr_t data; - int flag; -{ - int s = SPLKD(); - int err = 0; - - switch (cmd) { - case FIONBIO: - if (*(int *)data) - mouseflag |= MOUSE_NBIO; - else - mouseflag &= ~MOUSE_NBIO; - break; - case FIOASYNC: - if (*(int *)data) - mouseflag |= MOUSE_ASYNC; - else - mouseflag &= ~MOUSE_ASYNC; - break; - default: - err = ENOTTY; - break; - } - - splx(s); - return(err); -} - - -/* - * mouseselect - check for pending events, etc. - */ - -/*ARGSUSED*/ -int -mouseselect(dev, rw) -{ - int s = SPLKD(); - - if (!kdq_empty(&mouse_queue)) { - splx(s); - return(1); - } - - if (mouse_sel) - mouseflag |= MOUSE_COLL; - else - mouse_sel = (struct proc *)current_thread(); - /* eeeyuck */ - - splx(s); - return(0); -} -#endif /* MACH_KERNEL */ /* * mouseread - dequeue and return any queued events. */ -#ifdef MACH_KERNEL boolean_t mouse_read_done(); /* forward */ int @@ -495,45 +391,6 @@ boolean_t mouse_read_done(ior) return (TRUE); } -#else /* MACH_KERNEL */ -/*ARGSUSED*/ -int -mouseread(dev, uio) - dev_t dev; - struct uio *uio; -{ - int s = SPLKD(); - int err = 0; - kd_event *ev; - int i; - char *cp; - - if (kdq_empty(&mouse_queue)) - if (mouseflag & MOUSE_NBIO) { - err = EWOULDBLOCK; - goto done; - } else - while (kdq_empty(&mouse_queue)) { - splx(s); - sleep((caddr_t)&mouse_queue, TTIPRI); - s = SPLKD(); - } - - while (!kdq_empty(&mouse_queue) && uio->uio_resid >= sizeof(kd_event)) { - ev = kdq_get(&mouse_queue); - for (cp = (char *)ev, i = 0; i < sizeof(kd_event); - ++i, ++cp) { - err = ureadc(*cp, uio); - if (err) - goto done; - } - } - -done: - splx(s); - return(err); -} -#endif /* MACH_KERNEL */ /* @@ -780,12 +637,8 @@ int kd_mouse_read(void) while (mousebufindex <= mouse_char_index) { mouse_char_wanted = TRUE; -#ifdef MACH_KERNEL assert_wait((event_t) &mousebuf, FALSE); thread_block((void (*)()) 0); -#else /* MACH_KERNEL */ - sleep(&mousebuf, PZERO); -#endif /* MACH_KERNEL */ } ch = mousebuf[mouse_char_index++]; @@ -955,20 +808,9 @@ mouse_enqueue(ev) else kdq_put(&mouse_queue, ev); -#ifdef MACH_KERNEL { register io_req_t ior; while ((ior = (io_req_t)dequeue_head(&mouse_read_queue)) != 0) iodone(ior); } -#else /* MACH_KERNEL */ - if (mouse_sel) { - selwakeup(mouse_sel, mouseflag & MOUSE_COLL); - mouse_sel = 0; - mouseflag &= ~MOUSE_COLL; - } - if (mouseflag & MOUSE_ASYNC) - gsignal(mousepgrp, SIGIO); - wakeup((caddr_t)&mouse_queue); -#endif /* MACH_KERNEL */ } diff --git a/i386/i386at/lpr.c b/i386/i386at/lpr.c index cf76da2..468608c 100644 --- a/i386/i386at/lpr.c +++ b/i386/i386at/lpr.c @@ -30,7 +30,6 @@ #if NLPR > 0 -#ifdef MACH_KERNEL #include <mach/std_types.h> #include <sys/types.h> #include <kern/printf.h> @@ -40,18 +39,6 @@ #include <device/device_types.h> #include <device/tty.h> #include <device/io_req.h> -#else /* MACH_KERNEL */ -#include <sys/param.h> -#include <sys/conf.h> -#include <sys/dir.h> -#include <sys/user.h> -#include <sys/proc.h> -#include <sys/ioctl.h> -#include <sys/tty.h> -#include <sys/systm.h> -#include <sys/uio.h> -#include <sys/file.h> -#endif /* MACH_KERNEL */ #include <i386/ipl.h> #include <i386/pio.h> @@ -68,9 +55,7 @@ int lprprobe(); void lprstop(); void lprintr(), lprstart(); void lprattach(struct bus_device *); -#ifdef MACH_KERNEL int lprgetstat(), lprsetstat(); -#endif /* MACH_KERNEL */ void lprpr_addr(); struct bus_device *lprinfo[NLPR]; /* ??? */ @@ -130,9 +115,7 @@ int lpropen(dev, flag, ior) int dev; int flag; -#ifdef MACH_KERNEL io_req_t ior; -#endif /* MACH_KERNEL */ { int unit = minor(dev); struct bus_device *isai; @@ -142,20 +125,14 @@ u_short addr; if (unit >= NLPR || (isai = lprinfo[unit]) == 0 || isai->alive == 0) return (D_NO_SUCH_DEVICE); tp = &lpr_tty[unit]; -#ifndef MACH_KERNEL - if (tp->t_state & TS_XCLUDE && u.u_uid != 0) - return (D_ALREADY_OPEN); -#endif /* MACH_KERNEL */ addr = (u_short) isai->address; tp->t_dev = dev; tp->t_addr = *(caddr_t *)&addr; tp->t_oproc = lprstart; tp->t_state |= TS_WOPEN; -#ifdef MACH_KERNEL tp->t_stop = lprstop; tp->t_getstat = lprgetstat; tp->t_setstat = lprsetstat; -#endif /* MACH_KERNEL */ if ((tp->t_state & TS_ISOPEN) == 0) ttychars(tp); outb(INTR_ENAB(addr), inb(INTR_ENAB(addr)) | 0x10); @@ -172,9 +149,6 @@ int unit = minor(dev); struct tty *tp = &lpr_tty[unit]; u_short addr = (u_short) lprinfo[unit]->address; -#ifndef MACH_KERNEL - (*linesw[tp->t_line].l_close)(tp); -#endif /* MACH_KERNEL */ ttyclose(tp); if (tp->t_state&TS_HUPCLS || (tp->t_state&TS_ISOPEN)==0) { outb(INTR_ENAB(addr), inb(INTR_ENAB(addr)) & 0x0f); @@ -182,7 +156,6 @@ u_short addr = (u_short) lprinfo[unit]->address; } } -#ifdef MACH_KERNEL int lprread(dev, ior) int dev; @@ -244,43 +217,6 @@ unsigned int count; } return (D_SUCCESS); } -#else /* MACH_KERNEL */ -int lprwrite(dev, uio) - int dev; - struct uio *uio; -{ - struct tty *tp= &lpr_tty[minor(dev)]; - - return ((*linesw[tp->t_line].l_write)(tp, uio)); -} - -int lprioctl(dev, cmd, addr, mode) - int dev; - int cmd; - caddr_t addr; - int mode; -{ - int error; - spl_t s; - int unit = minor(dev); - struct tty *tp = &lpr_tty[unit]; - - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, addr,mode); - if (error >= 0) - return(error); - error = ttioctl(tp, cmd, addr,mode); - if (error >= 0) - return (error); - s = spltty(); - switch (cmd) { - default: - splx(s); - return(ENOTTY); - } - splx(s); - return(0); -} -#endif /* MACH_KERNEL */ void lprintr(unit) int unit; @@ -317,25 +253,12 @@ struct tty *tp; } if (tp->t_outq.c_cc <= TTLOWAT(tp)) { -#ifdef MACH_KERNEL tt_write_wakeup(tp); -#else /* MACH_KERNEL */ - if (tp->t_state & TS_ASLEEP) { - tp->t_state &= ~TS_ASLEEP; - wakeup ((caddr_t)&tp->t_outq); - } - if (tp->t_wsel) { - selwakeup(tp->t_wsel, tp->t_state & TS_WCOLL); - tp->t_wsel = 0; - tp->t_state &= ~TS_WCOLL; - } -#endif /* MACH_KERNEL */ } if (tp->t_outq.c_cc == 0) { splx(s); return; } -#ifdef MACH_KERNEL nch = getc(&tp->t_outq); if ((tp->t_flags & LITOUT) == 0 && (nch & 0200)) { timeout((timer_func_t *)ttrstrt, (char *)tp, (nch & 0x7f) + 6); @@ -346,32 +269,10 @@ struct tty *tp; outb(INTR_ENAB(addr),inb(INTR_ENAB(addr)) | 0x01); outb(INTR_ENAB(addr),inb(INTR_ENAB(addr)) & 0x1e); tp->t_state |= TS_BUSY; -#else /* MACH_KERNEL */ - if (tp->t_flags & (RAW|LITOUT)) - nch = ndqb(&tp->t_outq,0); - else { - nch = ndqb(&tp->t_outq, 0200); - if (nch == 0) { - nch = getc(&tp->t_outq); - timeout(ttrstrt,(caddr_t)tp,(nch&0x7f)+6); - tp->t_state |= TS_TIMEOUT; - splx(s); - return(0); - } - } - if (nch) { - nch=getc(&tp->t_outq); - outb(DATA(addr), nch); - outb(INTR_ENAB(addr),inb(INTR_ENAB(addr)) | 0x01); - outb(INTR_ENAB(addr),inb(INTR_ENAB(addr)) & 0x1e); - tp->t_state |= TS_BUSY; - } -#endif /* MACH_KERNEL */ splx(s); return; } -#ifdef MACH_KERNEL void lprstop(tp, flags) register struct tty *tp; @@ -380,17 +281,6 @@ int flags; if ((tp->t_state & TS_BUSY) && (tp->t_state & TS_TTSTOP) == 0) tp->t_state |= TS_FLUSH; } -#else /* MACH_KERNEL */ -void lprstop(tp, flag) -struct tty *tp; -{ - int s = spltty(); - - if ((tp->t_state&TS_BUSY) && (!(tp->t_state&TS_TTSTOP))) - tp->t_state |= TS_FLUSH; - splx(s); -} -#endif /* MACH_KERNEL */ int lprpr(unit) { diff --git a/i386/i386at/rtc.c b/i386/i386at/rtc.c index 77a83e8..6776801 100644 --- a/i386/i386at/rtc.c +++ b/i386/i386at/rtc.c @@ -138,11 +138,7 @@ readtodc(tp) int i, days = 0; spl_t ospl; -#ifdef MACH_KERNEL ospl = splclock(); -#else /* MACH_KERNEL */ - ospl = spl5(); -#endif /* MACH_KERNEL */ if (rtcget(&rtclk)) { splx(ospl); return(-1); @@ -169,12 +165,6 @@ readtodc(tp) days += yeartoday(i); n += days * 3600 * 24; -#ifdef MACH_KERNEL -#else /* MACH_KERNEL */ - n += tz.tz_minuteswest * 60; - if (tz.tz_dsttime) - n -= 3600; -#endif /* MACH_KERNEL */ *tp = n; @@ -189,24 +179,14 @@ writetodc() int diff, i, j; spl_t ospl; -#ifdef MACH_KERNEL ospl = splclock(); -#else /* MACH_KERNEL */ - ospl = spl5(); -#endif /* MACH_KERNEL */ if (rtcget(&rtclk)) { splx(ospl); return(-1); } splx(ospl); -#ifdef MACH_KERNEL diff = 0; -#else /* MACH_KERNEL */ - diff = tz.tz_minuteswest * 60; - if (tz.tz_dsttime) - diff -= 3600; -#endif /* MACH_KERNEL */ n = (time.tv_sec - diff) % (3600 * 24); /* hrs+mins+secs */ rtclk.rtc_sec = dectohexdec(n%60); n /= 60; @@ -230,11 +210,7 @@ writetodc() rtclk.rtc_dom = dectohexdec(++n); -#ifdef MACH_KERNEL ospl = splclock(); -#else /* MACH_KERNEL */ - ospl = spl5(); -#endif /* MACH_KERNEL */ rtcput(&rtclk); splx(ospl); |