diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-04-15 20:38:12 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-04-15 20:38:12 +0000 |
commit | ea33ab4b0ef2e0a4e072a0a3ada4bcbe9d1eea71 (patch) | |
tree | fe258671e9526fe32bbd4869c1ba2fed1b26b184 | |
parent | a7375318eae82e4d8d486ce09e9f2b43f54e94ed (diff) |
Turn DIO_INHOLE() into a function, returning the next select code to probe at;
and skip function codes 132 to 135, inclusive, on models 362 and 382 - this
is a fake DIO device probably intended to let non-SGC aware (i.e. legacy)
HP-UX lowlevel code be able to ``detect'' a frame buffer.
This change (as well as letting sgc attach) is untested due to the lack of any
3x2 hardware, but shouldn't make things worse.
-rw-r--r-- | sys/arch/hp300/dev/dio.c | 32 | ||||
-rw-r--r-- | sys/arch/hp300/dev/dioreg.h | 8 | ||||
-rw-r--r-- | sys/arch/hp300/dev/diovar.h | 8 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/autoconf.c | 13 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/wscons_machdep.c | 10 |
5 files changed, 51 insertions, 20 deletions
diff --git a/sys/arch/hp300/dev/dio.c b/sys/arch/hp300/dev/dio.c index 7bb76c89d41..308785cd4e9 100644 --- a/sys/arch/hp300/dev/dio.c +++ b/sys/arch/hp300/dev/dio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dio.c,v 1.13 2008/06/26 05:42:10 ray Exp $ */ +/* $OpenBSD: dio.c,v 1.14 2010/04/15 20:38:09 miod Exp $ */ /* $NetBSD: dio.c,v 1.7 1997/05/05 21:00:32 thorpej Exp $ */ /*- @@ -92,15 +92,15 @@ dioattach(parent, self, aux) { struct dio_attach_args da; caddr_t pa, va; - int scode, scmax, didmap, scodesize; + int scode, sctmp, scmax, didmap, scodesize; scmax = DIO_SCMAX(machineid); printf(": "); dmainit(); for (scode = 0; scode < scmax; ) { - if (DIO_INHOLE(scode)) { - scode++; + if ((sctmp = dio_inhole(scode)) != 0) { + scode = sctmp; continue; } @@ -347,3 +347,27 @@ dio_intr_disestablish(struct isr *isr) if (isr->isr_priority == IPL_BIO) dmacomputeipl(); } + +/* + * Return the next select code if the given select code lies within a hole, + * zero otherwise. + */ +int +dio_inhole(int scode) +{ + /* unconditionnaly skip the DIO-II hole */ + if (scode >= 32 && scode < DIOII_SCBASE) + return DIOII_SCBASE; + + /* skip the frame buffer memory on 3x2 systems */ + switch (machineid) { + case HP_362: + case HP_382: + if (scode >= DIOII_SCBASE && scode < DIOII_SCBASE + 4) + return DIOII_SCBASE + 4; + default: + break; + } + + return 0; +} diff --git a/sys/arch/hp300/dev/dioreg.h b/sys/arch/hp300/dev/dioreg.h index 3fbf1127bf7..a612ceaec9c 100644 --- a/sys/arch/hp300/dev/dioreg.h +++ b/sys/arch/hp300/dev/dioreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dioreg.h,v 1.5 2008/06/26 05:42:10 ray Exp $ */ +/* $OpenBSD: dioreg.h,v 1.6 2010/04/15 20:38:09 miod Exp $ */ /* $NetBSD: dioreg.h,v 1.3 1997/01/30 09:18:40 thorpej Exp $ */ /*- @@ -92,12 +92,6 @@ #define DIOII_SCBASE 132 /* - * Macro that returns true if a select code lies within - * the select code `hole'. - */ -#define DIO_INHOLE(scode) ((scode) >= 32 && (scode) < DIOII_SCBASE) - -/* * Macros to determine if device is DIO or DIO-II. */ #define DIO_ISDIO(scode) ((scode) >= 0 && (scode) < 32) diff --git a/sys/arch/hp300/dev/diovar.h b/sys/arch/hp300/dev/diovar.h index e41c5074c58..05d8e0900ef 100644 --- a/sys/arch/hp300/dev/diovar.h +++ b/sys/arch/hp300/dev/diovar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: diovar.h,v 1.7 2008/06/26 05:42:10 ray Exp $ */ +/* $OpenBSD: diovar.h,v 1.8 2010/04/15 20:38:09 miod Exp $ */ /* $NetBSD: diovar.h,v 1.3 1997/05/05 21:01:33 thorpej Exp $ */ /*- @@ -72,4 +72,10 @@ struct dio_devdesc { void *dio_scodetopa(int); void dio_intr_establish(struct isr *, const char *); void dio_intr_disestablish(struct isr *); + +/* + * Return the next select code if the given select code lies within a hole, + * zero otherwise. + */ +int dio_inhole(int); #endif /* _KERNEL */ diff --git a/sys/arch/hp300/hp300/autoconf.c b/sys/arch/hp300/hp300/autoconf.c index c71f5920aa5..c34f4c02e19 100644 --- a/sys/arch/hp300/hp300/autoconf.c +++ b/sys/arch/hp300/hp300/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.47 2009/10/26 20:04:06 miod Exp $ */ +/* $OpenBSD: autoconf.c,v 1.48 2010/04/15 20:38:11 miod Exp $ */ /* $NetBSD: autoconf.c,v 1.45 1999/04/10 17:31:02 kleink Exp $ */ /* @@ -695,7 +695,7 @@ console_scan(func, arg) int (*func)(int, caddr_t, void *); void *arg; { - int size, scode, sctop; + int size, scode, sctop, sctmp; caddr_t pa, va; /* @@ -703,13 +703,16 @@ console_scan(func, arg) * hardware. If there's something there, call (*func)(). */ sctop = DIO_SCMAX(machineid); - for (scode = 0; scode < sctop; ++scode) { + for (scode = 0; scode < sctop; scode++) { /* * Skip over the select code hole and * the internal HP-IB controller. */ - if (DIO_INHOLE(scode) || - ((scode == 7) && internalhpib)) + if ((sctmp = dio_inhole(scode)) != 0) { + scode = sctmp - 1; + continue; + } + if (scode == 7 && internalhpib) continue; /* Map current PA. */ diff --git a/sys/arch/hp300/hp300/wscons_machdep.c b/sys/arch/hp300/hp300/wscons_machdep.c index 3a7d1d3856f..5b4617e61ef 100644 --- a/sys/arch/hp300/hp300/wscons_machdep.c +++ b/sys/arch/hp300/hp300/wscons_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wscons_machdep.c,v 1.9 2008/01/23 16:37:56 jsing Exp $ */ +/* $OpenBSD: wscons_machdep.c,v 1.10 2010/04/15 20:38:11 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat @@ -174,7 +174,7 @@ wscnprobe(struct consdev *cp) vaddr_t va; #if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 || NTVRX > 0 paddr_t pa; - u_int scode, sctop; + u_int scode, sctop, sctmp; struct diofbreg *fbr; #endif @@ -211,7 +211,11 @@ wscnprobe(struct consdev *cp) * Skip over the select code hole and the internal * HP-IB controller. */ - if (DIO_INHOLE(scode) || (scode == 7 && internalhpib)) + if ((sctmp = dio_inhole(scode)) != 0) { + scode = sctmp - 1; + continue; + } + if (scode == 7 && internalhpib) continue; /* Map current PA. */ |