summaryrefslogtreecommitdiff
path: root/sys/arch/hp300/dev/maskbits.h
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2005-01-14 22:39:41 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2005-01-14 22:39:41 +0000
commit273b900d6597bdaa55c8f7565ccfcfd87910c84f (patch)
treede2ec91a3754bec3aeefc49cac97832f7dc43bea /sys/arch/hp300/dev/maskbits.h
parent09195bcd50c1ebbc578d97af2b759602c1b64b16 (diff)
Switch OpenBSD/hp300 to wscons, still using on-board ROM fonts for now.
Main features: - MI hil drivers, allowing live plug/unplug of devices, and the keyboard does not need to be at id 1 anymore. - SGC bus support on 4xx models. SGC frame buffers are supported too, but not as console, though you can use them as a regular glass terminal if you run a getty on ttyC0. Currently not compiled-in, awaiting for an sti(4) fix to be commited. - HP-UX compatibility interfaces are removed. grfinfo and hilinfo are removed. X11 support is currently broken by these changes; X.org X11R6 support will be available very soon. Tested on hyperion and 4 different flavours of catseye/topcat/kathmandu; other, older frame buffers (davinci, gatorbox and renaissance) could not been tested but should work; please report any regression.
Diffstat (limited to 'sys/arch/hp300/dev/maskbits.h')
-rw-r--r--sys/arch/hp300/dev/maskbits.h89
1 files changed, 46 insertions, 43 deletions
diff --git a/sys/arch/hp300/dev/maskbits.h b/sys/arch/hp300/dev/maskbits.h
index bf116c92d47..79675fb127f 100644
--- a/sys/arch/hp300/dev/maskbits.h
+++ b/sys/arch/hp300/dev/maskbits.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: maskbits.h,v 1.4 2003/06/02 23:27:45 millert Exp $ */
+/* $OpenBSD: maskbits.h,v 1.5 2005/01/14 22:39:26 miod Exp $ */
/* $NetBSD: maskbits.h,v 1.3 1997/03/31 07:37:28 scottr Exp $ */
/*-
@@ -53,13 +53,15 @@ and the number of whole longwords between the ends.
*/
-#define maskbits(x, w, startmask, endmask, nlw) \
- startmask = starttab[(x)&0x1f]; \
- endmask = endtab[((x)+(w)) & 0x1f]; \
- if (startmask) \
- nlw = (((w) - (32 - ((x)&0x1f))) >> 5); \
- else \
- nlw = (w) >> 5;
+#define maskbits(x, w, startmask, endmask, nlw) \
+do { \
+ startmask = starttab[(x) & 0x1f]; \
+ endmask = endtab[((x) + (w)) & 0x1f]; \
+ if (startmask) \
+ nlw = (((w) - (32 - ((x) & 0x1f))) >> 5); \
+ else \
+ nlw = (w) >> 5; \
+} while (0)
#define FASTGETBITS(psrc, x, w, dst) \
asm ("bfextu %3{%1:%2},%0" \
@@ -70,44 +72,45 @@ and the number of whole longwords between the ends.
: "=o" (*(char *)(pdst)) \
: "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst)))
-#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \
-{ \
- unsigned int _tmpsrc, _tmpdst; \
- FASTGETBITS(pdst, dstbit, width, _tmpdst); \
- FASTGETBITS(psrc, srcbit, width, _tmpsrc); \
- DoRop(_tmpdst, rop, _tmpsrc, _tmpdst); \
- FASTPUTBITS(_tmpdst, dstbit, width, pdst); \
-}
+#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \
+do { \
+ unsigned int _tmpsrc, _tmpdst; \
+ FASTGETBITS(pdst, dstbit, width, _tmpdst); \
+ FASTGETBITS(psrc, srcbit, width, _tmpsrc); \
+ DoRop(_tmpdst, rop, _tmpsrc, _tmpdst); \
+ FASTPUTBITS(_tmpdst, dstbit, width, pdst); \
+} while (0)
#define getandputrop0(psrc, srcbit, width, pdst, rop) \
getandputrop(psrc, srcbit, 0, width, pdst, rop)
-#define getunalignedword(psrc, x, dst) { \
- int _tmp; \
- FASTGETBITS(psrc, x, 32, _tmp); \
- dst = _tmp; \
-}
+#define getunalignedword(psrc, x, dst) \
+do { \
+ int _tmp; \
+ FASTGETBITS(psrc, x, 32, _tmp); \
+ dst = _tmp; \
+} while (0)
-#define fnCLEAR(src, dst) (0)
-#define fnCOPY(src, dst) (src)
-#define fnXOR(src, dst) (src ^ dst)
-#define fnCOPYINVERTED(src, dst)(~src)
+#define fnCLEAR(src, dst) (0)
+#define fnCOPY(src, dst) (src)
+#define fnXOR(src, dst) ((src) ^ (dst))
+#define fnCOPYINVERTED(src, dst) (~(src))
-#define DoRop(result, alu, src, dst) \
-{ \
- if (alu == RR_COPY) \
- result = fnCOPY (src, dst); \
- else \
- switch (alu) \
- { \
- case RR_CLEAR: \
- result = fnCLEAR (src, dst); \
- break; \
- case RR_XOR: \
- result = fnXOR (src, dst); \
- break; \
- case RR_COPYINVERTED: \
- result = fnCOPYINVERTED (src, dst); \
- break; \
- } \
-}
+#define DoRop(result, alu, src, dst) \
+do { \
+ switch (alu) { \
+ case RR_CLEAR: \
+ default: \
+ result = fnCLEAR(src, dst); \
+ break; \
+ case RR_COPY: \
+ result = fnCOPY(src, dst); \
+ break; \
+ case RR_XOR: \
+ result = fnXOR(src, dst); \
+ break; \
+ case RR_COPYINVERTED: \
+ result = fnCOPYINVERTED(src, dst); \
+ break; \
+ } \
+} while (0)