summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornate <nate@FreeBSD.org>1996-05-07 21:11:13 +0000
committernate <nate@FreeBSD.org>1996-05-07 21:11:13 +0000
commit5d669ae010a40f2ca143f44ee627a82968455ffe (patch)
tree97067dbfe58cf55df0001649aebb9cdffd3ca741
parent24af59741ff08965fecee12150cdcab3a2e1ffa9 (diff)
downloadFreeBSD-src-5d669ae010a40f2ca143f44ee627a82968455ffe.zip
FreeBSD-src-5d669ae010a40f2ca143f44ee627a82968455ffe.tar.gz
Re-wrote psm_poll_status() to use the ioport supplied in the kernel
config file instead of hard-coding it in the driver. No functional differences. This is based on the code Richard Wiwatowski <rjwiwat@adelaide.on.net> sent to the mailing list.
-rw-r--r--sys/i386/isa/psm.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/sys/i386/isa/psm.c b/sys/i386/isa/psm.c
index e820e8c..0f0c42d 100644
--- a/sys/i386/isa/psm.c
+++ b/sys/i386/isa/psm.c
@@ -95,7 +95,7 @@
static int psmprobe(struct isa_device *);
static int psmattach(struct isa_device *);
-static void psm_poll_status(void);
+static void psm_poll_status(int);
static int psmaddr[NPSM]; /* Base I/O port addresses per unit */
@@ -136,23 +136,21 @@ static struct cdevsw psm_cdevsw =
psmioctl, nostop, nullreset, nodevtotty,
psmselect, nommap, NULL, "psm", NULL, -1 };
-#define AUX_PORT 0x60 /* AUX_PORT base (S.Yuen) */
-
static void
psm_write_dev(int ioport, u_char value)
{
- psm_poll_status();
+ psm_poll_status(ioport);
outb(ioport+PSM_CNTRL, 0xd4);
- psm_poll_status();
+ psm_poll_status(ioport);
outb(ioport+PSM_DATA, value);
}
static inline void
psm_command(int ioport, u_char value)
{
- psm_poll_status();
+ psm_poll_status(ioport);
outb(ioport+PSM_CNTRL, 0x60);
- psm_poll_status();
+ psm_poll_status(ioport);
outb(ioport+PSM_DATA, value);
}
@@ -166,10 +164,10 @@ psmprobe(struct isa_device *dvp)
unit=dvp->id_unit;
#ifndef PSM_NO_RESET
psm_write_dev(ioport, PSM_RESET); /* Reset aux device */
- psm_poll_status();
+ psm_poll_status(ioport);
#endif
outb(ioport+PSM_CNTRL, 0xa9);
- psm_poll_status();
+ psm_poll_status(ioport);
outb(ioport+PSM_CNTRL, 0xaa);
c = inb(ioport+PSM_DATA);
if(c & 0x04) {
@@ -193,7 +191,7 @@ psmattach(struct isa_device *dvp)
psmaddr[unit] = ioport;
/* Disable mouse interrupts */
- psm_poll_status();
+ psm_poll_status(ioport);
outb(ioport+PSM_CNTRL, PSM_ENABLE);
#ifdef 0
psm_write(ioport, PSM_SET_RES);
@@ -205,7 +203,7 @@ psmattach(struct isa_device *dvp)
psm_write(ioport, 0x64); /* 100 samples/sec */
psm_write(ioport, PSM_SET_STREAM);
#endif
- psm_poll_status();
+ psm_poll_status(ioport);
outb(ioport+PSM_CNTRL, PSM_DISABLE);
psm_command(ioport, PSM_INT_DISABLE);
@@ -254,7 +252,7 @@ psmopen(dev_t dev, int flag, int fmt, struct proc *p)
/* Enable Bus Mouse interrupts */
psm_write_dev(ioport, PSM_DEV_ENABLE);
- psm_poll_status();
+ psm_poll_status(ioport);
outb(ioport+PSM_CNTRL, PSM_ENABLE);
psm_command(ioport, PSM_INT_ENABLE);
@@ -272,12 +270,13 @@ psmopen(dev_t dev, int flag, int fmt, struct proc *p)
}
static void
-psm_poll_status(void)
+psm_poll_status(int ioport)
{
+ u_char c;
- while(inb(AUX_PORT+PSM_STATUS) & 0x03) {
- if(inb(AUX_PORT+PSM_STATUS) & 0x2 == 0x2)
- inb(AUX_PORT+PSM_DATA);
+ while(c = inb(ioport+PSM_STATUS) & 0x03) {
+ if(c & PSM_OUTPUT_ACK == PSM_OUTPUT_ACK)
+ inb(ioport+PSM_DATA);
}
return;
}
@@ -295,7 +294,7 @@ psmclose(dev_t dev, int flag, int fmt, struct proc *p)
/* Disable further mouse interrupts */
psm_command(ioport, PSM_INT_DISABLE);
- psm_poll_status();
+ psm_poll_status(ioport);
outb(ioport+PSM_CNTRL, PSM_DISABLE);
/* Complete the close */
OpenPOWER on IntegriCloud