summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1997-12-25 13:18:08 +0000
committerJason Downs <downsj@cvs.openbsd.org>1997-12-25 13:18:08 +0000
commitac2998ea4db9beae89bf098b3162fe33e9e83574 (patch)
treea67c4055249999fced0235b8a3e3ee8dc1790251 /sys
parent02dcadc29f84d5f9484e4e6430f941f794456ee5 (diff)
Use functions for DIAGNOSTIC.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/isa/isa.c75
-rw-r--r--sys/dev/isa/isavar.h8
2 files changed, 81 insertions, 2 deletions
diff --git a/sys/dev/isa/isa.c b/sys/dev/isa/isa.c
index 3d7516f46d7..75b7ac34e9c 100644
--- a/sys/dev/isa/isa.c
+++ b/sys/dev/isa/isa.c
@@ -1,6 +1,38 @@
-/* $OpenBSD: isa.c,v 1.24 1997/12/25 12:06:47 downsj Exp $ */
+/* $OpenBSD: isa.c,v 1.25 1997/12/25 13:18:07 downsj Exp $ */
/* $NetBSD: isa.c,v 1.85 1996/05/14 00:31:04 thorpej Exp $ */
+/*
+ * Copyright (c) 1997, Jason Downs. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Jason Downs for the
+ * OpenBSD system.
+ * 4. Neither the name(s) of the author(s) nor the name OpenBSD
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
/*-
* Copyright (c) 1993, 1994 Charles Hannum. All rights reserved.
*
@@ -185,3 +217,44 @@ isa_intr_typename(type)
panic("isa_intr_typename: invalid type %d", type);
}
}
+
+#ifdef DIAGNOSTIC
+void
+isa_drq_alloc(vsp, drq)
+ void *vsp;
+ int drq;
+{
+ struct isa_softc *sc = vsp;
+
+ if (drq < 0 || drq > 7)
+ panic("isa_drq_alloc: drq %d out of range\n", drq);
+
+ sc->sc_drq |= (1 << drq);
+}
+
+void
+isa_drq_free(vsp, drq)
+ void *vsp;
+ int drq;
+{
+ struct isa_softc *sc = vsp;
+
+ if (drq < 0 || drq > 7)
+ panic("isa_drq_free: drq %d out of range\n", drq);
+
+ sc->sc_drq &= ~(1 << drq);
+}
+
+int
+isa_drq_isfree(vsp, drq)
+ void *vsp;
+ int drq;
+{
+ struct isa_softc *sc = vsp;
+
+ if (drq < 0 || drq > 7)
+ panic("isa_drq_isfree: drq %d out of range\n", drq);
+
+ return (!(sc->sc_drq << drq) & 1);
+}
+#endif /* DIAGNOSTIC */
diff --git a/sys/dev/isa/isavar.h b/sys/dev/isa/isavar.h
index 40123a5a2b7..98e61769981 100644
--- a/sys/dev/isa/isavar.h
+++ b/sys/dev/isa/isavar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: isavar.h,v 1.25 1997/12/25 12:06:49 downsj Exp $ */
+/* $OpenBSD: isavar.h,v 1.26 1997/12/25 13:18:07 downsj Exp $ */
/* $NetBSD: isavar.h,v 1.24 1996/10/21 22:41:11 thorpej Exp $ */
/* $NetBSD: isapnpvar.h,v 1.5.4.2 1997/10/29 00:40:49 thorpej Exp $ */
@@ -289,12 +289,18 @@ struct isa_softc {
/*
* Macros for sc_drq access.
*/
+#ifdef DIAGNOSTIC
+void isa_drq_alloc __P((void *, int));
+void isa_drq_free __P((void *, int));
+int isa_drq_isfree __P((void *, int));
+#else
#define isa_drq_alloc(_sc, _drq) \
(((struct isa_softc *)(_sc))->sc_drq |= (1 << (_drq)))
#define isa_drq_free(_sc, _drq) \
(((struct isa_softc *)(_sc))->sc_drq &= ~(1 << (_drq)))
#define isa_drq_isfree(_sc, _drq) \
!((((struct isa_softc *)(_sc))->sc_drq << (_drq)) & 1)
+#endif /* DIAGNOSTIC */
#define cf_iobase cf_loc[0]
#define cf_iosize cf_loc[1]