diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/mac68k/include/viareg.h | 26 | ||||
-rw-r--r-- | sys/arch/mac68k/mac68k/via.c | 110 |
2 files changed, 52 insertions, 84 deletions
diff --git a/sys/arch/mac68k/include/viareg.h b/sys/arch/mac68k/include/viareg.h index 80b160112d0..c9bd825960e 100644 --- a/sys/arch/mac68k/include/viareg.h +++ b/sys/arch/mac68k/include/viareg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: viareg.h,v 1.14 2005/01/11 21:07:19 martin Exp $ */ +/* $OpenBSD: viareg.h,v 1.15 2005/02/06 19:51:35 martin Exp $ */ /* $NetBSD: viareg.h,v 1.6 1997/02/28 07:41:41 scottr Exp $ */ /*- @@ -144,6 +144,7 @@ extern volatile unsigned char *Via2Base; /* init in VIA_Initialize */ #define VIA1_addr Via1Base /* at PA 0x50f00000 */ #define VIA2OFF 1 /* VIA2 addr = VIA1_addr * 0x2000 */ #define RBVOFF 0x13 /* RBV addr = VIA1_addr * 0x13000 */ +#define OSSOFF 0xd /* OSS addr = VIA1_addr + 0x1A000 */ #define VIA1 0 extern int VIA2; @@ -159,7 +160,7 @@ extern int VIA2; #define vT1LH 0x0e00 #define vT2C 0x1000 #define vT2CH 0x1200 -#define vSR 0x1400 /* shift register */ +#define vSR 0x1400 /* shift register */ #define vACR 0x1600 /* aux control register */ #define vPCR 0x1800 /* peripheral control register */ #define vIFR 0x1a00 /* interrupt flag register */ @@ -174,15 +175,21 @@ extern int VIA2; #define rSlotInt 0x12 /* Slot interrupt */ /* RBV monitor type flags and masks */ -#define RBVDepthMask 0x07 /* depth in bits */ +#define RBVDepthMask 0x07 /* Depth in bits */ #define RBVMonitorMask 0x38 /* Type numbers */ -#define RBVOff 0x40 /* monitor turn off */ -#define RBVMonIDNone 0x38 /* What RBV actually has for no video */ -#define RBVMonIDOff 0x0 /* What rbv_vidstatus() returns for no video */ -#define RBVMonID15BWP 0x08 /* BW portrait */ -#define RBVMonIDRGB 0x10 /* color monitor */ +#define RBVOff 0x40 /* Monitor turned off */ +#define RBVMonIDBWP 0x08 /* 15 inch BW portrait */ +#define RBVMonIDRGB 0x10 /* 12 inch colorr */ #define RBVMonIDRGB15 0x28 /* 15 inch RGB */ -#define RBVMonIDBW 0x30 /* No internal video */ +#define RBVMonIDStd 0x30 /* 12 inch BW or 13 inch color */ +#define RBVMonIDNone 0x38 /* No monitor connected */ + +/* OSS registers */ +#define OSS_IFR 0x202 +#define OSS_PENDING_IRQ (*(volatile u_short *)(Via2Base + (OSS_IFR))) + +#define OSS_oRCR 0x204 +#define OSS_POWEROFF 0x80 #define via_reg(v, r) (*(Via1Base+(v)*0x2000+(r))) #define via2_reg(r) (*(Via2Base+(r))) @@ -202,7 +209,6 @@ struct via2hand { typedef SLIST_HEAD(, via2hand) via2hand_t; void via_init(void); -int rbv_vidstatus(void); void via_powerdown(void); void via_set_modem(int); void add_nubus_intr(int, int (*)(void *), void *, const char *); diff --git a/sys/arch/mac68k/mac68k/via.c b/sys/arch/mac68k/mac68k/via.c index 5ce7069658b..cfabb18c7f3 100644 --- a/sys/arch/mac68k/mac68k/via.c +++ b/sys/arch/mac68k/mac68k/via.c @@ -1,4 +1,4 @@ -/* $OpenBSD: via.c,v 1.21 2005/01/11 21:07:19 martin Exp $ */ +/* $OpenBSD: via.c,v 1.22 2005/02/06 19:51:35 martin Exp $ */ /* $NetBSD: via.c,v 1.62 1997/09/10 04:38:48 scottr Exp $ */ /*- @@ -36,7 +36,7 @@ */ /* - * This code handles both the VIA and RBV functionality. + * This code handles both the VIA, RBV and OSS functionality. */ #include <sys/param.h> @@ -52,23 +52,24 @@ int mrg_adbintr(void *); int mrg_pmintr(void *); -void profclock(void *); -int rbv_nubus_intr(void *); -static int rbv_slot_ignore(void *); int rtclock_intr(void *); +void profclock(void *); + void via1_intr(struct frame *); +void via2_intr(struct frame *); +void rbv_intr(struct frame *); +void oss_intr(struct frame *); int via2_nubus_intr(void *); +int rbv_nubus_intr(void *); -int VIA2 = 1; /* default for II, IIx, IIcx, SE/30. */ +static int slot_ignore(void *); -struct intrhand via1intrs[7]; -via2hand_t via2intrs[7]; +void (*real_via2_intr)(struct frame *); -void oss_intr(struct frame *); -void rbv_intr(struct frame *); -void via2_intr(struct frame *); +int VIA2 = VIA2OFF; /* default for II, IIx, IIcx, SE/30. */ -void (*real_via2_intr)(struct frame *); +struct intrhand via1intrs[7]; +via2hand_t via2intrs[7]; /* * Nubus slot interrupt routines and parameters for slots 9-15. Note @@ -168,7 +169,7 @@ via_init() nubus_intr.vh_fn = rbv_nubus_intr; via2_register_irq(&nubus_intr, NULL); /* XXX necessary? */ - add_nubus_intr(0, rbv_slot_ignore, NULL, "dummy"); + add_nubus_intr(0, slot_ignore, (void *)0, "dummy"); } } @@ -192,7 +193,8 @@ via1_intr(struct frame *fp) u_int8_t intbits, bitnum; u_int mask; - intbits = via_reg(VIA1, vIFR) & via_reg(VIA1, vIER); + intbits = via_reg(VIA1, vIFR); /* get interrupts pending */ + intbits &= via_reg(VIA1, vIER); /* only care about enabled */ if (intbits == 0) return; @@ -206,14 +208,9 @@ via1_intr(struct frame *fp) intbits &= 0x7f; mask = 1; for (bitnum = 0, ih = via1intrs; ; bitnum++, ih++) { - if ((intbits & mask) != 0 && ih->ih_fn != NULL) { + if ((intbits & mask) != 0 && ih->ih_fn != NULL) if ((*ih->ih_fn)(ih->ih_arg) != 0) ih->ih_count.ec_count++; - } else { -#if 0 - printf("spurious VIA1 interrupt, source %d\n", bitnum); -#endif - } mask <<= 1; if (intbits < mask) break; @@ -229,7 +226,8 @@ via2_intr(struct frame *fp) u_int mask; int handled, rc; - intbits = via2_reg(vIFR) & via2_reg(vIER); + intbits = via2_reg(vIFR); /* get interrupts pending */ + intbits &= via2_reg(vIER); /* only care about enabled */ if (intbits == 0) return; @@ -240,24 +238,19 @@ via2_intr(struct frame *fp) mask = 1; for (bitnum = 0, anchor = via2intrs; ; bitnum++, anchor++) { if ((intbits & mask) != 0) { - handled = 0; - SLIST_FOREACH(v2h, anchor, v2h_link) { - struct intrhand *ih = &v2h->v2h_ih; - rc = (*ih->ih_fn)(ih->ih_arg); - if (rc != 0) { - ih->ih_count.ec_count++; - handled |= rc; - } + handled = 0; + SLIST_FOREACH(v2h, anchor, v2h_link) { + struct intrhand *ih = &v2h->v2h_ih; + rc = (*ih->ih_fn)(ih->ih_arg); + if (rc != 0) { + ih->ih_count.ec_count++; + handled |= rc; } -#if 0 - if (handled == 0) - printf("spurious VIA2 interrupt, source %d\n", - bitnum); -#endif } - mask <<= 1; - if (intbits < mask) - break; + } + mask <<= 1; + if (intbits < mask) + break; } } @@ -270,7 +263,8 @@ rbv_intr(struct frame *fp) u_int mask; int handled, rc; - intbits = (via2_reg(vIFR + rIFR) & via2_reg(vIER + rIER)); + intbits = via2_reg(vIFR + rIFR); + intbits &= via2_reg(vIER + rIER); if (intbits == 0) return; @@ -290,11 +284,6 @@ rbv_intr(struct frame *fp) handled |= rc; } } -#if 0 - if (handled == 0) - printf("spurious VIA2 interrupt, source %d\n", - bitnum); -#endif } mask <<= 1; if (intbits < mask) @@ -367,15 +356,12 @@ oss_intr(struct frame *fp) return; intbits &= 0x7f; - mask =1 ; + mask = 1; for (bitnum = 0, ih = slotintrs; ; bitnum++, ih++) { if (intbits & mask) { if (ih->ih_fn != NULL) { if ((*ih->ih_fn)(ih->ih_arg) != 0) ih->ih_count.ec_count++; - } else { - printf("spurious nubus interrupt, slot %d\n", - bitnum); } via2_reg(rIFR) = mask; } @@ -393,7 +379,7 @@ via2_nubus_intr(void *bitarg) u_int8_t i, intbits, mask; int rv = 0; - via2_reg(vIFR) = 0x80 | V2IF_SLOTINT; + via2_reg(vIFR) = V2IF_SLOTINT; while ((intbits = (~via2_reg(vBufA)) & nubus_intr_mask)) { for (i = 6, ih = &slotintrs[i], mask = 1 << i; mask != 0; i--, ih--, mask >>= 1) { @@ -403,11 +389,6 @@ via2_nubus_intr(void *bitarg) ih->ih_count.ec_count++; rv = 1; } - } else { -#if 0 - printf("spurious nubus interrupt, slot %d\n", - i); -#endif } } } @@ -434,11 +415,6 @@ rbv_nubus_intr(void *bitarg) ih->ih_count.ec_count++; rv = 1; } - } else { -#if 0 - printf("spurious nubus interrupt, slot %d\n", - i); -#endif } } } @@ -448,10 +424,9 @@ rbv_nubus_intr(void *bitarg) } static int -rbv_slot_ignore(void *client_data) +slot_ignore(void *client_data) { - int slot = 0 + 9; - int mask = (1 << (slot - 9)); + int mask = (1 << (int)client_data); if (VIA2 == VIA2OFF) { via2_reg(vDirA) |= mask; @@ -473,19 +448,6 @@ via_powerdown() via2_reg(rBufB) &= ~0x04; } -int -rbv_vidstatus() -{ -/* - int montype; - - montype = via2_reg(rMonitor) & RBVMonitorMask; - if(montype == RBVMonIDNone) - montype = RBVMonIDOff; -*/ - return(0); -} - void via1_register_irq(int irq, int (*irq_func)(void *), void *client_data, const char *name) |