Avoid a use of __UNVOLATILE(3). Tested on XM6i.diff -r1.5 -r1.6 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68k.h
(tsutsui)
--- xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68k.h 2020/07/22 21:24:20 1.5
+++ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68k.h 2020/11/03 15:52:57 1.6
@@ -1,173 +1,173 @@ | @@ -1,173 +1,173 @@ | |||
1 | /* $NetBSD: x68k.h,v 1.5 2020/07/22 21:24:20 tsutsui Exp $ */ | 1 | /* $NetBSD: x68k.h,v 1.6 2020/11/03 15:52:57 tsutsui Exp $ */ | |
2 | /*------------------------------------------------------------------------- | 2 | /*------------------------------------------------------------------------- | |
3 | * Copyright (c) 1996 Yasushi Yamasaki | 3 | * Copyright (c) 1996 Yasushi Yamasaki | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * | 14 | * | |
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | *-----------------------------------------------------------------------*/ | 25 | *-----------------------------------------------------------------------*/ | |
26 | 26 | |||
27 | /* system */ | 27 | /* system */ | |
28 | #include <stdlib.h> | 28 | #include <stdlib.h> | |
29 | #include <stdio.h> | 29 | #include <stdio.h> | |
30 | #include <errno.h> | 30 | #include <errno.h> | |
31 | #include <signal.h> | 31 | #include <signal.h> | |
32 | #include <sys/types.h> | 32 | #include <sys/types.h> | |
33 | #include <sys/time.h> | 33 | #include <sys/time.h> | |
34 | #include <sys/ioctl.h> | 34 | #include <sys/ioctl.h> | |
35 | #include <sys/mman.h> | 35 | #include <sys/mman.h> | |
36 | #include <fcntl.h> | 36 | #include <fcntl.h> | |
37 | #include <unistd.h> | 37 | #include <unistd.h> | |
38 | 38 | |||
39 | /* machine dependent */ | 39 | /* machine dependent */ | |
40 | #include <machine/vuid_event.h> | 40 | #include <machine/vuid_event.h> | |
41 | #include <machine/kbd.h> | 41 | #include <machine/kbd.h> | |
42 | #include <machine/kbio.h> | 42 | #include <machine/kbio.h> | |
43 | #include <machine/grfioctl.h> | 43 | #include <machine/grfioctl.h> | |
44 | 44 | |||
45 | /* generic X */ | 45 | /* generic X */ | |
46 | #include <X11/X.h> | 46 | #include <X11/X.h> | |
47 | #include <X11/Xmd.h> | 47 | #include <X11/Xmd.h> | |
48 | #define XK_KATAKANA | 48 | #define XK_KATAKANA | |
49 | #include <X11/keysym.h> | 49 | #include <X11/keysym.h> | |
50 | #define NEED_EVENTS | 50 | #define NEED_EVENTS | |
51 | #include <X11/Xproto.h> | 51 | #include <X11/Xproto.h> | |
52 | 52 | |||
53 | /* dix */ | 53 | /* dix */ | |
54 | #include <misc.h> | 54 | #include <misc.h> | |
55 | #include <scrnintstr.h> | 55 | #include <scrnintstr.h> | |
56 | #include <screenint.h> | 56 | #include <screenint.h> | |
57 | #include <input.h> | 57 | #include <input.h> | |
58 | #include <inputstr.h> | 58 | #include <inputstr.h> | |
59 | #include <servermd.h> | 59 | #include <servermd.h> | |
60 | #include <colormap.h> | 60 | #include <colormap.h> | |
61 | #include <colormapst.h> | 61 | #include <colormapst.h> | |
62 | 62 | |||
63 | /* mi */ | 63 | /* mi */ | |
64 | #include <mipointer.h> | 64 | #include <mipointer.h> | |
65 | 65 | |||
66 | #include "x68kReg.h" | 66 | #include "x68kReg.h" | |
67 | 67 | |||
68 | /* | 68 | /* | |
69 | * X68k dependent screen record | 69 | * X68k dependent screen record | |
70 | */ | 70 | */ | |
71 | typedef struct _X68kScreenRec { | 71 | typedef struct _X68kScreenRec { | |
72 | int type; /* frame buffer type */ | 72 | int type; /* frame buffer type */ | |
73 | int class; /* visual class */ | 73 | int class; /* visual class */ | |
74 | int fd; /* file descriptor */ | 74 | int fd; /* file descriptor */ | |
75 | int depth; /* depth */ | 75 | int depth; /* depth */ | |
76 | int fb_width; /* frame buffer width */ | 76 | int fb_width; /* frame buffer width */ | |
77 | int fb_height; /* frame buffer height */ | 77 | int fb_height; /* frame buffer height */ | |
78 | int scr_width; /* screen width */ | 78 | int scr_width; /* screen width */ | |
79 | int scr_height; /* screen height */ | 79 | int scr_height; /* screen height */ | |
80 | int dpi; /* dots per inch */ | 80 | int dpi; /* dots per inch */ | |
81 | uint8_t *fb; /* frame buffer VA */ | 81 | uint8_t *fb; /* frame buffer VA */ | |
82 | volatile FbReg *reg; /* control register VA */ | 82 | FbReg *reg; /* control register VA */ | |
83 | X68kFbReg x68kreg; /* control register */ | 83 | X68kFbReg x68kreg; /* control register */ | |
84 | int mapsize; /* size of mapped memory */ | 84 | int mapsize; /* size of mapped memory */ | |
85 | ColormapPtr installedMap; /* installed colormap */ | 85 | ColormapPtr installedMap; /* installed colormap */ | |
86 | } X68kScreenRec; | 86 | } X68kScreenRec; | |
87 | 87 | |||
88 | /* | 88 | /* | |
89 | * frame buffer procedures | 89 | * frame buffer procedures | |
90 | */ | 90 | */ | |
91 | typedef struct _X68kFbProcRec { | 91 | typedef struct _X68kFbProcRec { | |
92 | Bool (*open)(X68kScreenRec *); /* open procedure */ | 92 | Bool (*open)(X68kScreenRec *); /* open procedure */ | |
93 | Bool (*init)(ScreenPtr, int, char *[]); /* initialize procedure */ | 93 | Bool (*init)(ScreenPtr, int, char *[]); /* initialize procedure */ | |
94 | void (*close)(X68kScreenRec *); /* close procedure */ | 94 | void (*close)(X68kScreenRec *); /* close procedure */ | |
95 | } X68kFbProcRec; | 95 | } X68kFbProcRec; | |
96 | 96 | |||
97 | /* frame buffer types */ | 97 | /* frame buffer types */ | |
98 | #define X68K_FB_NULL 0 | 98 | #define X68K_FB_NULL 0 | |
99 | #define X68K_FB_TEXT 1 /* text VRAM frame buffer */ | 99 | #define X68K_FB_TEXT 1 /* text VRAM frame buffer */ | |
100 | #define X68K_FB_GRAPHIC 2 /* graphic VRAM frame buffer */ | 100 | #define X68K_FB_GRAPHIC 2 /* graphic VRAM frame buffer */ | |
101 | #if 0 | 101 | #if 0 | |
102 | #define X68K_FB_CIRRUS 3 /* not yet */ | 102 | #define X68K_FB_CIRRUS 3 /* not yet */ | |
103 | #endif | 103 | #endif | |
104 | #define X68K_FB_TYPES 2 | 104 | #define X68K_FB_TYPES 2 | |
105 | 105 | |||
106 | typedef struct _X68kMousePriv { | 106 | typedef struct _X68kMousePriv { | |
107 | int fd; | 107 | int fd; | |
108 | int bmask; | 108 | int bmask; | |
109 | } X68kMousePriv, *X68kMousePrivPtr; | 109 | } X68kMousePriv, *X68kMousePrivPtr; | |
110 | 110 | |||
111 | typedef struct _X68kKbdPriv { | 111 | typedef struct _X68kKbdPriv { | |
112 | int type; | 112 | int type; | |
113 | int fd; | 113 | int fd; | |
114 | Leds leds; | 114 | Leds leds; | |
115 | } X68kKbdPriv, *X68kKbdPrivPtr; | 115 | } X68kKbdPriv, *X68kKbdPrivPtr; | |
116 | 116 | |||
117 | /* keyboard types */ | 117 | /* keyboard types */ | |
118 | #define X68K_KB_STANDARD 0 /* standard keyboard */ | 118 | #define X68K_KB_STANDARD 0 /* standard keyboard */ | |
119 | #define X68K_KB_ASCII 1 /* ascii map keyboard */ | 119 | #define X68K_KB_ASCII 1 /* ascii map keyboard */ | |
120 | 120 | |||
121 | #define X68K_MAXEVENTS 32 | 121 | #define X68K_MAXEVENTS 32 | |
122 | 122 | |||
123 | extern DevPrivateKeyRec x68kScreenPrivateKeyRec; | 123 | extern DevPrivateKeyRec x68kScreenPrivateKeyRec; | |
124 | #define x68kScreenPrivateKey (&x68kScreenPrivateKeyRec) | 124 | #define x68kScreenPrivateKey (&x68kScreenPrivateKeyRec) | |
125 | #define x68kSetScreenPrivate(pScreen, v) \ | 125 | #define x68kSetScreenPrivate(pScreen, v) \ | |
126 | dixSetPrivate(&(pScreen)->devPrivates, x68kScreenPrivateKey, (v)) | 126 | dixSetPrivate(&(pScreen)->devPrivates, x68kScreenPrivateKey, (v)) | |
127 | #define x68kGetScreenPrivate(pScreen) ((X68kScreenRec *) \ | 127 | #define x68kGetScreenPrivate(pScreen) ((X68kScreenRec *) \ | |
128 | dixLookupPrivate(&(pScreen)->devPrivates, x68kScreenPrivateKey)) | 128 | dixLookupPrivate(&(pScreen)->devPrivates, x68kScreenPrivateKey)) | |
129 | 129 | |||
130 | /* in x68kConfig.c */ | 130 | /* in x68kConfig.c */ | |
131 | X68kScreenRec *x68kGetScreenRec(int); | 131 | X68kScreenRec *x68kGetScreenRec(int); | |
132 | X68kScreenRec *x68kGetScreenRecByType(int); | 132 | X68kScreenRec *x68kGetScreenRecByType(int); | |
133 | X68kFbProcRec *x68kGetFbProcRec(int index); | 133 | X68kFbProcRec *x68kGetFbProcRec(int index); | |
134 | void x68kRegisterPixmapFormats(ScreenInfo *); | 134 | void x68kRegisterPixmapFormats(ScreenInfo *); | |
135 | int x68kConfig(void); | 135 | int x68kConfig(void); | |
136 | extern const char *configFilename; | 136 | extern const char *configFilename; | |
137 | 137 | |||
138 | /* x68kFB.c */ | 138 | /* x68kFB.c */ | |
139 | Bool x68kFbCommonOpen(X68kScreenRec *, const char *); | 139 | Bool x68kFbCommonOpen(X68kScreenRec *, const char *); | |
140 | void x68kFbCommonClose(X68kScreenRec *); | 140 | void x68kFbCommonClose(X68kScreenRec *); | |
141 | Bool x68kSaveScreen(ScreenPtr, int); | 141 | Bool x68kSaveScreen(ScreenPtr, int); | |
142 | 142 | |||
143 | /* x68kGraph.c */ | 143 | /* x68kGraph.c */ | |
144 | Bool x68kGraphOpen(X68kScreenRec *); | 144 | Bool x68kGraphOpen(X68kScreenRec *); | |
145 | Bool x68kGraphInit(ScreenPtr, int, char *[]); | 145 | Bool x68kGraphInit(ScreenPtr, int, char *[]); | |
146 | void x68kGraphClose(X68kScreenRec *); | 146 | void x68kGraphClose(X68kScreenRec *); | |
147 | 147 | |||
148 | /* in x68kIo.c */ | 148 | /* in x68kIo.c */ | |
149 | void x68kSigIOHandler(int); | 149 | void x68kSigIOHandler(int); | |
150 | 150 | |||
151 | /* in x68kMouse.c */ | 151 | /* in x68kMouse.c */ | |
152 | int x68kMouseProc(DeviceIntPtr, int); | 152 | int x68kMouseProc(DeviceIntPtr, int); | |
153 | Firm_event *x68kMouseGetEvents(int, int *, Bool *); | 153 | Firm_event *x68kMouseGetEvents(int, int *, Bool *); | |
154 | void x68kMouseEnqueueEvent(DeviceIntPtr, Firm_event *); | 154 | void x68kMouseEnqueueEvent(DeviceIntPtr, Firm_event *); | |
155 | extern miPointerScreenFuncRec x68kPointerScreenFuncs; | 155 | extern miPointerScreenFuncRec x68kPointerScreenFuncs; | |
156 | extern DeviceIntPtr x68kPointerDevice; | 156 | extern DeviceIntPtr x68kPointerDevice; | |
157 | 157 | |||
158 | /* in x68kKbd.c */ | 158 | /* in x68kKbd.c */ | |
159 | int x68kKbdProc(DeviceIntPtr, int); | 159 | int x68kKbdProc(DeviceIntPtr, int); | |
160 | Firm_event *x68kKbdGetEvents(int, int *, Bool *); | 160 | Firm_event *x68kKbdGetEvents(int, int *, Bool *); | |
161 | void x68kKbdEnqueueEvent(DeviceIntPtr, Firm_event *); | 161 | void x68kKbdEnqueueEvent(DeviceIntPtr, Firm_event *); | |
162 | extern X68kKbdPriv x68kKbdPriv; | 162 | extern X68kKbdPriv x68kKbdPriv; | |
163 | extern DeviceIntPtr x68kKeyboardDevice; | 163 | extern DeviceIntPtr x68kKeyboardDevice; | |
164 | 164 | |||
165 | /* in x68kKeyMap.c */ | 165 | /* in x68kKeyMap.c */ | |
166 | extern KeySymsRec jisKeySyms, asciiKeySyms, *x68kKeySyms; | 166 | extern KeySymsRec jisKeySyms, asciiKeySyms, *x68kKeySyms; | |
167 | 167 | |||
168 | /* x68kText.c */ | 168 | /* x68kText.c */ | |
169 | Bool x68kTextOpen(X68kScreenRec *); | 169 | Bool x68kTextOpen(X68kScreenRec *); | |
170 | Bool x68kTextInit(ScreenPtr, int, char *[]); | 170 | Bool x68kTextInit(ScreenPtr, int, char *[]); | |
171 | void x68kTextClose(X68kScreenRec *); | 171 | void x68kTextClose(X68kScreenRec *); | |
172 | 172 | |||
173 | /* EOF x68k.h */ | 173 | /* EOF x68k.h */ |
--- xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kFb.c 2020/11/03 15:25:21 1.5
+++ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kFb.c 2020/11/03 15:52:57 1.6
@@ -1,195 +1,195 @@ | @@ -1,195 +1,195 @@ | |||
1 | /* $NetBSD: x68kFb.c,v 1.5 2020/11/03 15:25:21 tsutsui Exp $ */ | 1 | /* $NetBSD: x68kFb.c,v 1.6 2020/11/03 15:52:57 tsutsui Exp $ */ | |
2 | /*------------------------------------------------------------------------- | 2 | /*------------------------------------------------------------------------- | |
3 | * Copyright (c) 1996 Yasushi Yamasaki | 3 | * Copyright (c) 1996 Yasushi Yamasaki | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * | 14 | * | |
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | *-----------------------------------------------------------------------*/ | 25 | *-----------------------------------------------------------------------*/ | |
26 | 26 | |||
27 | #include "x68k.h" | 27 | #include "x68k.h" | |
28 | 28 | |||
29 | static void x68kRegSetup(X68kScreenRec *pPriv); | 29 | static void x68kRegSetup(X68kScreenRec *pPriv); | |
30 | 30 | |||
31 | DevPrivateKeyRec x68kScreenPrivateKeyRec; | 31 | DevPrivateKeyRec x68kScreenPrivateKeyRec; | |
32 | 32 | |||
33 | static int cons_dwidth; | 33 | static int cons_dwidth; | |
34 | 34 | |||
35 | /*------------------------------------------------------------------------- | 35 | /*------------------------------------------------------------------------- | |
36 | * function "x68kFbCommonOpen" | 36 | * function "x68kFbCommonOpen" | |
37 | * | 37 | * | |
38 | * purpose: open and map frame buffer, and obtain some FB-specific | 38 | * purpose: open and map frame buffer, and obtain some FB-specific | |
39 | * infomation. then set controller to approppriate mode as | 39 | * infomation. then set controller to approppriate mode as | |
40 | * configured in X68kConfig. | 40 | * configured in X68kConfig. | |
41 | * argument: (X68kScreenRec *)pPriv : X68k private screen record | 41 | * argument: (X68kScreenRec *)pPriv : X68k private screen record | |
42 | * (const char *)device : name of frame buffer device | 42 | * (const char *)device : name of frame buffer device | |
43 | * returns: (Bool): TRUE if succeeded | 43 | * returns: (Bool): TRUE if succeeded | |
44 | * FALSE otherwise | 44 | * FALSE otherwise | |
45 | *-----------------------------------------------------------------------*/ | 45 | *-----------------------------------------------------------------------*/ | |
46 | Bool | 46 | Bool | |
47 | x68kFbCommonOpen(X68kScreenRec *pPriv, const char *device) | 47 | x68kFbCommonOpen(X68kScreenRec *pPriv, const char *device) | |
48 | { | 48 | { | |
49 | struct grfinfo gi; | 49 | struct grfinfo gi; | |
50 | 50 | |||
51 | /* open frame buffer */ | 51 | /* open frame buffer */ | |
52 | if ( ( pPriv->fd = open(device, O_RDWR, 0)) < 0) { | 52 | if ( ( pPriv->fd = open(device, O_RDWR, 0)) < 0) { | |
53 | ErrorF( "Can't open frame buffer" ); | 53 | ErrorF( "Can't open frame buffer" ); | |
54 | return FALSE; | 54 | return FALSE; | |
55 | } | 55 | } | |
56 | /* get frame buffer infomation */ | 56 | /* get frame buffer infomation */ | |
57 | if ( ioctl( pPriv->fd, GRFIOCGINFO, &gi ) == -1 ) { | 57 | if ( ioctl( pPriv->fd, GRFIOCGINFO, &gi ) == -1 ) { | |
58 | ErrorF( "Can't get grfinfo" ); | 58 | ErrorF( "Can't get grfinfo" ); | |
59 | return FALSE; | 59 | return FALSE; | |
60 | } | 60 | } | |
61 | pPriv->mapsize = gi.gd_regsize + gi.gd_fbsize; | 61 | pPriv->mapsize = gi.gd_regsize + gi.gd_fbsize; | |
62 | 62 | |||
63 | /* map control registers and frame buffer */ | 63 | /* map control registers and frame buffer */ | |
64 | pPriv->reg = (FbReg *)mmap(0, pPriv->mapsize, PROT_READ | PROT_WRITE, | 64 | pPriv->reg = (FbReg *)mmap(0, pPriv->mapsize, PROT_READ | PROT_WRITE, | |
65 | MAP_FILE | MAP_SHARED, pPriv->fd, 0 ); | 65 | MAP_FILE | MAP_SHARED, pPriv->fd, 0 ); | |
66 | if ( pPriv->reg == (FbReg *)-1) { | 66 | if ( pPriv->reg == (FbReg *)-1) { | |
67 | ErrorF( "Can't map frame buffer" ); | 67 | ErrorF( "Can't map frame buffer" ); | |
68 | return FALSE; | 68 | return FALSE; | |
69 | } | 69 | } | |
70 | pPriv->fb = (uint8_t *)((uint32_t)pPriv->reg + gi.gd_regsize); | 70 | pPriv->fb = (uint8_t *)((uint32_t)pPriv->reg + gi.gd_regsize); | |
71 | 71 | |||
72 | x68kRegSetup( pPriv ); | 72 | x68kRegSetup( pPriv ); | |
73 | cons_dwidth = gi.gd_dwidth; | 73 | cons_dwidth = gi.gd_dwidth; | |
74 | 74 | |||
75 | return TRUE; | 75 | return TRUE; | |
76 | } | 76 | } | |
77 | 77 | |||
78 | /*------------------------------------------------------------------------- | 78 | /*------------------------------------------------------------------------- | |
79 | * function "x68kFbCommonClose" | 79 | * function "x68kFbCommonClose" | |
80 | * | 80 | * | |
81 | * purpose: unmap and close frame buffer, and | 81 | * purpose: unmap and close frame buffer, and | |
82 | * change video mode to normal ITE mode | 82 | * change video mode to normal ITE mode | |
83 | * argument: (X68kScreenRec *)pPriv : X68k private screen record | 83 | * argument: (X68kScreenRec *)pPriv : X68k private screen record | |
84 | * returns: nothing | 84 | * returns: nothing | |
85 | *-----------------------------------------------------------------------*/ | 85 | *-----------------------------------------------------------------------*/ | |
86 | void | 86 | void | |
87 | x68kFbCommonClose(X68kScreenRec *pPriv) | 87 | x68kFbCommonClose(X68kScreenRec *pPriv) | |
88 | { | 88 | { | |
89 | static const X68kFbReg graphNone_mode16 = { | 89 | static const X68kFbReg graphNone_mode16 = { | |
90 | /* CRT mode 16 (768x512 31.5kHz) */ | 90 | /* CRT mode 16 (768x512 31.5kHz) */ | |
91 | { 137,14, 28, 124, | 91 | { 137,14, 28, 124, | |
92 | 567, 5, 40, 552, | 92 | 567, 5, 40, 552, | |
93 | 27, 0, 0, 0, | 93 | 27, 0, 0, 0, | |
94 | 0, 0, 0, 0, | 94 | 0, 0, 0, 0, | |
95 | 0, 0, 0, 0, | 95 | 0, 0, 0, 0, | |
96 | 0x0416, 0, 0, 0, 0 }, | 96 | 0x0416, 0, 0, 0, 0 }, | |
97 | { 0x0004, 0x21e4, 0x0020 }, | 97 | { 0x0004, 0x21e4, 0x0020 }, | |
98 | 0 | 98 | 0 | |
99 | }; | 99 | }; | |
100 | static const X68kFbReg graphNone_mode19 = { | 100 | static const X68kFbReg graphNone_mode19 = { | |
101 | /* CRT mode 19 (640x480 31.5kHz VGA mode) */ | 101 | /* CRT mode 19 (640x480 31.5kHz VGA mode) */ | |
102 | { 99,11, 13, 93, | 102 | { 99,11, 13, 93, | |
103 | 524, 1, 33, 513, | 103 | 524, 1, 33, 513, | |
104 | 27, 0, 0, 0, | 104 | 27, 0, 0, 0, | |
105 | 0, 0, 0, 0, | 105 | 0, 0, 0, 0, | |
106 | 0, 0, 0, 0, | 106 | 0, 0, 0, 0, | |
107 | 0x0417, 0, 0, 0, 0 }, | 107 | 0x0417, 0, 0, 0, 0 }, | |
108 | { 0x0004, 0x21e4, 0x0020 }, | 108 | { 0x0004, 0x21e4, 0x0020 }, | |
109 | 0 | 109 | 0 | |
110 | }; | 110 | }; | |
111 | /* change video mode */ | 111 | /* change video mode */ | |
112 | pPriv->x68kreg = (cons_dwidth == 640) ? graphNone_mode19 : graphNone_mode16; | 112 | pPriv->x68kreg = (cons_dwidth == 640) ? graphNone_mode19 : graphNone_mode16; | |
113 | x68kRegSetup(pPriv); | 113 | x68kRegSetup(pPriv); | |
114 | 114 | |||
115 | /* unmap and close frame buffer */ | 115 | /* unmap and close frame buffer */ | |
116 | if ( munmap(__UNVOLATILE(pPriv->reg), pPriv->mapsize) == -1 ) | 116 | if ( munmap(pPriv->reg, pPriv->mapsize) == -1 ) | |
117 | ErrorF("Can't unmap frame buffer"); | 117 | ErrorF("Can't unmap frame buffer"); | |
118 | close(pPriv->fd); | 118 | close(pPriv->fd); | |
119 | } | 119 | } | |
120 | 120 | |||
121 | /*------------------------------------------------------------------------- | 121 | /*------------------------------------------------------------------------- | |
122 | * function "x68kRegSetup" | 122 | * function "x68kRegSetup" | |
123 | * | 123 | * | |
124 | * purpose: set up CRT controller and Video controller | 124 | * purpose: set up CRT controller and Video controller | |
125 | * with register values in pPriv->x68kreg | 125 | * with register values in pPriv->x68kreg | |
126 | * argument: (X68kScreenRec *)pPriv : X68k private screen record | 126 | * argument: (X68kScreenRec *)pPriv : X68k private screen record | |
127 | * returns: nothing | 127 | * returns: nothing | |
128 | *-----------------------------------------------------------------------*/ | 128 | *-----------------------------------------------------------------------*/ | |
129 | #define CRTCSET(r) pPriv->reg->crtc.r = pPriv->x68kreg.crtc.r | 129 | #define CRTCSET(r) pPriv->reg->crtc.r = pPriv->x68kreg.crtc.r | |
130 | #define VIDEOCSET(r) pPriv->reg->videoc.r = pPriv->x68kreg.videoc.r | 130 | #define VIDEOCSET(r) pPriv->reg->videoc.r = pPriv->x68kreg.videoc.r | |
131 | 131 | |||
132 | static void | 132 | static void | |
133 | x68kRegSetup(X68kScreenRec *pPriv) | 133 | x68kRegSetup(X68kScreenRec *pPriv) | |
134 | { | 134 | { | |
135 | u_short pr20 = pPriv->reg->crtc.r20; | 135 | u_short pr20 = pPriv->reg->crtc.r20; | |
136 | 136 | |||
137 | /* timing registers */ | 137 | /* timing registers */ | |
138 | if ( (pr20 & 0x0003) < (pPriv->x68kreg.crtc.r20 & 0x0003) || | 138 | if ( (pr20 & 0x0003) < (pPriv->x68kreg.crtc.r20 & 0x0003) || | |
139 | ( (pr20 & 0x0003) == (pPriv->x68kreg.crtc.r20 & 0x0003) && | 139 | ( (pr20 & 0x0003) == (pPriv->x68kreg.crtc.r20 & 0x0003) && | |
140 | (pr20 & 0x0010) < (pPriv->x68kreg.crtc.r20 & 0x0010) ) ) { | 140 | (pr20 & 0x0010) < (pPriv->x68kreg.crtc.r20 & 0x0010) ) ) { | |
141 | 141 | |||
142 | /* to higher resolution */ | 142 | /* to higher resolution */ | |
143 | CRTCSET(r00); CRTCSET(r01); CRTCSET(r02);CRTCSET(r03); | 143 | CRTCSET(r00); CRTCSET(r01); CRTCSET(r02);CRTCSET(r03); | |
144 | CRTCSET(r04); CRTCSET(r05); CRTCSET(r06);CRTCSET(r07); | 144 | CRTCSET(r04); CRTCSET(r05); CRTCSET(r06);CRTCSET(r07); | |
145 | CRTCSET(r20); | 145 | CRTCSET(r20); | |
146 | } else { | 146 | } else { | |
147 | /* to lower resolution */ | 147 | /* to lower resolution */ | |
148 | CRTCSET(r20); CRTCSET(r01); CRTCSET(r02);CRTCSET(r03); | 148 | CRTCSET(r20); CRTCSET(r01); CRTCSET(r02);CRTCSET(r03); | |
149 | CRTCSET(r04); CRTCSET(r05); CRTCSET(r06);CRTCSET(r07); | 149 | CRTCSET(r04); CRTCSET(r05); CRTCSET(r06);CRTCSET(r07); | |
150 | CRTCSET(r00); | 150 | CRTCSET(r00); | |
151 | } | 151 | } | |
152 | CRTCSET(r08); | 152 | CRTCSET(r08); | |
153 | 153 | |||
154 | /* scroll registers */ | 154 | /* scroll registers */ | |
155 | CRTCSET(r12); CRTCSET(r13); CRTCSET(r14);CRTCSET(r15); | 155 | CRTCSET(r12); CRTCSET(r13); CRTCSET(r14);CRTCSET(r15); | |
156 | CRTCSET(r16); CRTCSET(r17); CRTCSET(r18);CRTCSET(r19); | 156 | CRTCSET(r16); CRTCSET(r17); CRTCSET(r18);CRTCSET(r19); | |
157 | 157 | |||
158 | /* mode controlling registers */ | 158 | /* mode controlling registers */ | |
159 | VIDEOCSET(r0); VIDEOCSET(r1); VIDEOCSET(r2); | 159 | VIDEOCSET(r0); VIDEOCSET(r1); VIDEOCSET(r2); | |
160 | 160 | |||
161 | /* dot clock bit */ | 161 | /* dot clock bit */ | |
162 | pPriv->reg->sysport.r4 = (pPriv->x68kreg.dotClock)? 0x000e: 0x000c; | 162 | pPriv->reg->sysport.r4 = (pPriv->x68kreg.dotClock)? 0x000e: 0x000c; | |
163 | } | 163 | } | |
164 | 164 | |||
165 | /*------------------------------------------------------------------------- | 165 | /*------------------------------------------------------------------------- | |
166 | * function "x68kSaveScreen" [ screen function ] | 166 | * function "x68kSaveScreen" [ screen function ] | |
167 | * | 167 | * | |
168 | * purpose: activate/deactivate screen saver | 168 | * purpose: activate/deactivate screen saver | |
169 | * argument: (ScreenPtr)ipScreen : target screen to save | 169 | * argument: (ScreenPtr)ipScreen : target screen to save | |
170 | * (int)mode : on/off | 170 | * (int)mode : on/off | |
171 | * returns: nothing | 171 | * returns: nothing | |
172 | *-----------------------------------------------------------------------*/ | 172 | *-----------------------------------------------------------------------*/ | |
173 | Bool | 173 | Bool | |
174 | x68kSaveScreen(ScreenPtr pScreen, Bool on) | 174 | x68kSaveScreen(ScreenPtr pScreen, Bool on) | |
175 | { | 175 | { | |
176 | X68kScreenRec *pPriv = x68kGetScreenPrivate(pScreen); | 176 | X68kScreenRec *pPriv = x68kGetScreenPrivate(pScreen); | |
177 | static int status = FALSE; | 177 | static int status = FALSE; | |
178 | static u_short r2; | 178 | static u_short r2; | |
179 | 179 | |||
180 | if (on == SCREEN_SAVER_ON || on == SCREEN_SAVER_CYCLE) { | 180 | if (on == SCREEN_SAVER_ON || on == SCREEN_SAVER_CYCLE) { | |
181 | if (!status) { | 181 | if (!status) { | |
182 | r2 = pPriv->reg->videoc.r2; | 182 | r2 = pPriv->reg->videoc.r2; | |
183 | pPriv->reg->videoc.r2 = 0x0000; | 183 | pPriv->reg->videoc.r2 = 0x0000; | |
184 | status = TRUE; | 184 | status = TRUE; | |
185 | } | 185 | } | |
186 | } else { | 186 | } else { | |
187 | if (status) { | 187 | if (status) { | |
188 | pPriv->reg->videoc.r2 = r2; | 188 | pPriv->reg->videoc.r2 = r2; | |
189 | status = FALSE; | 189 | status = FALSE; | |
190 | } | 190 | } | |
191 | } | 191 | } | |
192 | return TRUE; | 192 | return TRUE; | |
193 | } | 193 | } | |
194 | 194 | |||
195 | /* EOF x68kFb.c */ | 195 | /* EOF x68kFb.c */ |
--- xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kReg.h 2020/08/01 20:09:03 1.3
+++ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kReg.h 2020/11/03 15:52:57 1.4
@@ -1,90 +1,90 @@ | @@ -1,90 +1,90 @@ | |||
1 | /* $NetBSD: x68kReg.h,v 1.3 2020/08/01 20:09:03 tsutsui Exp $ */ | 1 | /* $NetBSD: x68kReg.h,v 1.4 2020/11/03 15:52:57 tsutsui Exp $ */ | |
2 | /*------------------------------------------------------------------------- | 2 | /*------------------------------------------------------------------------- | |
3 | * Copyright (c) 1996 Yasushi Yamasaki | 3 | * Copyright (c) 1996 Yasushi Yamasaki | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * | 14 | * | |
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | *-----------------------------------------------------------------------*/ | 25 | *-----------------------------------------------------------------------*/ | |
26 | 26 | |||
27 | /* | 27 | /* | |
28 | * CRT controller | 28 | * CRT controller | |
29 | */ | 29 | */ | |
30 | typedef struct { | 30 | typedef struct { | |
31 | u_short r00, r01, r02, r03, r04, r05, r06, r07; | 31 | volatile u_short r00, r01, r02, r03, r04, r05, r06, r07; | |
32 | u_short r08, r09, r10, r11, r12, r13, r14, r15; | 32 | volatile u_short r08, r09, r10, r11, r12, r13, r14, r15; | |
33 | u_short r16, r17, r18, r19, r20, r21, r22, r23; | 33 | volatile u_short r16, r17, r18, r19, r20, r21, r22, r23; | |
34 | char pad0[0x450]; | 34 | char pad0[0x450]; | |
35 | u_short ctrl; | 35 | volatile u_short ctrl; | |
36 | char pad1[0x1b7e]; | 36 | char pad1[0x1b7e]; | |
37 | } Crtc; | 37 | } Crtc; | |
38 | 38 | |||
39 | typedef struct { | 39 | typedef struct { | |
40 | u_short r00, r01, r02, r03, r04, r05, r06, r07; | 40 | u_short r00, r01, r02, r03, r04, r05, r06, r07; | |
41 | u_short r08, r09, r10, r11, r12, r13, r14, r15; | 41 | u_short r08, r09, r10, r11, r12, r13, r14, r15; | |
42 | u_short r16, r17, r18, r19, r20, r21, r22, r23; | 42 | u_short r16, r17, r18, r19, r20, r21, r22, r23; | |
43 | u_short ctrl; | 43 | u_short ctrl; | |
44 | } X68kCrtc; | 44 | } X68kCrtc; | |
45 | 45 | |||
46 | /* | 46 | /* | |
47 | * video controller | 47 | * video controller | |
48 | */ | 48 | */ | |
49 | typedef struct { | 49 | typedef struct { | |
50 | u_short r0; | 50 | volatile u_short r0; | |
51 | char pad0[0xfe]; | 51 | char pad0[0xfe]; | |
52 | u_short r1; | 52 | volatile u_short r1; | |
53 | char pad1[0xfe]; | 53 | char pad1[0xfe]; | |
54 | u_short r2; | 54 | volatile u_short r2; | |
55 | char pad2[0x19fe]; | 55 | char pad2[0x19fe]; | |
56 | } Videoc; | 56 | } Videoc; | |
57 | 57 | |||
58 | typedef struct { | 58 | typedef struct { | |
59 | u_short r0; | 59 | u_short r0; | |
60 | u_short r1; | 60 | u_short r1; | |
61 | u_short r2; | 61 | u_short r2; | |
62 | } X68kVideoc; | 62 | } X68kVideoc; | |
63 | 63 | |||
64 | /* system port */ | 64 | /* system port */ | |
65 | typedef struct { | 65 | typedef struct { | |
66 | u_short r1, r2, r3, r4; | 66 | volatile u_short r1, r2, r3, r4; | |
67 | u_short pad0[2]; | 67 | u_short pad0[2]; | |
68 | u_short r5, r6; | 68 | volatile u_short r5, r6; | |
69 | u_short pad[0x1ff0]; | 69 | u_short pad[0x1ff0]; | |
70 | } Sysport; | 70 | } Sysport; | |
71 | 71 | |||
72 | /* | 72 | /* | |
73 | * control registers | 73 | * control registers | |
74 | */ | 74 | */ | |
75 | typedef struct { | 75 | typedef struct { | |
76 | Crtc crtc; | 76 | Crtc crtc; | |
77 | u_short gpal[256]; /* graphic palette */ | 77 | volatile u_short gpal[256]; /* graphic palette */ | |
78 | u_short tpal[256]; /* text palette */ | 78 | volatile u_short tpal[256]; /* text palette */ | |
79 | Videoc videoc; | 79 | Videoc videoc; | |
80 | u_short pad0[0xa000]; | 80 | u_short pad0[0xa000]; | |
81 | Sysport sysport; | 81 | Sysport sysport; | |
82 | } FbReg; | 82 | } FbReg; | |
83 | 83 | |||
84 | typedef struct { | 84 | typedef struct { | |
85 | X68kCrtc crtc; | 85 | X68kCrtc crtc; | |
86 | X68kVideoc videoc; | 86 | X68kVideoc videoc; | |
87 | char dotClock; | 87 | char dotClock; | |
88 | } X68kFbReg; | 88 | } X68kFbReg; | |
89 | 89 | |||
90 | /* EOF x68kReg.h */ | 90 | /* EOF x68kReg.h */ |