Less magic number

For PS/2 - status byte - bit 5:
The bit is '1' if the data on input port 60h came from the AUX port, or '0' if
the data came from the keyboard or from the keyboard controller itself.

KBS_TERR (kbd transmission error) was valid for AT-mode, but not for PS/2-mode.

Comment ? OK ?

-- 
Alexandr Shadchin

Index: i8042reg.h
===================================================================
RCS file: /cvs/src/sys/dev/ic/i8042reg.h,v
retrieving revision 1.8
diff -u -p -r1.8 i8042reg.h
--- i8042reg.h  25 Dec 2013 21:01:01 -0000      1.8
+++ i8042reg.h  4 May 2015 15:24:27 -0000
@@ -7,7 +7,7 @@
 #define         KBS_WARM       0x04    /* kbd input buffer low */
 #define         KBS_OCMD       0x08    /* kbd output buffer has command */
 #define         KBS_NOSEC      0x10    /* kbd security lock not engaged */
-#define         KBS_TERR       0x20    /* kbd transmission error */
+#define         KBS_AUXDATA    0x20    /* kbd data in buffer from aux port */
 #define         KBS_RERR       0x40    /* kbd receive error */
 #define         KBS_PERR       0x80    /* kbd parity error */
 
Index: pckbc.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/pckbc.c,v
retrieving revision 1.47
diff -u -p -r1.47 pckbc.c
--- pckbc.c     31 Mar 2015 02:27:30 -0000      1.47
+++ pckbc.c     4 May 2015 15:24:27 -0000
@@ -153,7 +153,7 @@ pckbc_poll_data1(bus_space_tag_t iot, bu
                        KBD_DELAY;
                        CPU_BUSY_CYCLE();
                        c = bus_space_read_1(iot, ioh_d, 0);
-                       if (checkaux && (stat & 0x20)) { /* aux data */
+                       if (checkaux && (stat & KBS_AUXDATA)) {
                                if (slot != PCKBC_AUX_SLOT) {
                                        DPRINTF("lost aux 0x%x\n", c);
                                        continue;
@@ -998,7 +998,7 @@ pckbcintr_internal(struct pckbc_internal
 
                served = 1;
 
-               slot = (t->t_haveaux && (stat & 0x20)) ?
+               slot = (t->t_haveaux && (stat & KBS_AUXDATA)) ?
                    PCKBC_AUX_SLOT : PCKBC_KBD_SLOT;
                q = t->t_slotdata[slot];
 

  • pckbc Alexandr Shadchin

Reply via email to