summaryrefslogtreecommitdiff
path: root/i386/i386at/kd.c
diff options
context:
space:
mode:
Diffstat (limited to 'i386/i386at/kd.c')
-rw-r--r--i386/i386at/kd.c181
1 files changed, 72 insertions, 109 deletions
diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c
index b5501873..2bea3c8c 100644
--- a/i386/i386at/kd.c
+++ b/i386/i386at/kd.c
@@ -85,6 +85,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <device/io_req.h>
#include <device/buf.h>
#include <vm/vm_kern.h>
+#include <i386/db_interface.h>
#include <i386/locore.h>
#include <i386/loose_ends.h>
#include <i386/vm_param.h>
@@ -107,20 +108,24 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
struct tty kd_tty;
extern boolean_t rebootflag;
-static void charput(), charmvup(), charmvdown(), charclear(), charsetcursor();
+static void charput(csrpos_t pos, char ch, char chattr);
+static void charmvup(csrpos_t from, csrpos_t to, int count);
+static void charmvdown(csrpos_t from, csrpos_t to, int count);
+static void charclear(csrpos_t to, int count, char chattr);
+static void charsetcursor(csrpos_t newpos);
static void kd_noopreset(void);
/*
* These routines define the interface to the device-specific layer.
* See kdsoft.h for a more complete description of what each routine does.
*/
-void (*kd_dput)() = charput; /* put attributed char */
-void (*kd_dmvup)() = charmvup; /* block move up */
-void (*kd_dmvdown)() = charmvdown; /* block move down */
-void (*kd_dclear)() = charclear; /* block clear */
-void (*kd_dsetcursor)() = charsetcursor;
+void (*kd_dput)(csrpos_t, char, char) = charput; /* put attributed char */
+void (*kd_dmvup)(csrpos_t, csrpos_t, int) = charmvup; /* block move up */
+void (*kd_dmvdown)(csrpos_t, csrpos_t, int) = charmvdown; /* block move down */
+void (*kd_dclear)(csrpos_t, int, char) = charclear; /* block clear */
+void (*kd_dsetcursor)(csrpos_t) = charsetcursor;
/* set cursor position on displayed page */
-void (*kd_dreset)() = kd_noopreset; /* prepare for reboot */
+void (*kd_dreset)(void) = kd_noopreset; /* prepare for reboot */
/*
* Globals used for both character-based controllers and bitmap-based
@@ -342,6 +347,15 @@ short font_byte_width = 0; /* num bytes in 1 scan line of font */
int kd_pollc = 0;
#ifdef DEBUG
+static void
+pause(void)
+{
+ int i;
+
+ for (i = 0; i < 50000; ++i)
+ ;
+}
+
/*
* feep:
*
@@ -351,23 +365,11 @@ int kd_pollc = 0;
void
feep(void)
{
- int i;
-
kd_bellon();
- for (i = 0; i < 50000; ++i)
- ;
+ pause();
kd_belloff(NULL);
}
-void
-pause(void)
-{
- int i;
-
- for (i = 0; i < 50000; ++i)
- ;
-}
-
/*
* Put a debugging character on the screen.
* LOC=0 means put it in the bottom right corner, LOC=1 means put it
@@ -439,26 +441,24 @@ kdopen(
spl_t o_pri;
tp = &kd_tty;
- o_pri = spltty();
- simple_lock(&tp->t_lock);
+ o_pri = simple_lock_irq(&tp->t_lock);
if (!(tp->t_state & (TS_ISOPEN|TS_WOPEN))) {
/* XXX ttychars allocates memory */
- simple_unlock(&tp->t_lock);
+ simple_unlock_nocheck(&tp->t_lock.slock);
ttychars(tp);
- simple_lock(&tp->t_lock);
+ simple_lock_nocheck(&tp->t_lock.slock);
/*
* Special support for boot-time rc scripts, which don't
* stty the console.
*/
tp->t_oproc = kdstart;
tp->t_stop = kdstop;
- tp->t_ospeed = tp->t_ispeed = B9600;
- tp->t_flags = ODDP|EVENP|ECHO|CRMOD|XTABS;
+ tp->t_ospeed = tp->t_ispeed = B115200;
+ tp->t_flags = ODDP|EVENP|ECHO|CRMOD|XTABS|LITOUT;
kdinit();
}
tp->t_state |= TS_CARR_ON;
- simple_unlock(&tp->t_lock);
- splx(o_pri);
+ simple_unlock_irq(o_pri, &tp->t_lock);
return (char_open(dev, tp, flag, ior));
}
@@ -476,19 +476,16 @@ kdopen(
*/
/*ARGSUSED*/
void
-kdclose(dev, flag)
-dev_t dev;
-int flag;
+kdclose(dev_t dev, int flag)
{
struct tty *tp;
tp = &kd_tty;
{
- spl_t s = spltty();
- simple_lock(&tp->t_lock);
+ spl_t s;
+ s = simple_lock_irq(&tp->t_lock);
ttyclose(tp);
- simple_unlock(&tp->t_lock);
- splx(s);
+ simple_unlock_irq(s, &tp->t_lock);
}
return;
@@ -508,9 +505,7 @@ int flag;
*/
/*ARGSUSED*/
int
-kdread(dev, uio)
-dev_t dev;
-io_req_t uio;
+kdread(dev_t dev, io_req_t uio)
{
struct tty *tp;
@@ -533,9 +528,7 @@ io_req_t uio;
*/
/*ARGSUSED*/
int
-kdwrite(dev, uio)
-dev_t dev;
-io_req_t uio;
+kdwrite(dev_t dev, io_req_t uio)
{
return((*linesw[kd_tty.t_line].l_write)(&kd_tty, uio));
}
@@ -546,10 +539,7 @@ io_req_t uio;
/*ARGSUSED*/
vm_offset_t
-kdmmap(dev, off, prot)
- dev_t dev;
- vm_offset_t off;
- vm_prot_t prot;
+kdmmap(dev_t dev, vm_offset_t off, vm_prot_t prot)
{
if (off >= (128*1024))
return(-1);
@@ -1015,9 +1005,8 @@ kdcheckmagic(Scancode scancode)
* corresponds to the given state.
*/
unsigned int
-kdstate2idx(state, extended)
-unsigned int state; /* bit vector, not a state index */
-boolean_t extended;
+kdstate2idx(unsigned int state, /* bit vector, not a state index */
+ boolean_t extended)
{
int state_idx = NORM_STATE;
@@ -1138,6 +1127,7 @@ kdinit(void)
k_comm |= K_CB_ENBLIRQ; /* enable interrupt */
kd_sendcmd(KC_CMD_WRITE); /* write new ctlr command byte */
kd_senddata(k_comm);
+ unmask_irq(KBD_IRQ);
kd_initialized = TRUE;
#if ENABLE_IMMEDIATE_CONSOLE
@@ -1444,7 +1434,7 @@ kd_parseesc(void)
*/
#define reverse_video_char(a) (((a) & 0x88) | ((((a) >> 4) | ((a) << 4)) & 0x77))
-void
+static void
kd_update_kd_attr(void)
{
kd_attr = kd_color;
@@ -2261,20 +2251,6 @@ kd_getdata(void)
return(inb(K_RDWR));
}
-unsigned char
-kd_cmdreg_read(void)
-{
-int ch=KC_CMD_READ;
-
- while (inb(K_STATUS) & K_IBUF_FUL)
- ;
- outb(K_CMD, ch);
-
- while ((inb(K_STATUS) & K_OBUF_FUL) == 0)
- ;
- return(inb(K_RDWR));
-}
-
void
kd_cmdreg_write(int val)
{
@@ -2479,6 +2455,33 @@ int new_button = 0;
*/
#define SLAMBPW 2 /* bytes per word for "slam" fcns */
+/*
+ * xga_getpos:
+ *
+ * This function returns the current hardware cursor position on the
+ * screen, scaled for compatibility with kd_curpos.
+ *
+ * input : None
+ * output : returns the value of cursor position on screen
+ *
+ */
+static csrpos_t
+xga_getpos(void)
+
+{
+ unsigned char low;
+ unsigned char high;
+ short pos;
+
+ outb(kd_index_reg, C_HIGH);
+ high = inb(kd_io_reg);
+ outb(kd_index_reg, C_LOW);
+ low = inb(kd_io_reg);
+ pos = (0xff&low) + ((unsigned short)high<<8);
+
+ return(ONE_SPACE * (csrpos_t)pos);
+}
+
/*
* kd_xga_init:
@@ -2488,7 +2491,6 @@ int new_button = 0;
void
kd_xga_init(void)
{
- csrpos_t xga_getpos();
unsigned char start, stop;
#if 0
@@ -2577,43 +2579,12 @@ kd_xga_init(void)
/*
- * xga_getpos:
- *
- * This function returns the current hardware cursor position on the
- * screen, scaled for compatibility with kd_curpos.
- *
- * input : None
- * output : returns the value of cursor position on screen
- *
- */
-csrpos_t
-xga_getpos(void)
-
-{
- unsigned char low;
- unsigned char high;
- short pos;
-
- outb(kd_index_reg, C_HIGH);
- high = inb(kd_io_reg);
- outb(kd_index_reg, C_LOW);
- low = inb(kd_io_reg);
- pos = (0xff&low) + ((unsigned short)high<<8);
-
- return(ONE_SPACE * (csrpos_t)pos);
-}
-
-
-/*
* charput:
*
* Put attributed character for EGA/CGA/etc.
*/
static void
-charput(pos, ch, chattr)
-csrpos_t pos; /* where to put it */
-char ch; /* the character */
-char chattr; /* its attribute */
+charput(csrpos_t pos, char ch, char chattr)
{
*(vid_start + pos) = ch;
*(vid_start + pos + 1) = chattr;
@@ -2626,8 +2597,7 @@ char chattr; /* its attribute */
* Set hardware cursor position for EGA/CGA/etc.
*/
static void
-charsetcursor(newpos)
-csrpos_t newpos;
+charsetcursor(csrpos_t newpos)
{
short curpos; /* position, not scaled for attribute byte */
@@ -2647,9 +2617,7 @@ csrpos_t newpos;
* Block move up for EGA/CGA/etc.
*/
static void
-charmvup(from, to, count)
-csrpos_t from, to;
-int count;
+charmvup(csrpos_t from, csrpos_t to, int count)
{
kd_slmscu(vid_start+from, vid_start+to, count);
}
@@ -2661,9 +2629,7 @@ int count;
* Block move down for EGA/CGA/etc.
*/
static void
-charmvdown(from, to, count)
-csrpos_t from, to;
-int count;
+charmvdown(csrpos_t from, csrpos_t to, int count)
{
kd_slmscd(vid_start+from, vid_start+to, count);
}
@@ -2675,10 +2641,7 @@ int count;
* Fast clear for CGA/EGA/etc.
*/
static void
-charclear(to, count, chattr)
-csrpos_t to;
-int count;
-char chattr;
+charclear(csrpos_t to, int count, char chattr)
{
kd_slmwd(vid_start+to, count, ((unsigned short)chattr<<8)+K_SPACE);
}
@@ -2728,7 +2691,7 @@ bmpput(
* bmpcp1char: copy 1 char from one place in the frame buffer to
* another.
*/
-void
+static void
bmpcp1char(
csrpos_t from,
csrpos_t to)