aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/isa/isa.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/i386/isa/isa.c')
-rw-r--r--sys/i386/isa/isa.c90
1 files changed, 64 insertions, 26 deletions
diff --git a/sys/i386/isa/isa.c b/sys/i386/isa/isa.c
index 5b3db026c70c..3dbc748d9d55 100644
--- a/sys/i386/isa/isa.c
+++ b/sys/i386/isa/isa.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
- * $Id: isa.c,v 1.5 1993/10/18 18:45:48 rgrimes Exp $
+ * $Id: isa.c,v 1.14 1994/01/22 21:52:04 rgrimes Exp $
*/
/*
@@ -48,7 +48,8 @@
*/
#include "param.h"
-#include "systm.h"
+#include "systm.h" /* isn't it a joy */
+#include "kernel.h" /* to have three of these */
#include "conf.h"
#include "file.h"
#include "buf.h"
@@ -80,7 +81,7 @@
#define DMA2_MODE (IO_DMA2 + 2*11) /* mode register */
#define DMA2_FFC (IO_DMA2 + 2*12) /* clear first/last FF */
-int config_isadev __P((struct isa_device *, u_int *));
+void config_isadev __P((struct isa_device *, u_int *));
/*
* print a conflict message
@@ -147,6 +148,7 @@ haveseen(dvp, tmpdvp)
status = 1;
}
}
+#ifndef COM_MULTIPORT
/*
* Check for IRQ conflicts.
*/
@@ -157,6 +159,7 @@ haveseen(dvp, tmpdvp)
status = 1;
}
}
+#endif
/*
* Check for DRQ conflicts.
*/
@@ -235,6 +238,11 @@ isa_configure() {
netmask |= ttymask;
ttymask |= netmask;
#endif
+ /* if netmask == 0, then the loopback code can do some really
+ * bad things.
+ */
+ if (netmask == 0)
+ netmask = 0x10000;
/* biomask |= ttymask ; can some tty devices use buffers? */
printf("biomask %x ttymask %x netmask %x\n", biomask, ttymask, netmask);
splnone();
@@ -243,6 +251,7 @@ isa_configure() {
/*
* Configure an ISA device.
*/
+void
config_isadev(isdp, mp)
struct isa_device *isdp;
u_int *mp;
@@ -284,10 +293,17 @@ config_isadev(isdp, mp)
printf(" msize %d", isdp->id_msize);
if (isdp->id_flags)
printf(" flags 0x%x", isdp->id_flags);
- if (isdp->id_iobase < 0x100)
- printf(" on motherboard\n");
- else
- printf(" on isa\n");
+ if (isdp->id_iobase) {
+ if (isdp->id_iobase < 0x100) {
+ printf(" on motherboard\n");
+ } else {
+ if (isdp->id_iobase >= 0x1000) {
+ printf (" on eisa\n");
+ } else {
+ printf (" on isa\n");
+ }
+ }
+ }
(*dp->attach)(isdp);
@@ -313,25 +329,30 @@ config_isadev(isdp, mp)
#define IDTVEC(name) __CONCAT(X,name)
/* default interrupt vector table entries */
-extern IDTVEC(intr0), IDTVEC(intr1), IDTVEC(intr2), IDTVEC(intr3),
+typedef void inthand_t();
+typedef void (*inthand_func_t)();
+extern inthand_t
+ IDTVEC(intr0), IDTVEC(intr1), IDTVEC(intr2), IDTVEC(intr3),
IDTVEC(intr4), IDTVEC(intr5), IDTVEC(intr6), IDTVEC(intr7),
IDTVEC(intr8), IDTVEC(intr9), IDTVEC(intr10), IDTVEC(intr11),
IDTVEC(intr12), IDTVEC(intr13), IDTVEC(intr14), IDTVEC(intr15);
-static *defvec[16] = {
+static inthand_func_t defvec[16] = {
&IDTVEC(intr0), &IDTVEC(intr1), &IDTVEC(intr2), &IDTVEC(intr3),
&IDTVEC(intr4), &IDTVEC(intr5), &IDTVEC(intr6), &IDTVEC(intr7),
&IDTVEC(intr8), &IDTVEC(intr9), &IDTVEC(intr10), &IDTVEC(intr11),
&IDTVEC(intr12), &IDTVEC(intr13), &IDTVEC(intr14), &IDTVEC(intr15) };
/* out of range default interrupt vector gate entry */
-extern IDTVEC(intrdefault);
+extern inthand_t IDTVEC(intrdefault);
/*
* Fill in default interrupt table (in case of spuruious interrupt
* during configuration of kernel, setup interrupt control unit
*/
-isa_defaultirq() {
+void
+isa_defaultirq()
+{
int i;
/* icu vectors */
@@ -498,6 +519,7 @@ void isa_dmadone(int flags, caddr_t addr, int nbytes, int chan)
* Return true if special handling needed.
*/
+int
isa_dmarangecheck(caddr_t va, unsigned length, unsigned chan) {
vm_offset_t phys, priorpage = 0, endva;
u_int dma_pgmsk = (chan & 4) ? ~(128*1024-1) : ~(64*1024-1);
@@ -541,7 +563,7 @@ isa_allocphysmem(caddr_t va, unsigned length, void (*func)()) {
isaphysmemunblock = func;
while (isaphysmemflag & B_BUSY) {
isaphysmemflag |= B_WANTED;
- sleep(&isaphysmemflag, PRIBIO);
+ tsleep((caddr_t)&isaphysmemflag, PRIBIO, "isaphys", 0);
}
isaphysmemflag |= B_BUSY;
@@ -558,7 +580,7 @@ isa_freephysmem(caddr_t va, unsigned length) {
isaphysmemflag &= ~B_BUSY;
if (isaphysmemflag & B_WANTED) {
isaphysmemflag &= B_WANTED;
- wakeup(&isaphysmemflag);
+ wakeup((caddr_t)&isaphysmemflag);
if (isaphysmemunblock)
(*isaphysmemunblock)();
}
@@ -568,7 +590,10 @@ isa_freephysmem(caddr_t va, unsigned length) {
* Handle a NMI, possibly a machine check.
* return true to panic system, false to ignore.
*/
-isa_nmi(cd) {
+int
+isa_nmi(cd)
+ int cd;
+{
log(LOG_CRIT, "\nNMI port 61 %x, port 70 %x\n", inb(0x61), inb(0x70));
return(0);
@@ -577,7 +602,10 @@ isa_nmi(cd) {
/*
* Caught a stray interrupt, notify
*/
-isa_strayintr(d) {
+void
+isa_strayintr(d)
+ int d;
+{
/* DON'T BOTHER FOR NOW! */
/* for some reason, we get bursts of intr #7, even if not enabled! */
@@ -609,9 +637,8 @@ isa_strayintr(d) {
#define CF (1 * TIMER_FREQ)
#define TIMER_FREQ 1193182 /* XXX - should be elsewhere */
-extern int hz; /* XXX - should be elsewhere */
-
-int DELAY(n)
+void
+DELAY(n)
int n;
{
int counter_limit;
@@ -676,7 +703,11 @@ int DELAY(n)
#endif
}
-getit(unit, timer) {
+int
+getit(unit, timer)
+ int unit;
+ int timer;
+{
int high;
int low;
@@ -703,19 +734,23 @@ getit(unit, timer) {
return ((high << 8) | low);
}
-static beeping;
-static
-sysbeepstop(f)
+static int beeping;
+
+static void
+sysbeepstop(f, dummy)
+ caddr_t f;
+ int dummy;
{
/* disable counter 2 */
outb(0x61, inb(0x61) & 0xFC);
if (f)
- timeout(sysbeepstop, 0, f);
+ timeout(sysbeepstop, (caddr_t)0, (int)f);
else
beeping = 0;
}
-void sysbeep(int pitch, int period)
+void
+sysbeep(int pitch, int period)
{
outb(0x61, inb(0x61) | 3); /* enable counter 2 */
@@ -732,14 +767,17 @@ void sysbeep(int pitch, int period)
if (!beeping) {
beeping = period;
- timeout(sysbeepstop, period/2, period);
+ timeout(sysbeepstop, (caddr_t)(period/2), period);
}
}
/*
* Pass command to keyboard controller (8042)
*/
-unsigned kbc_8042cmd(val) {
+unsigned
+kbc_8042cmd(val)
+ int val;
+{
while (inb(KBSTATP)&KBS_IBF);
if (val) outb(KBCMDP, val);