diff options
Diffstat (limited to 'include/asm-m68k')
161 files changed, 16748 insertions, 0 deletions
diff --git a/include/asm-m68k/a.out.h b/include/asm-m68k/a.out.h new file mode 100644 index 000000000000..eda1662773b8 --- /dev/null +++ b/include/asm-m68k/a.out.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef __M68K_A_OUT_H__ | ||
2 | #define __M68K_A_OUT_H__ | ||
3 | |||
4 | struct exec | ||
5 | { | ||
6 | unsigned long a_info; /* Use macros N_MAGIC, etc for access */ | ||
7 | unsigned a_text; /* length of text, in bytes */ | ||
8 | unsigned a_data; /* length of data, in bytes */ | ||
9 | unsigned a_bss; /* length of uninitialized data area for file, in bytes */ | ||
10 | unsigned a_syms; /* length of symbol table data in file, in bytes */ | ||
11 | unsigned a_entry; /* start address */ | ||
12 | unsigned a_trsize; /* length of relocation info for text, in bytes */ | ||
13 | unsigned a_drsize; /* length of relocation info for data, in bytes */ | ||
14 | }; | ||
15 | |||
16 | #define N_TRSIZE(a) ((a).a_trsize) | ||
17 | #define N_DRSIZE(a) ((a).a_drsize) | ||
18 | #define N_SYMSIZE(a) ((a).a_syms) | ||
19 | |||
20 | #ifdef __KERNEL__ | ||
21 | |||
22 | #define STACK_TOP TASK_SIZE | ||
23 | |||
24 | #endif | ||
25 | |||
26 | #endif /* __M68K_A_OUT_H__ */ | ||
diff --git a/include/asm-m68k/adb.h b/include/asm-m68k/adb.h new file mode 100644 index 000000000000..9176b55185bb --- /dev/null +++ b/include/asm-m68k/adb.h | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * Definitions for talking to ADB and CUDA. The CUDA is a microcontroller | ||
3 | * which controls the ADB, system power, RTC, and various other things on | ||
4 | * later Macintoshes | ||
5 | * | ||
6 | * Copyright (C) 1996 Paul Mackerras. | ||
7 | */ | ||
8 | |||
9 | /* First byte sent to or received from CUDA */ | ||
10 | #define ADB_PACKET 0 | ||
11 | #define CUDA_PACKET 1 | ||
12 | #define ERROR_PACKET 2 | ||
13 | #define TIMER_PACKET 3 | ||
14 | #define POWER_PACKET 4 | ||
15 | #define MACIIC_PACKET 5 | ||
16 | |||
17 | /* ADB commands (2nd byte) */ | ||
18 | #define ADB_BUSRESET 0 | ||
19 | #define ADB_FLUSH(id) (1 + ((id) << 4)) | ||
20 | #define ADB_WRITEREG(id, reg) (8 + (reg) + ((id) << 4)) | ||
21 | #define ADB_READREG(id, reg) (0xc + (reg) + ((id) << 4)) | ||
22 | |||
23 | /* ADB default device IDs (upper 4 bits of 2nd byte) */ | ||
24 | #define ADB_DONGLE 1 /* "software execution control" devices */ | ||
25 | #define ADB_KEYBOARD 2 | ||
26 | #define ADB_MOUSE 3 | ||
27 | #define ADB_TABLET 4 | ||
28 | #define ADB_MODEM 5 | ||
29 | #define ADB_MISC 7 /* maybe a monitor */ | ||
30 | |||
31 | /* CUDA commands (2nd byte) */ | ||
32 | #define CUDA_WARM_START 0 | ||
33 | #define CUDA_AUTOPOLL 1 | ||
34 | #define CUDA_GET_6805_ADDR 2 | ||
35 | #define CUDA_GET_TIME 3 | ||
36 | #define CUDA_GET_PRAM 7 | ||
37 | #define CUDA_SET_6805_ADDR 8 | ||
38 | #define CUDA_SET_TIME 9 | ||
39 | #define CUDA_POWERDOWN 0xa | ||
40 | #define CUDA_POWERUP_TIME 0xb | ||
41 | #define CUDA_SET_PRAM 0xc | ||
42 | #define CUDA_MS_RESET 0xd | ||
43 | #define CUDA_SEND_DFAC 0xe | ||
44 | #define CUDA_RESET_SYSTEM 0x11 | ||
45 | #define CUDA_SET_IPL 0x12 | ||
46 | #define CUDA_SET_AUTO_RATE 0x14 | ||
47 | #define CUDA_GET_AUTO_RATE 0x16 | ||
48 | #define CUDA_SET_DEVICE_LIST 0x19 | ||
49 | #define CUDA_GET_DEVICE_LIST 0x1a | ||
50 | #define CUDA_GET_SET_IIC 0x22 | ||
51 | |||
52 | #ifdef __KERNEL__ | ||
53 | |||
54 | struct adb_request { | ||
55 | unsigned char data[16]; | ||
56 | int nbytes; | ||
57 | unsigned char reply[16]; | ||
58 | int reply_len; | ||
59 | unsigned char reply_expected; | ||
60 | unsigned char sent; | ||
61 | unsigned char got_reply; | ||
62 | void (*done)(struct adb_request *); | ||
63 | void *arg; | ||
64 | struct adb_request *next; | ||
65 | }; | ||
66 | |||
67 | void via_adb_init(void); | ||
68 | int adb_request(struct adb_request *req, | ||
69 | void (*done)(struct adb_request *), int nbytes, ...); | ||
70 | int adb_send_request(struct adb_request *req); | ||
71 | void adb_poll(void); | ||
72 | int adb_register(int default_id, | ||
73 | void (*handler)(unsigned char *, int, struct pt_regs *)); | ||
74 | |||
75 | #endif /* __KERNEL */ | ||
diff --git a/include/asm-m68k/adb_iop.h b/include/asm-m68k/adb_iop.h new file mode 100644 index 000000000000..8a48e56f2d62 --- /dev/null +++ b/include/asm-m68k/adb_iop.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * ADB through the IOP | ||
3 | * Written by Joshua M. Thompson | ||
4 | */ | ||
5 | |||
6 | /* IOP number and channel number for ADB */ | ||
7 | |||
8 | #define ADB_IOP IOP_NUM_ISM | ||
9 | #define ADB_CHAN 2 | ||
10 | |||
11 | /* From the A/UX headers...maybe important, maybe not */ | ||
12 | |||
13 | #define ADB_IOP_LISTEN 0x01 | ||
14 | #define ADB_IOP_TALK 0x02 | ||
15 | #define ADB_IOP_EXISTS 0x04 | ||
16 | #define ADB_IOP_FLUSH 0x08 | ||
17 | #define ADB_IOP_RESET 0x10 | ||
18 | #define ADB_IOP_INT 0x20 | ||
19 | #define ADB_IOP_POLL 0x40 | ||
20 | #define ADB_IOP_UNINT 0x80 | ||
21 | |||
22 | #define AIF_RESET 0x00 | ||
23 | #define AIF_FLUSH 0x01 | ||
24 | #define AIF_LISTEN 0x08 | ||
25 | #define AIF_TALK 0x0C | ||
26 | |||
27 | /* Flag bits in struct adb_iopmsg */ | ||
28 | |||
29 | #define ADB_IOP_EXPLICIT 0x80 /* nonzero if explicit command */ | ||
30 | #define ADB_IOP_AUTOPOLL 0x40 /* auto/SRQ polling enabled */ | ||
31 | #define ADB_IOP_SRQ 0x04 /* SRQ detected */ | ||
32 | #define ADB_IOP_TIMEOUT 0x02 /* nonzero if timeout */ | ||
33 | |||
34 | #ifndef __ASSEMBLY__ | ||
35 | |||
36 | struct adb_iopmsg { | ||
37 | __u8 flags; /* ADB flags */ | ||
38 | __u8 count; /* no. of data bytes */ | ||
39 | __u8 cmd; /* ADB command */ | ||
40 | __u8 data[8]; /* ADB data */ | ||
41 | __u8 spare[21]; /* spare */ | ||
42 | }; | ||
43 | |||
44 | #endif /* __ASSEMBLY__ */ | ||
diff --git a/include/asm-m68k/amigahw.h b/include/asm-m68k/amigahw.h new file mode 100644 index 000000000000..3ae5d8d55ba9 --- /dev/null +++ b/include/asm-m68k/amigahw.h | |||
@@ -0,0 +1,354 @@ | |||
1 | /* | ||
2 | ** asm-m68k/amigahw.h -- This header defines some macros and pointers for | ||
3 | ** the various Amiga custom hardware registers. | ||
4 | ** The naming conventions used here conform to those | ||
5 | ** used in the Amiga Hardware Reference Manual, 3rd Edition | ||
6 | ** | ||
7 | ** Copyright 1992 by Greg Harp | ||
8 | ** | ||
9 | ** This file is subject to the terms and conditions of the GNU General Public | ||
10 | ** License. See the file COPYING in the main directory of this archive | ||
11 | ** for more details. | ||
12 | ** | ||
13 | ** Created: 9/24/92 by Greg Harp | ||
14 | */ | ||
15 | |||
16 | #ifndef _M68K_AMIGAHW_H | ||
17 | #define _M68K_AMIGAHW_H | ||
18 | |||
19 | #include <linux/ioport.h> | ||
20 | |||
21 | /* | ||
22 | * Different Amiga models | ||
23 | */ | ||
24 | |||
25 | extern unsigned long amiga_model; | ||
26 | |||
27 | #define AMI_UNKNOWN (0) | ||
28 | #define AMI_500 (1) | ||
29 | #define AMI_500PLUS (2) | ||
30 | #define AMI_600 (3) | ||
31 | #define AMI_1000 (4) | ||
32 | #define AMI_1200 (5) | ||
33 | #define AMI_2000 (6) | ||
34 | #define AMI_2500 (7) | ||
35 | #define AMI_3000 (8) | ||
36 | #define AMI_3000T (9) | ||
37 | #define AMI_3000PLUS (10) | ||
38 | #define AMI_4000 (11) | ||
39 | #define AMI_4000T (12) | ||
40 | #define AMI_CDTV (13) | ||
41 | #define AMI_CD32 (14) | ||
42 | #define AMI_DRACO (15) | ||
43 | |||
44 | |||
45 | /* | ||
46 | * Chipsets | ||
47 | */ | ||
48 | |||
49 | extern unsigned long amiga_chipset; | ||
50 | |||
51 | #define CS_STONEAGE (0) | ||
52 | #define CS_OCS (1) | ||
53 | #define CS_ECS (2) | ||
54 | #define CS_AGA (3) | ||
55 | |||
56 | |||
57 | /* | ||
58 | * Miscellaneous | ||
59 | */ | ||
60 | |||
61 | extern unsigned long amiga_eclock; /* 700 kHz E Peripheral Clock */ | ||
62 | extern unsigned long amiga_masterclock; /* 28 MHz Master Clock */ | ||
63 | extern unsigned long amiga_colorclock; /* 3.5 MHz Color Clock */ | ||
64 | extern unsigned long amiga_chip_size; /* Chip RAM Size (bytes) */ | ||
65 | extern unsigned char amiga_vblank; /* VBLANK Frequency */ | ||
66 | extern unsigned char amiga_psfreq; /* Power Supply Frequency */ | ||
67 | |||
68 | |||
69 | #define AMIGAHW_DECLARE(name) unsigned name : 1 | ||
70 | #define AMIGAHW_SET(name) (amiga_hw_present.name = 1) | ||
71 | #define AMIGAHW_PRESENT(name) (amiga_hw_present.name) | ||
72 | |||
73 | struct amiga_hw_present { | ||
74 | /* video hardware */ | ||
75 | AMIGAHW_DECLARE(AMI_VIDEO); /* Amiga Video */ | ||
76 | AMIGAHW_DECLARE(AMI_BLITTER); /* Amiga Blitter */ | ||
77 | AMIGAHW_DECLARE(AMBER_FF); /* Amber Flicker Fixer */ | ||
78 | /* sound hardware */ | ||
79 | AMIGAHW_DECLARE(AMI_AUDIO); /* Amiga Audio */ | ||
80 | /* disk storage interfaces */ | ||
81 | AMIGAHW_DECLARE(AMI_FLOPPY); /* Amiga Floppy */ | ||
82 | AMIGAHW_DECLARE(A3000_SCSI); /* SCSI (wd33c93, A3000 alike) */ | ||
83 | AMIGAHW_DECLARE(A4000_SCSI); /* SCSI (ncr53c710, A4000T alike) */ | ||
84 | AMIGAHW_DECLARE(A1200_IDE); /* IDE (A1200 alike) */ | ||
85 | AMIGAHW_DECLARE(A4000_IDE); /* IDE (A4000 alike) */ | ||
86 | AMIGAHW_DECLARE(CD_ROM); /* CD ROM drive */ | ||
87 | /* other I/O hardware */ | ||
88 | AMIGAHW_DECLARE(AMI_KEYBOARD); /* Amiga Keyboard */ | ||
89 | AMIGAHW_DECLARE(AMI_MOUSE); /* Amiga Mouse */ | ||
90 | AMIGAHW_DECLARE(AMI_SERIAL); /* Amiga Serial */ | ||
91 | AMIGAHW_DECLARE(AMI_PARALLEL); /* Amiga Parallel */ | ||
92 | /* real time clocks */ | ||
93 | AMIGAHW_DECLARE(A2000_CLK); /* Hardware Clock (A2000 alike) */ | ||
94 | AMIGAHW_DECLARE(A3000_CLK); /* Hardware Clock (A3000 alike) */ | ||
95 | /* supporting hardware */ | ||
96 | AMIGAHW_DECLARE(CHIP_RAM); /* Chip RAM */ | ||
97 | AMIGAHW_DECLARE(PAULA); /* Paula (8364) */ | ||
98 | AMIGAHW_DECLARE(DENISE); /* Denise (8362) */ | ||
99 | AMIGAHW_DECLARE(DENISE_HR); /* Denise (8373) */ | ||
100 | AMIGAHW_DECLARE(LISA); /* Lisa (8375) */ | ||
101 | AMIGAHW_DECLARE(AGNUS_PAL); /* Normal/Fat PAL Agnus (8367/8371) */ | ||
102 | AMIGAHW_DECLARE(AGNUS_NTSC); /* Normal/Fat NTSC Agnus (8361/8370) */ | ||
103 | AMIGAHW_DECLARE(AGNUS_HR_PAL); /* Fat Hires PAL Agnus (8372) */ | ||
104 | AMIGAHW_DECLARE(AGNUS_HR_NTSC); /* Fat Hires NTSC Agnus (8372) */ | ||
105 | AMIGAHW_DECLARE(ALICE_PAL); /* PAL Alice (8374) */ | ||
106 | AMIGAHW_DECLARE(ALICE_NTSC); /* NTSC Alice (8374) */ | ||
107 | AMIGAHW_DECLARE(MAGIC_REKICK); /* A3000 Magic Hard Rekick */ | ||
108 | AMIGAHW_DECLARE(PCMCIA); /* PCMCIA Slot */ | ||
109 | AMIGAHW_DECLARE(GG2_ISA); /* GG2 Zorro2ISA Bridge */ | ||
110 | AMIGAHW_DECLARE(ZORRO); /* Zorro AutoConfig */ | ||
111 | AMIGAHW_DECLARE(ZORRO3); /* Zorro III */ | ||
112 | }; | ||
113 | |||
114 | extern struct amiga_hw_present amiga_hw_present; | ||
115 | |||
116 | struct CUSTOM { | ||
117 | unsigned short bltddat; | ||
118 | unsigned short dmaconr; | ||
119 | unsigned short vposr; | ||
120 | unsigned short vhposr; | ||
121 | unsigned short dskdatr; | ||
122 | unsigned short joy0dat; | ||
123 | unsigned short joy1dat; | ||
124 | unsigned short clxdat; | ||
125 | unsigned short adkconr; | ||
126 | unsigned short pot0dat; | ||
127 | unsigned short pot1dat; | ||
128 | unsigned short potgor; | ||
129 | unsigned short serdatr; | ||
130 | unsigned short dskbytr; | ||
131 | unsigned short intenar; | ||
132 | unsigned short intreqr; | ||
133 | unsigned char *dskptr; | ||
134 | unsigned short dsklen; | ||
135 | unsigned short dskdat; | ||
136 | unsigned short refptr; | ||
137 | unsigned short vposw; | ||
138 | unsigned short vhposw; | ||
139 | unsigned short copcon; | ||
140 | unsigned short serdat; | ||
141 | unsigned short serper; | ||
142 | unsigned short potgo; | ||
143 | unsigned short joytest; | ||
144 | unsigned short strequ; | ||
145 | unsigned short strvbl; | ||
146 | unsigned short strhor; | ||
147 | unsigned short strlong; | ||
148 | unsigned short bltcon0; | ||
149 | unsigned short bltcon1; | ||
150 | unsigned short bltafwm; | ||
151 | unsigned short bltalwm; | ||
152 | unsigned char *bltcpt; | ||
153 | unsigned char *bltbpt; | ||
154 | unsigned char *bltapt; | ||
155 | unsigned char *bltdpt; | ||
156 | unsigned short bltsize; | ||
157 | unsigned char pad2d; | ||
158 | unsigned char bltcon0l; | ||
159 | unsigned short bltsizv; | ||
160 | unsigned short bltsizh; | ||
161 | unsigned short bltcmod; | ||
162 | unsigned short bltbmod; | ||
163 | unsigned short bltamod; | ||
164 | unsigned short bltdmod; | ||
165 | unsigned short spare2[4]; | ||
166 | unsigned short bltcdat; | ||
167 | unsigned short bltbdat; | ||
168 | unsigned short bltadat; | ||
169 | unsigned short spare3[3]; | ||
170 | unsigned short deniseid; | ||
171 | unsigned short dsksync; | ||
172 | unsigned short *cop1lc; | ||
173 | unsigned short *cop2lc; | ||
174 | unsigned short copjmp1; | ||
175 | unsigned short copjmp2; | ||
176 | unsigned short copins; | ||
177 | unsigned short diwstrt; | ||
178 | unsigned short diwstop; | ||
179 | unsigned short ddfstrt; | ||
180 | unsigned short ddfstop; | ||
181 | unsigned short dmacon; | ||
182 | unsigned short clxcon; | ||
183 | unsigned short intena; | ||
184 | unsigned short intreq; | ||
185 | unsigned short adkcon; | ||
186 | struct { | ||
187 | unsigned short *audlc; | ||
188 | unsigned short audlen; | ||
189 | unsigned short audper; | ||
190 | unsigned short audvol; | ||
191 | unsigned short auddat; | ||
192 | unsigned short audspare[2]; | ||
193 | } aud[4]; | ||
194 | unsigned char *bplpt[8]; | ||
195 | unsigned short bplcon0; | ||
196 | unsigned short bplcon1; | ||
197 | unsigned short bplcon2; | ||
198 | unsigned short bplcon3; | ||
199 | unsigned short bpl1mod; | ||
200 | unsigned short bpl2mod; | ||
201 | unsigned short bplcon4; | ||
202 | unsigned short clxcon2; | ||
203 | unsigned short bpldat[8]; | ||
204 | unsigned char *sprpt[8]; | ||
205 | struct { | ||
206 | unsigned short pos; | ||
207 | unsigned short ctl; | ||
208 | unsigned short dataa; | ||
209 | unsigned short datab; | ||
210 | } spr[8]; | ||
211 | unsigned short color[32]; | ||
212 | unsigned short htotal; | ||
213 | unsigned short hsstop; | ||
214 | unsigned short hbstrt; | ||
215 | unsigned short hbstop; | ||
216 | unsigned short vtotal; | ||
217 | unsigned short vsstop; | ||
218 | unsigned short vbstrt; | ||
219 | unsigned short vbstop; | ||
220 | unsigned short sprhstrt; | ||
221 | unsigned short sprhstop; | ||
222 | unsigned short bplhstrt; | ||
223 | unsigned short bplhstop; | ||
224 | unsigned short hhposw; | ||
225 | unsigned short hhposr; | ||
226 | unsigned short beamcon0; | ||
227 | unsigned short hsstrt; | ||
228 | unsigned short vsstrt; | ||
229 | unsigned short hcenter; | ||
230 | unsigned short diwhigh; | ||
231 | unsigned short spare4[11]; | ||
232 | unsigned short fmode; | ||
233 | }; | ||
234 | |||
235 | /* | ||
236 | * DMA register bits | ||
237 | */ | ||
238 | #define DMAF_SETCLR (0x8000) | ||
239 | #define DMAF_AUD0 (0x0001) | ||
240 | #define DMAF_AUD1 (0x0002) | ||
241 | #define DMAF_AUD2 (0x0004) | ||
242 | #define DMAF_AUD3 (0x0008) | ||
243 | #define DMAF_DISK (0x0010) | ||
244 | #define DMAF_SPRITE (0x0020) | ||
245 | #define DMAF_BLITTER (0x0040) | ||
246 | #define DMAF_COPPER (0x0080) | ||
247 | #define DMAF_RASTER (0x0100) | ||
248 | #define DMAF_MASTER (0x0200) | ||
249 | #define DMAF_BLITHOG (0x0400) | ||
250 | #define DMAF_BLTNZERO (0x2000) | ||
251 | #define DMAF_BLTDONE (0x4000) | ||
252 | #define DMAF_ALL (0x01FF) | ||
253 | |||
254 | struct CIA { | ||
255 | unsigned char pra; char pad0[0xff]; | ||
256 | unsigned char prb; char pad1[0xff]; | ||
257 | unsigned char ddra; char pad2[0xff]; | ||
258 | unsigned char ddrb; char pad3[0xff]; | ||
259 | unsigned char talo; char pad4[0xff]; | ||
260 | unsigned char tahi; char pad5[0xff]; | ||
261 | unsigned char tblo; char pad6[0xff]; | ||
262 | unsigned char tbhi; char pad7[0xff]; | ||
263 | unsigned char todlo; char pad8[0xff]; | ||
264 | unsigned char todmid; char pad9[0xff]; | ||
265 | unsigned char todhi; char pada[0x1ff]; | ||
266 | unsigned char sdr; char padb[0xff]; | ||
267 | unsigned char icr; char padc[0xff]; | ||
268 | unsigned char cra; char padd[0xff]; | ||
269 | unsigned char crb; char pade[0xff]; | ||
270 | }; | ||
271 | |||
272 | #define zTwoBase (0x80000000) | ||
273 | #define ZTWO_PADDR(x) (((unsigned long)(x))-zTwoBase) | ||
274 | #define ZTWO_VADDR(x) (((unsigned long)(x))+zTwoBase) | ||
275 | |||
276 | #define CUSTOM_PHYSADDR (0xdff000) | ||
277 | #define custom ((*(volatile struct CUSTOM *)(zTwoBase+CUSTOM_PHYSADDR))) | ||
278 | |||
279 | #define CIAA_PHYSADDR (0xbfe001) | ||
280 | #define CIAB_PHYSADDR (0xbfd000) | ||
281 | #define ciaa ((*(volatile struct CIA *)(zTwoBase + CIAA_PHYSADDR))) | ||
282 | #define ciab ((*(volatile struct CIA *)(zTwoBase + CIAB_PHYSADDR))) | ||
283 | |||
284 | #define CHIP_PHYSADDR (0x000000) | ||
285 | |||
286 | void amiga_chip_init (void); | ||
287 | void *amiga_chip_alloc(unsigned long size, const char *name); | ||
288 | void *amiga_chip_alloc_res(unsigned long size, struct resource *res); | ||
289 | void amiga_chip_free(void *ptr); | ||
290 | unsigned long amiga_chip_avail( void ); /*MILAN*/ | ||
291 | extern volatile unsigned short amiga_audio_min_period; | ||
292 | |||
293 | static inline void amifb_video_off(void) | ||
294 | { | ||
295 | if (amiga_chipset == CS_ECS || amiga_chipset == CS_AGA) { | ||
296 | /* program Denise/Lisa for a higher maximum play rate */ | ||
297 | custom.htotal = 113; /* 31 kHz */ | ||
298 | custom.vtotal = 223; /* 70 Hz */ | ||
299 | custom.beamcon0 = 0x4390; /* HARDDIS, VAR{BEAM,VSY,HSY,CSY}EN */ | ||
300 | /* suspend the monitor */ | ||
301 | custom.hsstrt = custom.hsstop = 116; | ||
302 | custom.vsstrt = custom.vsstop = 226; | ||
303 | amiga_audio_min_period = 57; | ||
304 | } | ||
305 | } | ||
306 | |||
307 | struct tod3000 { | ||
308 | unsigned int :28, second2:4; /* lower digit */ | ||
309 | unsigned int :28, second1:4; /* upper digit */ | ||
310 | unsigned int :28, minute2:4; /* lower digit */ | ||
311 | unsigned int :28, minute1:4; /* upper digit */ | ||
312 | unsigned int :28, hour2:4; /* lower digit */ | ||
313 | unsigned int :28, hour1:4; /* upper digit */ | ||
314 | unsigned int :28, weekday:4; | ||
315 | unsigned int :28, day2:4; /* lower digit */ | ||
316 | unsigned int :28, day1:4; /* upper digit */ | ||
317 | unsigned int :28, month2:4; /* lower digit */ | ||
318 | unsigned int :28, month1:4; /* upper digit */ | ||
319 | unsigned int :28, year2:4; /* lower digit */ | ||
320 | unsigned int :28, year1:4; /* upper digit */ | ||
321 | unsigned int :28, cntrl1:4; /* control-byte 1 */ | ||
322 | unsigned int :28, cntrl2:4; /* control-byte 2 */ | ||
323 | unsigned int :28, cntrl3:4; /* control-byte 3 */ | ||
324 | }; | ||
325 | #define TOD3000_CNTRL1_HOLD 0 | ||
326 | #define TOD3000_CNTRL1_FREE 9 | ||
327 | #define tod_3000 ((*(volatile struct tod3000 *)(zTwoBase+0xDC0000))) | ||
328 | |||
329 | struct tod2000 { | ||
330 | unsigned int :28, second2:4; /* lower digit */ | ||
331 | unsigned int :28, second1:4; /* upper digit */ | ||
332 | unsigned int :28, minute2:4; /* lower digit */ | ||
333 | unsigned int :28, minute1:4; /* upper digit */ | ||
334 | unsigned int :28, hour2:4; /* lower digit */ | ||
335 | unsigned int :28, hour1:4; /* upper digit */ | ||
336 | unsigned int :28, day2:4; /* lower digit */ | ||
337 | unsigned int :28, day1:4; /* upper digit */ | ||
338 | unsigned int :28, month2:4; /* lower digit */ | ||
339 | unsigned int :28, month1:4; /* upper digit */ | ||
340 | unsigned int :28, year2:4; /* lower digit */ | ||
341 | unsigned int :28, year1:4; /* upper digit */ | ||
342 | unsigned int :28, weekday:4; | ||
343 | unsigned int :28, cntrl1:4; /* control-byte 1 */ | ||
344 | unsigned int :28, cntrl2:4; /* control-byte 2 */ | ||
345 | unsigned int :28, cntrl3:4; /* control-byte 3 */ | ||
346 | }; | ||
347 | |||
348 | #define TOD2000_CNTRL1_HOLD (1<<0) | ||
349 | #define TOD2000_CNTRL1_BUSY (1<<1) | ||
350 | #define TOD2000_CNTRL3_24HMODE (1<<2) | ||
351 | #define TOD2000_HOUR1_PM (1<<2) | ||
352 | #define tod_2000 ((*(volatile struct tod2000 *)(zTwoBase+0xDC0000))) | ||
353 | |||
354 | #endif /* _M68K_AMIGAHW_H */ | ||
diff --git a/include/asm-m68k/amigaints.h b/include/asm-m68k/amigaints.h new file mode 100644 index 000000000000..2aff4cfbf7b3 --- /dev/null +++ b/include/asm-m68k/amigaints.h | |||
@@ -0,0 +1,133 @@ | |||
1 | /* | ||
2 | ** amigaints.h -- Amiga Linux interrupt handling structs and prototypes | ||
3 | ** | ||
4 | ** Copyright 1992 by Greg Harp | ||
5 | ** | ||
6 | ** This file is subject to the terms and conditions of the GNU General Public | ||
7 | ** License. See the file COPYING in the main directory of this archive | ||
8 | ** for more details. | ||
9 | ** | ||
10 | ** Created 10/2/92 by Greg Harp | ||
11 | */ | ||
12 | |||
13 | #ifndef _ASMm68k_AMIGAINTS_H_ | ||
14 | #define _ASMm68k_AMIGAINTS_H_ | ||
15 | |||
16 | /* | ||
17 | ** Amiga Interrupt sources. | ||
18 | ** | ||
19 | */ | ||
20 | |||
21 | #define AUTO_IRQS (8) | ||
22 | #define AMI_STD_IRQS (14) | ||
23 | #define CIA_IRQS (5) | ||
24 | #define AMI_IRQS (32) /* AUTO_IRQS+AMI_STD_IRQS+2*CIA_IRQS */ | ||
25 | |||
26 | /* vertical blanking interrupt */ | ||
27 | #define IRQ_AMIGA_VERTB 0 | ||
28 | |||
29 | /* copper interrupt */ | ||
30 | #define IRQ_AMIGA_COPPER 1 | ||
31 | |||
32 | /* Audio interrupts */ | ||
33 | #define IRQ_AMIGA_AUD0 2 | ||
34 | #define IRQ_AMIGA_AUD1 3 | ||
35 | #define IRQ_AMIGA_AUD2 4 | ||
36 | #define IRQ_AMIGA_AUD3 5 | ||
37 | |||
38 | /* Blitter done interrupt */ | ||
39 | #define IRQ_AMIGA_BLIT 6 | ||
40 | |||
41 | /* floppy disk interrupts */ | ||
42 | #define IRQ_AMIGA_DSKSYN 7 | ||
43 | #define IRQ_AMIGA_DSKBLK 8 | ||
44 | |||
45 | /* builtin serial port interrupts */ | ||
46 | #define IRQ_AMIGA_RBF 9 | ||
47 | #define IRQ_AMIGA_TBE 10 | ||
48 | |||
49 | /* software interrupts */ | ||
50 | #define IRQ_AMIGA_SOFT 11 | ||
51 | |||
52 | /* interrupts from external hardware */ | ||
53 | #define IRQ_AMIGA_PORTS 12 | ||
54 | #define IRQ_AMIGA_EXTER 13 | ||
55 | |||
56 | /* CIA interrupt sources */ | ||
57 | #define IRQ_AMIGA_CIAA 14 | ||
58 | #define IRQ_AMIGA_CIAA_TA 14 | ||
59 | #define IRQ_AMIGA_CIAA_TB 15 | ||
60 | #define IRQ_AMIGA_CIAA_ALRM 16 | ||
61 | #define IRQ_AMIGA_CIAA_SP 17 | ||
62 | #define IRQ_AMIGA_CIAA_FLG 18 | ||
63 | #define IRQ_AMIGA_CIAB 19 | ||
64 | #define IRQ_AMIGA_CIAB_TA 19 | ||
65 | #define IRQ_AMIGA_CIAB_TB 20 | ||
66 | #define IRQ_AMIGA_CIAB_ALRM 21 | ||
67 | #define IRQ_AMIGA_CIAB_SP 22 | ||
68 | #define IRQ_AMIGA_CIAB_FLG 23 | ||
69 | |||
70 | /* auto-vector interrupts */ | ||
71 | #define IRQ_AMIGA_AUTO 24 | ||
72 | #define IRQ_AMIGA_AUTO_0 24 /* This is just a dummy */ | ||
73 | #define IRQ_AMIGA_AUTO_1 25 | ||
74 | #define IRQ_AMIGA_AUTO_2 26 | ||
75 | #define IRQ_AMIGA_AUTO_3 27 | ||
76 | #define IRQ_AMIGA_AUTO_4 28 | ||
77 | #define IRQ_AMIGA_AUTO_5 29 | ||
78 | #define IRQ_AMIGA_AUTO_6 30 | ||
79 | #define IRQ_AMIGA_AUTO_7 31 | ||
80 | |||
81 | #define IRQ_FLOPPY IRQ_AMIGA_DSKBLK | ||
82 | |||
83 | /* INTREQR masks */ | ||
84 | #define IRQ1_MASK 0x0007 /* INTREQR mask for IRQ 1 */ | ||
85 | #define IRQ2_MASK 0x0008 /* INTREQR mask for IRQ 2 */ | ||
86 | #define IRQ3_MASK 0x0070 /* INTREQR mask for IRQ 3 */ | ||
87 | #define IRQ4_MASK 0x0780 /* INTREQR mask for IRQ 4 */ | ||
88 | #define IRQ5_MASK 0x1800 /* INTREQR mask for IRQ 5 */ | ||
89 | #define IRQ6_MASK 0x2000 /* INTREQR mask for IRQ 6 */ | ||
90 | #define IRQ7_MASK 0x4000 /* INTREQR mask for IRQ 7 */ | ||
91 | |||
92 | #define IF_SETCLR 0x8000 /* set/clr bit */ | ||
93 | #define IF_INTEN 0x4000 /* master interrupt bit in INT* registers */ | ||
94 | #define IF_EXTER 0x2000 /* external level 6 and CIA B interrupt */ | ||
95 | #define IF_DSKSYN 0x1000 /* disk sync interrupt */ | ||
96 | #define IF_RBF 0x0800 /* serial receive buffer full interrupt */ | ||
97 | #define IF_AUD3 0x0400 /* audio channel 3 done interrupt */ | ||
98 | #define IF_AUD2 0x0200 /* audio channel 2 done interrupt */ | ||
99 | #define IF_AUD1 0x0100 /* audio channel 1 done interrupt */ | ||
100 | #define IF_AUD0 0x0080 /* audio channel 0 done interrupt */ | ||
101 | #define IF_BLIT 0x0040 /* blitter done interrupt */ | ||
102 | #define IF_VERTB 0x0020 /* vertical blanking interrupt */ | ||
103 | #define IF_COPER 0x0010 /* copper interrupt */ | ||
104 | #define IF_PORTS 0x0008 /* external level 2 and CIA A interrupt */ | ||
105 | #define IF_SOFT 0x0004 /* software initiated interrupt */ | ||
106 | #define IF_DSKBLK 0x0002 /* diskblock DMA finished */ | ||
107 | #define IF_TBE 0x0001 /* serial transmit buffer empty interrupt */ | ||
108 | |||
109 | extern void amiga_do_irq(int irq, struct pt_regs *fp); | ||
110 | extern void amiga_do_irq_list(int irq, struct pt_regs *fp); | ||
111 | |||
112 | extern unsigned short amiga_intena_vals[]; | ||
113 | |||
114 | /* CIA interrupt control register bits */ | ||
115 | |||
116 | #define CIA_ICR_TA 0x01 | ||
117 | #define CIA_ICR_TB 0x02 | ||
118 | #define CIA_ICR_ALRM 0x04 | ||
119 | #define CIA_ICR_SP 0x08 | ||
120 | #define CIA_ICR_FLG 0x10 | ||
121 | #define CIA_ICR_ALL 0x1f | ||
122 | #define CIA_ICR_SETCLR 0x80 | ||
123 | |||
124 | /* to access the interrupt control registers of CIA's use only | ||
125 | ** these functions, they behave exactly like the amiga os routines | ||
126 | */ | ||
127 | |||
128 | extern struct ciabase ciaa_base, ciab_base; | ||
129 | |||
130 | extern unsigned char cia_set_irq(struct ciabase *base, unsigned char mask); | ||
131 | extern unsigned char cia_able_irq(struct ciabase *base, unsigned char mask); | ||
132 | |||
133 | #endif /* asm-m68k/amigaints.h */ | ||
diff --git a/include/asm-m68k/amigayle.h b/include/asm-m68k/amigayle.h new file mode 100644 index 000000000000..bb5a6aa329f3 --- /dev/null +++ b/include/asm-m68k/amigayle.h | |||
@@ -0,0 +1,107 @@ | |||
1 | /* | ||
2 | ** asm-m68k/amigayle.h -- This header defines the registers of the gayle chip | ||
3 | ** found on the Amiga 1200 | ||
4 | ** This information was found by disassembling card.resource, | ||
5 | ** so the definitions may not be 100% correct | ||
6 | ** anyone has an official doc ? | ||
7 | ** | ||
8 | ** Copyright 1997 by Alain Malek | ||
9 | ** | ||
10 | ** This file is subject to the terms and conditions of the GNU General Public | ||
11 | ** License. See the file COPYING in the main directory of this archive | ||
12 | ** for more details. | ||
13 | ** | ||
14 | ** Created: 11/28/97 by Alain Malek | ||
15 | */ | ||
16 | |||
17 | #ifndef _M68K_AMIGAYLE_H_ | ||
18 | #define _M68K_AMIGAYLE_H_ | ||
19 | |||
20 | #include <linux/types.h> | ||
21 | #include <asm/amigahw.h> | ||
22 | |||
23 | /* memory layout */ | ||
24 | |||
25 | #define GAYLE_RAM (0x600000+zTwoBase) | ||
26 | #define GAYLE_RAMSIZE (0x400000) | ||
27 | #define GAYLE_ATTRIBUTE (0xa00000+zTwoBase) | ||
28 | #define GAYLE_ATTRIBUTESIZE (0x020000) | ||
29 | #define GAYLE_IO (0xa20000+zTwoBase) /* 16bit and even 8bit registers */ | ||
30 | #define GAYLE_IOSIZE (0x010000) | ||
31 | #define GAYLE_IO_8BITODD (0xa30000+zTwoBase) /* odd 8bit registers */ | ||
32 | |||
33 | /* offset for accessing odd IO registers */ | ||
34 | #define GAYLE_ODD (GAYLE_IO_8BITODD-GAYLE_IO-1) | ||
35 | |||
36 | /* GAYLE registers */ | ||
37 | |||
38 | struct GAYLE { | ||
39 | u_char cardstatus; | ||
40 | u_char pad0[0x1000-1]; | ||
41 | |||
42 | u_char intreq; | ||
43 | u_char pad1[0x1000-1]; | ||
44 | |||
45 | u_char inten; | ||
46 | u_char pad2[0x1000-1]; | ||
47 | |||
48 | u_char config; | ||
49 | u_char pad3[0x1000-1]; | ||
50 | }; | ||
51 | |||
52 | #define GAYLE_ADDRESS (0xda8000) /* gayle main registers base address */ | ||
53 | |||
54 | #define GAYLE_RESET (0xa40000) /* write 0x00 to start reset, | ||
55 | read 1 byte to stop reset */ | ||
56 | |||
57 | #define gayle (*(volatile struct GAYLE *)(zTwoBase+GAYLE_ADDRESS)) | ||
58 | #define gayle_reset (*(volatile u_char *)(zTwoBase+GAYLE_RESET)) | ||
59 | |||
60 | #define gayle_attribute ((volatile u_char *)(GAYLE_ATTRIBUTE)) | ||
61 | |||
62 | #if 0 | ||
63 | #define gayle_inb(a) readb( GAYLE_IO+(a)+(((a)&1)*GAYLE_ODD) ) | ||
64 | #define gayle_outb(v,a) writeb( v, GAYLE_IO+(a)+(((a)&1)*GAYLE_ODD) ) | ||
65 | |||
66 | #define gayle_inw(a) readw( GAYLE_IO+(a) ) | ||
67 | #define gayle_outw(v,a) writew( v, GAYLE_IO+(a) ) | ||
68 | #endif | ||
69 | |||
70 | /* GAYLE_CARDSTATUS bit def */ | ||
71 | |||
72 | #define GAYLE_CS_CCDET 0x40 /* credit card detect */ | ||
73 | #define GAYLE_CS_BVD1 0x20 /* battery voltage detect 1 */ | ||
74 | #define GAYLE_CS_SC 0x20 /* credit card status change */ | ||
75 | #define GAYLE_CS_BVD2 0x10 /* battery voltage detect 2 */ | ||
76 | #define GAYLE_CS_DA 0x10 /* digital audio */ | ||
77 | #define GAYLE_CS_WR 0x08 /* write enable (1 == enabled) */ | ||
78 | #define GAYLE_CS_BSY 0x04 /* credit card busy */ | ||
79 | #define GAYLE_CS_IRQ 0x04 /* interrupt request */ | ||
80 | |||
81 | /* GAYLE_IRQ bit def */ | ||
82 | |||
83 | #define GAYLE_IRQ_IDE 0x80 | ||
84 | #define GAYLE_IRQ_CCDET 0x40 | ||
85 | #define GAYLE_IRQ_BVD1 0x20 | ||
86 | #define GAYLE_IRQ_SC 0x20 | ||
87 | #define GAYLE_IRQ_BVD2 0x10 | ||
88 | #define GAYLE_IRQ_DA 0x10 | ||
89 | #define GAYLE_IRQ_WR 0x08 | ||
90 | #define GAYLE_IRQ_BSY 0x04 | ||
91 | #define GAYLE_IRQ_IRQ 0x04 | ||
92 | #define GAYLE_IRQ_IDEACK1 0x02 | ||
93 | #define GAYLE_IRQ_IDEACK0 0x01 | ||
94 | |||
95 | /* GAYLE_CONFIG bit def | ||
96 | (bit 0-1 for program voltage, bit 2-3 for access speed */ | ||
97 | |||
98 | #define GAYLE_CFG_0V 0x00 | ||
99 | #define GAYLE_CFG_5V 0x01 | ||
100 | #define GAYLE_CFG_12V 0x02 | ||
101 | |||
102 | #define GAYLE_CFG_100NS 0x08 | ||
103 | #define GAYLE_CFG_150NS 0x04 | ||
104 | #define GAYLE_CFG_250NS 0x00 | ||
105 | #define GAYLE_CFG_720NS 0x0c | ||
106 | |||
107 | #endif /* asm-m68k/amigayle.h */ | ||
diff --git a/include/asm-m68k/amipcmcia.h b/include/asm-m68k/amipcmcia.h new file mode 100644 index 000000000000..6f1ec1887d82 --- /dev/null +++ b/include/asm-m68k/amipcmcia.h | |||
@@ -0,0 +1,110 @@ | |||
1 | /* | ||
2 | ** asm-m68k/pcmcia.h -- Amiga Linux PCMCIA Definitions | ||
3 | ** | ||
4 | ** Copyright 1997 by Alain Malek | ||
5 | ** | ||
6 | ** This file is subject to the terms and conditions of the GNU General Public | ||
7 | ** License. See the file COPYING in the main directory of this archive | ||
8 | ** for more details. | ||
9 | ** | ||
10 | ** Created: 12/10/97 by Alain Malek | ||
11 | */ | ||
12 | |||
13 | #ifndef __AMIGA_PCMCIA_H__ | ||
14 | #define __AMIGA_PCMCIA_H__ | ||
15 | |||
16 | #include <asm/amigayle.h> | ||
17 | |||
18 | /* prototypes */ | ||
19 | |||
20 | void pcmcia_reset(void); | ||
21 | int pcmcia_copy_tuple(unsigned char tuple_id, void *tuple, int max_len); | ||
22 | void pcmcia_program_voltage(int voltage); | ||
23 | void pcmcia_access_speed(int speed); | ||
24 | void pcmcia_write_enable(void); | ||
25 | void pcmcia_write_disable(void); | ||
26 | |||
27 | static inline u_char pcmcia_read_status(void) | ||
28 | { | ||
29 | return (gayle.cardstatus & 0x7c); | ||
30 | } | ||
31 | |||
32 | static inline u_char pcmcia_get_intreq(void) | ||
33 | { | ||
34 | return (gayle.intreq); | ||
35 | } | ||
36 | |||
37 | static inline void pcmcia_ack_int(u_char intreq) | ||
38 | { | ||
39 | gayle.intreq = 0xf8; | ||
40 | } | ||
41 | |||
42 | static inline void pcmcia_enable_irq(void) | ||
43 | { | ||
44 | gayle.inten |= GAYLE_IRQ_IRQ; | ||
45 | } | ||
46 | |||
47 | static inline void pcmcia_disable_irq(void) | ||
48 | { | ||
49 | gayle.inten &= ~GAYLE_IRQ_IRQ; | ||
50 | } | ||
51 | |||
52 | #define PCMCIA_INSERTED (gayle.cardstatus & GAYLE_CS_CCDET) | ||
53 | |||
54 | /* valid voltages for pcmcia_ProgramVoltage */ | ||
55 | |||
56 | #define PCMCIA_0V 0 | ||
57 | #define PCMCIA_5V 5 | ||
58 | #define PCMCIA_12V 12 | ||
59 | |||
60 | /* valid speeds for pcmcia_AccessSpeed */ | ||
61 | |||
62 | #define PCMCIA_SPEED_100NS 100 | ||
63 | #define PCMCIA_SPEED_150NS 150 | ||
64 | #define PCMCIA_SPEED_250NS 250 | ||
65 | #define PCMCIA_SPEED_720NS 720 | ||
66 | |||
67 | /* PCMCIA Tuple codes */ | ||
68 | |||
69 | #define CISTPL_NULL 0x00 | ||
70 | #define CISTPL_DEVICE 0x01 | ||
71 | #define CISTPL_LONGLINK_CB 0x02 | ||
72 | #define CISTPL_CONFIG_CB 0x04 | ||
73 | #define CISTPL_CFTABLE_ENTRY_CB 0x05 | ||
74 | #define CISTPL_LONGLINK_MFC 0x06 | ||
75 | #define CISTPL_BAR 0x07 | ||
76 | #define CISTPL_CHECKSUM 0x10 | ||
77 | #define CISTPL_LONGLINK_A 0x11 | ||
78 | #define CISTPL_LONGLINK_C 0x12 | ||
79 | #define CISTPL_LINKTARGET 0x13 | ||
80 | #define CISTPL_NO_LINK 0x14 | ||
81 | #define CISTPL_VERS_1 0x15 | ||
82 | #define CISTPL_ALTSTR 0x16 | ||
83 | #define CISTPL_DEVICE_A 0x17 | ||
84 | #define CISTPL_JEDEC_C 0x18 | ||
85 | #define CISTPL_JEDEC_A 0x19 | ||
86 | #define CISTPL_CONFIG 0x1a | ||
87 | #define CISTPL_CFTABLE_ENTRY 0x1b | ||
88 | #define CISTPL_DEVICE_OC 0x1c | ||
89 | #define CISTPL_DEVICE_OA 0x1d | ||
90 | #define CISTPL_DEVICE_GEO 0x1e | ||
91 | #define CISTPL_DEVICE_GEO_A 0x1f | ||
92 | #define CISTPL_MANFID 0x20 | ||
93 | #define CISTPL_FUNCID 0x21 | ||
94 | #define CISTPL_FUNCE 0x22 | ||
95 | #define CISTPL_SWIL 0x23 | ||
96 | #define CISTPL_END 0xff | ||
97 | |||
98 | /* FUNCID */ | ||
99 | |||
100 | #define CISTPL_FUNCID_MULTI 0x00 | ||
101 | #define CISTPL_FUNCID_MEMORY 0x01 | ||
102 | #define CISTPL_FUNCID_SERIAL 0x02 | ||
103 | #define CISTPL_FUNCID_PARALLEL 0x03 | ||
104 | #define CISTPL_FUNCID_FIXED 0x04 | ||
105 | #define CISTPL_FUNCID_VIDEO 0x05 | ||
106 | #define CISTPL_FUNCID_NETWORK 0x06 | ||
107 | #define CISTPL_FUNCID_AIMS 0x07 | ||
108 | #define CISTPL_FUNCID_SCSI 0x08 | ||
109 | |||
110 | #endif | ||
diff --git a/include/asm-m68k/apollodma.h b/include/asm-m68k/apollodma.h new file mode 100644 index 000000000000..6821e3ba32e9 --- /dev/null +++ b/include/asm-m68k/apollodma.h | |||
@@ -0,0 +1,248 @@ | |||
1 | /* $Id: dma.h,v 1.7 1992/12/14 00:29:34 root Exp root $ | ||
2 | * linux/include/asm/dma.h: Defines for using and allocating dma channels. | ||
3 | * Written by Hennus Bergman, 1992. | ||
4 | * High DMA channel support & info by Hannu Savolainen | ||
5 | * and John Boyd, Nov. 1992. | ||
6 | */ | ||
7 | |||
8 | #ifndef _ASM_APOLLO_DMA_H | ||
9 | #define _ASM_APOLLO_DMA_H | ||
10 | |||
11 | #include <asm/apollohw.h> /* need byte IO */ | ||
12 | #include <linux/spinlock.h> /* And spinlocks */ | ||
13 | #include <linux/delay.h> | ||
14 | |||
15 | |||
16 | #define dma_outb(val,addr) (*((volatile unsigned char *)(addr+IO_BASE)) = (val)) | ||
17 | #define dma_inb(addr) (*((volatile unsigned char *)(addr+IO_BASE))) | ||
18 | |||
19 | /* | ||
20 | * NOTES about DMA transfers: | ||
21 | * | ||
22 | * controller 1: channels 0-3, byte operations, ports 00-1F | ||
23 | * controller 2: channels 4-7, word operations, ports C0-DF | ||
24 | * | ||
25 | * - ALL registers are 8 bits only, regardless of transfer size | ||
26 | * - channel 4 is not used - cascades 1 into 2. | ||
27 | * - channels 0-3 are byte - addresses/counts are for physical bytes | ||
28 | * - channels 5-7 are word - addresses/counts are for physical words | ||
29 | * - transfers must not cross physical 64K (0-3) or 128K (5-7) boundaries | ||
30 | * - transfer count loaded to registers is 1 less than actual count | ||
31 | * - controller 2 offsets are all even (2x offsets for controller 1) | ||
32 | * - page registers for 5-7 don't use data bit 0, represent 128K pages | ||
33 | * - page registers for 0-3 use bit 0, represent 64K pages | ||
34 | * | ||
35 | * DMA transfers are limited to the lower 16MB of _physical_ memory. | ||
36 | * Note that addresses loaded into registers must be _physical_ addresses, | ||
37 | * not logical addresses (which may differ if paging is active). | ||
38 | * | ||
39 | * Address mapping for channels 0-3: | ||
40 | * | ||
41 | * A23 ... A16 A15 ... A8 A7 ... A0 (Physical addresses) | ||
42 | * | ... | | ... | | ... | | ||
43 | * | ... | | ... | | ... | | ||
44 | * | ... | | ... | | ... | | ||
45 | * P7 ... P0 A7 ... A0 A7 ... A0 | ||
46 | * | Page | Addr MSB | Addr LSB | (DMA registers) | ||
47 | * | ||
48 | * Address mapping for channels 5-7: | ||
49 | * | ||
50 | * A23 ... A17 A16 A15 ... A9 A8 A7 ... A1 A0 (Physical addresses) | ||
51 | * | ... | \ \ ... \ \ \ ... \ \ | ||
52 | * | ... | \ \ ... \ \ \ ... \ (not used) | ||
53 | * | ... | \ \ ... \ \ \ ... \ | ||
54 | * P7 ... P1 (0) A7 A6 ... A0 A7 A6 ... A0 | ||
55 | * | Page | Addr MSB | Addr LSB | (DMA registers) | ||
56 | * | ||
57 | * Again, channels 5-7 transfer _physical_ words (16 bits), so addresses | ||
58 | * and counts _must_ be word-aligned (the lowest address bit is _ignored_ at | ||
59 | * the hardware level, so odd-byte transfers aren't possible). | ||
60 | * | ||
61 | * Transfer count (_not # bytes_) is limited to 64K, represented as actual | ||
62 | * count - 1 : 64K => 0xFFFF, 1 => 0x0000. Thus, count is always 1 or more, | ||
63 | * and up to 128K bytes may be transferred on channels 5-7 in one operation. | ||
64 | * | ||
65 | */ | ||
66 | |||
67 | #define MAX_DMA_CHANNELS 8 | ||
68 | |||
69 | /* The maximum address that we can perform a DMA transfer to on this platform */#define MAX_DMA_ADDRESS (PAGE_OFFSET+0x1000000) | ||
70 | |||
71 | /* 8237 DMA controllers */ | ||
72 | #define IO_DMA1_BASE 0x10C00 /* 8 bit slave DMA, channels 0..3 */ | ||
73 | #define IO_DMA2_BASE 0x10D00 /* 16 bit master DMA, ch 4(=slave input)..7 */ | ||
74 | |||
75 | /* DMA controller registers */ | ||
76 | #define DMA1_CMD_REG (IO_DMA1_BASE+0x08) /* command register (w) */ | ||
77 | #define DMA1_STAT_REG (IO_DMA1_BASE+0x08) /* status register (r) */ | ||
78 | #define DMA1_REQ_REG (IO_DMA1_BASE+0x09) /* request register (w) */ | ||
79 | #define DMA1_MASK_REG (IO_DMA1_BASE+0x0A) /* single-channel mask (w) */ | ||
80 | #define DMA1_MODE_REG (IO_DMA1_BASE+0x0B) /* mode register (w) */ | ||
81 | #define DMA1_CLEAR_FF_REG (IO_DMA1_BASE+0x0C) /* clear pointer flip-flop (w) */ | ||
82 | #define DMA1_TEMP_REG (IO_DMA1_BASE+0x0D) /* Temporary Register (r) */ | ||
83 | #define DMA1_RESET_REG (IO_DMA1_BASE+0x0D) /* Master Clear (w) */ | ||
84 | #define DMA1_CLR_MASK_REG (IO_DMA1_BASE+0x0E) /* Clear Mask */ | ||
85 | #define DMA1_MASK_ALL_REG (IO_DMA1_BASE+0x0F) /* all-channels mask (w) */ | ||
86 | |||
87 | #define DMA2_CMD_REG (IO_DMA2_BASE+0x10) /* command register (w) */ | ||
88 | #define DMA2_STAT_REG (IO_DMA2_BASE+0x10) /* status register (r) */ | ||
89 | #define DMA2_REQ_REG (IO_DMA2_BASE+0x12) /* request register (w) */ | ||
90 | #define DMA2_MASK_REG (IO_DMA2_BASE+0x14) /* single-channel mask (w) */ | ||
91 | #define DMA2_MODE_REG (IO_DMA2_BASE+0x16) /* mode register (w) */ | ||
92 | #define DMA2_CLEAR_FF_REG (IO_DMA2_BASE+0x18) /* clear pointer flip-flop (w) */ | ||
93 | #define DMA2_TEMP_REG (IO_DMA2_BASE+0x1A) /* Temporary Register (r) */ | ||
94 | #define DMA2_RESET_REG (IO_DMA2_BASE+0x1A) /* Master Clear (w) */ | ||
95 | #define DMA2_CLR_MASK_REG (IO_DMA2_BASE+0x1C) /* Clear Mask */ | ||
96 | #define DMA2_MASK_ALL_REG (IO_DMA2_BASE+0x1E) /* all-channels mask (w) */ | ||
97 | |||
98 | #define DMA_ADDR_0 (IO_DMA1_BASE+0x00) /* DMA address registers */ | ||
99 | #define DMA_ADDR_1 (IO_DMA1_BASE+0x02) | ||
100 | #define DMA_ADDR_2 (IO_DMA1_BASE+0x04) | ||
101 | #define DMA_ADDR_3 (IO_DMA1_BASE+0x06) | ||
102 | #define DMA_ADDR_4 (IO_DMA2_BASE+0x00) | ||
103 | #define DMA_ADDR_5 (IO_DMA2_BASE+0x04) | ||
104 | #define DMA_ADDR_6 (IO_DMA2_BASE+0x08) | ||
105 | #define DMA_ADDR_7 (IO_DMA2_BASE+0x0C) | ||
106 | |||
107 | #define DMA_CNT_0 (IO_DMA1_BASE+0x01) /* DMA count registers */ | ||
108 | #define DMA_CNT_1 (IO_DMA1_BASE+0x03) | ||
109 | #define DMA_CNT_2 (IO_DMA1_BASE+0x05) | ||
110 | #define DMA_CNT_3 (IO_DMA1_BASE+0x07) | ||
111 | #define DMA_CNT_4 (IO_DMA2_BASE+0x02) | ||
112 | #define DMA_CNT_5 (IO_DMA2_BASE+0x06) | ||
113 | #define DMA_CNT_6 (IO_DMA2_BASE+0x0A) | ||
114 | #define DMA_CNT_7 (IO_DMA2_BASE+0x0E) | ||
115 | |||
116 | #define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */ | ||
117 | #define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */ | ||
118 | #define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */ | ||
119 | |||
120 | #define DMA_AUTOINIT 0x10 | ||
121 | |||
122 | #define DMA_8BIT 0 | ||
123 | #define DMA_16BIT 1 | ||
124 | #define DMA_BUSMASTER 2 | ||
125 | |||
126 | extern spinlock_t dma_spin_lock; | ||
127 | |||
128 | static __inline__ unsigned long claim_dma_lock(void) | ||
129 | { | ||
130 | unsigned long flags; | ||
131 | spin_lock_irqsave(&dma_spin_lock, flags); | ||
132 | return flags; | ||
133 | } | ||
134 | |||
135 | static __inline__ void release_dma_lock(unsigned long flags) | ||
136 | { | ||
137 | spin_unlock_irqrestore(&dma_spin_lock, flags); | ||
138 | } | ||
139 | |||
140 | /* enable/disable a specific DMA channel */ | ||
141 | static __inline__ void enable_dma(unsigned int dmanr) | ||
142 | { | ||
143 | if (dmanr<=3) | ||
144 | dma_outb(dmanr, DMA1_MASK_REG); | ||
145 | else | ||
146 | dma_outb(dmanr & 3, DMA2_MASK_REG); | ||
147 | } | ||
148 | |||
149 | static __inline__ void disable_dma(unsigned int dmanr) | ||
150 | { | ||
151 | if (dmanr<=3) | ||
152 | dma_outb(dmanr | 4, DMA1_MASK_REG); | ||
153 | else | ||
154 | dma_outb((dmanr & 3) | 4, DMA2_MASK_REG); | ||
155 | } | ||
156 | |||
157 | /* Clear the 'DMA Pointer Flip Flop'. | ||
158 | * Write 0 for LSB/MSB, 1 for MSB/LSB access. | ||
159 | * Use this once to initialize the FF to a known state. | ||
160 | * After that, keep track of it. :-) | ||
161 | * --- In order to do that, the DMA routines below should --- | ||
162 | * --- only be used while holding the DMA lock ! --- | ||
163 | */ | ||
164 | static __inline__ void clear_dma_ff(unsigned int dmanr) | ||
165 | { | ||
166 | if (dmanr<=3) | ||
167 | dma_outb(0, DMA1_CLEAR_FF_REG); | ||
168 | else | ||
169 | dma_outb(0, DMA2_CLEAR_FF_REG); | ||
170 | } | ||
171 | |||
172 | /* set mode (above) for a specific DMA channel */ | ||
173 | static __inline__ void set_dma_mode(unsigned int dmanr, char mode) | ||
174 | { | ||
175 | if (dmanr<=3) | ||
176 | dma_outb(mode | dmanr, DMA1_MODE_REG); | ||
177 | else | ||
178 | dma_outb(mode | (dmanr&3), DMA2_MODE_REG); | ||
179 | } | ||
180 | |||
181 | /* Set transfer address & page bits for specific DMA channel. | ||
182 | * Assumes dma flipflop is clear. | ||
183 | */ | ||
184 | static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a) | ||
185 | { | ||
186 | if (dmanr <= 3) { | ||
187 | dma_outb( a & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE ); | ||
188 | dma_outb( (a>>8) & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE ); | ||
189 | } else { | ||
190 | dma_outb( (a>>1) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE ); | ||
191 | dma_outb( (a>>9) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE ); | ||
192 | } | ||
193 | } | ||
194 | |||
195 | |||
196 | /* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for | ||
197 | * a specific DMA channel. | ||
198 | * You must ensure the parameters are valid. | ||
199 | * NOTE: from a manual: "the number of transfers is one more | ||
200 | * than the initial word count"! This is taken into account. | ||
201 | * Assumes dma flip-flop is clear. | ||
202 | * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7. | ||
203 | */ | ||
204 | static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count) | ||
205 | { | ||
206 | count--; | ||
207 | if (dmanr <= 3) { | ||
208 | dma_outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); | ||
209 | dma_outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); | ||
210 | } else { | ||
211 | dma_outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); | ||
212 | dma_outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); | ||
213 | } | ||
214 | } | ||
215 | |||
216 | |||
217 | /* Get DMA residue count. After a DMA transfer, this | ||
218 | * should return zero. Reading this while a DMA transfer is | ||
219 | * still in progress will return unpredictable results. | ||
220 | * If called before the channel has been used, it may return 1. | ||
221 | * Otherwise, it returns the number of _bytes_ left to transfer. | ||
222 | * | ||
223 | * Assumes DMA flip-flop is clear. | ||
224 | */ | ||
225 | static __inline__ int get_dma_residue(unsigned int dmanr) | ||
226 | { | ||
227 | unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE | ||
228 | : ((dmanr&3)<<2) + 2 + IO_DMA2_BASE; | ||
229 | |||
230 | /* using short to get 16-bit wrap around */ | ||
231 | unsigned short count; | ||
232 | |||
233 | count = 1 + dma_inb(io_port); | ||
234 | count += dma_inb(io_port) << 8; | ||
235 | |||
236 | return (dmanr<=3)? count : (count<<1); | ||
237 | } | ||
238 | |||
239 | |||
240 | /* These are in kernel/dma.c: */ | ||
241 | extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */ | ||
242 | extern void free_dma(unsigned int dmanr); /* release it again */ | ||
243 | |||
244 | /* These are in arch/m68k/apollo/dma.c: */ | ||
245 | extern unsigned short dma_map_page(unsigned long phys_addr,int count,int type); | ||
246 | extern void dma_unmap_page(unsigned short dma_addr); | ||
247 | |||
248 | #endif /* _ASM_APOLLO_DMA_H */ | ||
diff --git a/include/asm-m68k/apollohw.h b/include/asm-m68k/apollohw.h new file mode 100644 index 000000000000..4304e1c33e17 --- /dev/null +++ b/include/asm-m68k/apollohw.h | |||
@@ -0,0 +1,104 @@ | |||
1 | /* apollohw.h : some structures to access apollo HW */ | ||
2 | |||
3 | #ifndef _ASMm68k_APOLLOHW_H_ | ||
4 | #define _ASMm68k_APOLLOHW_H_ | ||
5 | |||
6 | /* | ||
7 | apollo models | ||
8 | */ | ||
9 | |||
10 | extern u_long apollo_model; | ||
11 | |||
12 | #define APOLLO_UNKNOWN (0) | ||
13 | #define APOLLO_DN3000 (1) | ||
14 | #define APOLLO_DN3010 (2) | ||
15 | #define APOLLO_DN3500 (3) | ||
16 | #define APOLLO_DN4000 (4) | ||
17 | #define APOLLO_DN4500 (5) | ||
18 | |||
19 | /* | ||
20 | see scn2681 data sheet for more info. | ||
21 | member names are read_write. | ||
22 | */ | ||
23 | |||
24 | #define DECLARE_2681_FIELD(x) unsigned char x; unsigned char dummy##x | ||
25 | |||
26 | struct SCN2681 { | ||
27 | |||
28 | DECLARE_2681_FIELD(mra); | ||
29 | DECLARE_2681_FIELD(sra_csra); | ||
30 | DECLARE_2681_FIELD(BRGtest_cra); | ||
31 | DECLARE_2681_FIELD(rhra_thra); | ||
32 | DECLARE_2681_FIELD(ipcr_acr); | ||
33 | DECLARE_2681_FIELD(isr_imr); | ||
34 | DECLARE_2681_FIELD(ctu_ctur); | ||
35 | DECLARE_2681_FIELD(ctl_ctlr); | ||
36 | DECLARE_2681_FIELD(mrb); | ||
37 | DECLARE_2681_FIELD(srb_csrb); | ||
38 | DECLARE_2681_FIELD(tst_crb); | ||
39 | DECLARE_2681_FIELD(rhrb_thrb); | ||
40 | DECLARE_2681_FIELD(reserved); | ||
41 | DECLARE_2681_FIELD(ip_opcr); | ||
42 | DECLARE_2681_FIELD(startCnt_setOutBit); | ||
43 | DECLARE_2681_FIELD(stopCnt_resetOutBit); | ||
44 | |||
45 | }; | ||
46 | |||
47 | #if 0 | ||
48 | struct mc146818 { | ||
49 | |||
50 | unsigned int second1:4, second2:4, alarm_second1:4, alarm_second2:4, | ||
51 | minute1:4, minute2:4, alarm_minute1:4, alarm_minute2:4; | ||
52 | unsigned int hours1:4, hours2:4, alarm_hours1:4, alarm_hours2:4, | ||
53 | day_of_week1:4, day_of_week2:4, day_of_month1:4, day_of_month2:4; | ||
54 | unsigned int month1:4, month2:4, year1:4, year2:4, :16; | ||
55 | |||
56 | }; | ||
57 | #endif | ||
58 | |||
59 | struct mc146818 { | ||
60 | unsigned char second, alarm_second; | ||
61 | unsigned char minute, alarm_minute; | ||
62 | unsigned char hours, alarm_hours; | ||
63 | unsigned char day_of_week, day_of_month; | ||
64 | unsigned char month, year; | ||
65 | }; | ||
66 | |||
67 | |||
68 | #define IO_BASE 0x80000000 | ||
69 | |||
70 | extern u_long sio01_physaddr; | ||
71 | extern u_long sio23_physaddr; | ||
72 | extern u_long rtc_physaddr; | ||
73 | extern u_long pica_physaddr; | ||
74 | extern u_long picb_physaddr; | ||
75 | extern u_long cpuctrl_physaddr; | ||
76 | extern u_long timer_physaddr; | ||
77 | |||
78 | #define SAU7_SIO01_PHYSADDR 0x10400 | ||
79 | #define SAU7_SIO23_PHYSADDR 0x10500 | ||
80 | #define SAU7_RTC_PHYSADDR 0x10900 | ||
81 | #define SAU7_PICA 0x11000 | ||
82 | #define SAU7_PICB 0x11100 | ||
83 | #define SAU7_CPUCTRL 0x10100 | ||
84 | #define SAU7_TIMER 0x010800 | ||
85 | |||
86 | #define SAU8_SIO01_PHYSADDR 0x8400 | ||
87 | #define SAU8_RTC_PHYSADDR 0x8900 | ||
88 | #define SAU8_PICA 0x9400 | ||
89 | #define SAU8_PICB 0x9500 | ||
90 | #define SAU8_CPUCTRL 0x8100 | ||
91 | #define SAU8_TIMER 0x8800 | ||
92 | |||
93 | #define sio01 ((*(volatile struct SCN2681 *)(IO_BASE + sio01_physaddr))) | ||
94 | #define sio23 ((*(volatile struct SCN2681 *)(IO_BASE + sio23_physaddr))) | ||
95 | #define rtc (((volatile struct mc146818 *)(IO_BASE + rtc_physaddr))) | ||
96 | #define cpuctrl (*(volatile unsigned int *)(IO_BASE + cpuctrl_physaddr)) | ||
97 | #define pica (IO_BASE + pica_physaddr) | ||
98 | #define picb (IO_BASE + picb_physaddr) | ||
99 | #define timer (IO_BASE + timer_physaddr) | ||
100 | #define addr_xlat_map ((unsigned short *)(IO_BASE + 0x17000)) | ||
101 | |||
102 | #define isaIO2mem(x) (((((x) & 0x3f8) << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE) | ||
103 | |||
104 | #endif | ||
diff --git a/include/asm-m68k/atafd.h b/include/asm-m68k/atafd.h new file mode 100644 index 000000000000..8456889ee7da --- /dev/null +++ b/include/asm-m68k/atafd.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef _ASM_M68K_FD_H | ||
2 | #define _ASM_M68K_FD_H | ||
3 | |||
4 | /* Definitions for the Atari Floppy driver */ | ||
5 | |||
6 | struct atari_format_descr { | ||
7 | int track; /* to be formatted */ | ||
8 | int head; /* "" "" */ | ||
9 | int sect_offset; /* offset of first sector */ | ||
10 | }; | ||
11 | |||
12 | #endif | ||
diff --git a/include/asm-m68k/atafdreg.h b/include/asm-m68k/atafdreg.h new file mode 100644 index 000000000000..bbf80949fd9f --- /dev/null +++ b/include/asm-m68k/atafdreg.h | |||
@@ -0,0 +1,79 @@ | |||
1 | #ifndef _LINUX_FDREG_H | ||
2 | #define _LINUX_FDREG_H | ||
3 | |||
4 | /* | ||
5 | ** WD1772 stuff | ||
6 | */ | ||
7 | |||
8 | /* register codes */ | ||
9 | |||
10 | #define FDCSELREG_STP (0x80) /* command/status register */ | ||
11 | #define FDCSELREG_TRA (0x82) /* track register */ | ||
12 | #define FDCSELREG_SEC (0x84) /* sector register */ | ||
13 | #define FDCSELREG_DTA (0x86) /* data register */ | ||
14 | |||
15 | /* register names for FDC_READ/WRITE macros */ | ||
16 | |||
17 | #define FDCREG_CMD 0 | ||
18 | #define FDCREG_STATUS 0 | ||
19 | #define FDCREG_TRACK 2 | ||
20 | #define FDCREG_SECTOR 4 | ||
21 | #define FDCREG_DATA 6 | ||
22 | |||
23 | /* command opcodes */ | ||
24 | |||
25 | #define FDCCMD_RESTORE (0x00) /* - */ | ||
26 | #define FDCCMD_SEEK (0x10) /* | */ | ||
27 | #define FDCCMD_STEP (0x20) /* | TYP 1 Commands */ | ||
28 | #define FDCCMD_STIN (0x40) /* | */ | ||
29 | #define FDCCMD_STOT (0x60) /* - */ | ||
30 | #define FDCCMD_RDSEC (0x80) /* - TYP 2 Commands */ | ||
31 | #define FDCCMD_WRSEC (0xa0) /* - " */ | ||
32 | #define FDCCMD_RDADR (0xc0) /* - */ | ||
33 | #define FDCCMD_RDTRA (0xe0) /* | TYP 3 Commands */ | ||
34 | #define FDCCMD_WRTRA (0xf0) /* - */ | ||
35 | #define FDCCMD_FORCI (0xd0) /* - TYP 4 Command */ | ||
36 | |||
37 | /* command modifier bits */ | ||
38 | |||
39 | #define FDCCMDADD_SR6 (0x00) /* step rate settings */ | ||
40 | #define FDCCMDADD_SR12 (0x01) | ||
41 | #define FDCCMDADD_SR2 (0x02) | ||
42 | #define FDCCMDADD_SR3 (0x03) | ||
43 | #define FDCCMDADD_V (0x04) /* verify */ | ||
44 | #define FDCCMDADD_H (0x08) /* wait for spin-up */ | ||
45 | #define FDCCMDADD_U (0x10) /* update track register */ | ||
46 | #define FDCCMDADD_M (0x10) /* multiple sector access */ | ||
47 | #define FDCCMDADD_E (0x04) /* head settling flag */ | ||
48 | #define FDCCMDADD_P (0x02) /* precompensation off */ | ||
49 | #define FDCCMDADD_A0 (0x01) /* DAM flag */ | ||
50 | |||
51 | /* status register bits */ | ||
52 | |||
53 | #define FDCSTAT_MOTORON (0x80) /* motor on */ | ||
54 | #define FDCSTAT_WPROT (0x40) /* write protected (FDCCMD_WR*) */ | ||
55 | #define FDCSTAT_SPINUP (0x20) /* motor speed stable (Type I) */ | ||
56 | #define FDCSTAT_DELDAM (0x20) /* sector has deleted DAM (Type II+III) */ | ||
57 | #define FDCSTAT_RECNF (0x10) /* record not found */ | ||
58 | #define FDCSTAT_CRC (0x08) /* CRC error */ | ||
59 | #define FDCSTAT_TR00 (0x04) /* Track 00 flag (Type I) */ | ||
60 | #define FDCSTAT_LOST (0x04) /* Lost Data (Type II+III) */ | ||
61 | #define FDCSTAT_IDX (0x02) /* Index status (Type I) */ | ||
62 | #define FDCSTAT_DRQ (0x02) /* DRQ status (Type II+III) */ | ||
63 | #define FDCSTAT_BUSY (0x01) /* FDC is busy */ | ||
64 | |||
65 | |||
66 | /* PSG Port A Bit Nr 0 .. Side Sel .. 0 -> Side 1 1 -> Side 2 */ | ||
67 | #define DSKSIDE (0x01) | ||
68 | |||
69 | #define DSKDRVNONE (0x06) | ||
70 | #define DSKDRV0 (0x02) | ||
71 | #define DSKDRV1 (0x04) | ||
72 | |||
73 | /* step rates */ | ||
74 | #define FDCSTEP_6 0x00 | ||
75 | #define FDCSTEP_12 0x01 | ||
76 | #define FDCSTEP_2 0x02 | ||
77 | #define FDCSTEP_3 0x03 | ||
78 | |||
79 | #endif | ||
diff --git a/include/asm-m68k/atari_SLM.h b/include/asm-m68k/atari_SLM.h new file mode 100644 index 000000000000..42f4fcdd8bc7 --- /dev/null +++ b/include/asm-m68k/atari_SLM.h | |||
@@ -0,0 +1,28 @@ | |||
1 | |||
2 | #ifndef _ATARI_SLM_H | ||
3 | #define _ATARI_SLM_H | ||
4 | |||
5 | /* Atari SLM laser printer specific ioctls */ | ||
6 | |||
7 | #define SLMIOGSTAT 0xa100 | ||
8 | #define SLMIOGPSIZE 0xa101 | ||
9 | #define SLMIOGMFEED 0xa102 | ||
10 | |||
11 | #define SLMIORESET 0xa140 | ||
12 | |||
13 | #define SLMIOSPSIZE 0xa181 | ||
14 | #define SLMIOSMFEED 0xa182 | ||
15 | |||
16 | /* Status returning structure (SLMIOGSTAT) */ | ||
17 | struct SLM_status { | ||
18 | int stat; /* numeric status code */ | ||
19 | char str[40]; /* status string */ | ||
20 | }; | ||
21 | |||
22 | /* Paper size structure (SLMIO[GS]PSIZE) */ | ||
23 | struct SLM_paper_size { | ||
24 | int width; | ||
25 | int height; | ||
26 | }; | ||
27 | |||
28 | #endif /* _ATARI_SLM_H */ | ||
diff --git a/include/asm-m68k/atari_acsi.h b/include/asm-m68k/atari_acsi.h new file mode 100644 index 000000000000..10fea68f191a --- /dev/null +++ b/include/asm-m68k/atari_acsi.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef _ASM_ATARI_ACSI_H | ||
2 | #define _ASM_ATARI_ACSI_H | ||
3 | |||
4 | /* Functions exported by drivers/block/acsi.c */ | ||
5 | |||
6 | void acsi_delay_start( void ); | ||
7 | void acsi_delay_end( long usec ); | ||
8 | int acsi_wait_for_IRQ( unsigned timeout ); | ||
9 | int acsi_wait_for_noIRQ( unsigned timeout ); | ||
10 | int acsicmd_nodma( const char *cmd, int enable); | ||
11 | int acsi_getstatus( void ); | ||
12 | int acsi_extstatus( char *buffer, int cnt ); | ||
13 | void acsi_end_extstatus( void ); | ||
14 | int acsi_extcmd( unsigned char *buffer, int cnt ); | ||
15 | |||
16 | /* The ACSI buffer is guarantueed to reside in ST-RAM and may be used by other | ||
17 | * drivers that work on the ACSI bus, too. It's data are valid only as long as | ||
18 | * the ST-DMA is locked. */ | ||
19 | extern char *acsi_buffer; | ||
20 | extern unsigned long phys_acsi_buffer; | ||
21 | |||
22 | /* Utility macros */ | ||
23 | |||
24 | /* Send one data byte over the bus and set mode for next operation | ||
25 | * with one move.l -- Atari recommends this... | ||
26 | */ | ||
27 | |||
28 | #define DMA_LONG_WRITE(data,mode) \ | ||
29 | do { \ | ||
30 | *((unsigned long *)&dma_wd.fdc_acces_seccount) = \ | ||
31 | ((data)<<16) | (mode); \ | ||
32 | } while(0) | ||
33 | |||
34 | #define ENABLE_IRQ() atari_turnon_irq( IRQ_MFP_ACSI ) | ||
35 | #define DISABLE_IRQ() atari_turnoff_irq( IRQ_MFP_ACSI ) | ||
36 | |||
37 | #endif /* _ASM_ATARI_ACSI_H */ | ||
diff --git a/include/asm-m68k/atari_joystick.h b/include/asm-m68k/atari_joystick.h new file mode 100644 index 000000000000..93be7da9f2c7 --- /dev/null +++ b/include/asm-m68k/atari_joystick.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef _LINUX_ATARI_JOYSTICK_H | ||
2 | #define _LINUX_ATARI_JOYSTICK_H | ||
3 | |||
4 | /* | ||
5 | * linux/include/linux/atari_joystick.h | ||
6 | * header file for Atari Joystick driver | ||
7 | * by Robert de Vries (robert@and.nl) on 19Jul93 | ||
8 | */ | ||
9 | |||
10 | void atari_joystick_interrupt(char*); | ||
11 | int atari_joystick_init(void); | ||
12 | extern int atari_mouse_buttons; | ||
13 | |||
14 | struct joystick_status { | ||
15 | char fire; | ||
16 | char dir; | ||
17 | int ready; | ||
18 | int active; | ||
19 | wait_queue_head_t wait; | ||
20 | }; | ||
21 | |||
22 | #endif | ||
diff --git a/include/asm-m68k/atari_stdma.h b/include/asm-m68k/atari_stdma.h new file mode 100644 index 000000000000..64f92880ce43 --- /dev/null +++ b/include/asm-m68k/atari_stdma.h | |||
@@ -0,0 +1,23 @@ | |||
1 | |||
2 | #ifndef _atari_stdma_h | ||
3 | #define _atari_stdma_h | ||
4 | |||
5 | |||
6 | #include <asm/irq.h> | ||
7 | |||
8 | |||
9 | /***************************** Prototypes *****************************/ | ||
10 | |||
11 | void stdma_lock(irqreturn_t (*handler)(int, void *, struct pt_regs *), | ||
12 | void *data); | ||
13 | void stdma_release( void ); | ||
14 | int stdma_others_waiting( void ); | ||
15 | int stdma_islocked( void ); | ||
16 | void *stdma_locked_by( void ); | ||
17 | void stdma_init( void ); | ||
18 | |||
19 | /************************* End of Prototypes **************************/ | ||
20 | |||
21 | |||
22 | |||
23 | #endif /* _atari_stdma_h */ | ||
diff --git a/include/asm-m68k/atari_stram.h b/include/asm-m68k/atari_stram.h new file mode 100644 index 000000000000..7546d13963be --- /dev/null +++ b/include/asm-m68k/atari_stram.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef _M68K_ATARI_STRAM_H | ||
2 | #define _M68K_ATARI_STRAM_H | ||
3 | |||
4 | /* | ||
5 | * Functions for Atari ST-RAM management | ||
6 | */ | ||
7 | |||
8 | /* public interface */ | ||
9 | void *atari_stram_alloc(long size, const char *owner); | ||
10 | void atari_stram_free(void *); | ||
11 | |||
12 | /* functions called internally by other parts of the kernel */ | ||
13 | void atari_stram_init(void); | ||
14 | void atari_stram_reserve_pages(void *start_mem); | ||
15 | void atari_stram_mem_init_hook (void); | ||
16 | |||
17 | #endif /*_M68K_ATARI_STRAM_H */ | ||
diff --git a/include/asm-m68k/atarihw.h b/include/asm-m68k/atarihw.h new file mode 100644 index 000000000000..f28acd0fd689 --- /dev/null +++ b/include/asm-m68k/atarihw.h | |||
@@ -0,0 +1,808 @@ | |||
1 | /* | ||
2 | ** linux/atarihw.h -- This header defines some macros and pointers for | ||
3 | ** the various Atari custom hardware registers. | ||
4 | ** | ||
5 | ** Copyright 1994 by Bj”rn Brauel | ||
6 | ** | ||
7 | ** 5/1/94 Roman Hodek: | ||
8 | ** Added definitions for TT specific chips. | ||
9 | ** | ||
10 | ** 1996-09-13 lars brinkhoff <f93labr@dd.chalmers.se>: | ||
11 | ** Finally added definitions for the matrix/codec and the DSP56001 host | ||
12 | ** interface. | ||
13 | ** | ||
14 | ** This file is subject to the terms and conditions of the GNU General Public | ||
15 | ** License. See the file COPYING in the main directory of this archive | ||
16 | ** for more details. | ||
17 | ** | ||
18 | */ | ||
19 | |||
20 | #ifndef _LINUX_ATARIHW_H_ | ||
21 | #define _LINUX_ATARIHW_H_ | ||
22 | |||
23 | #include <linux/types.h> | ||
24 | #include <asm/bootinfo.h> | ||
25 | #include <asm/raw_io.h> | ||
26 | |||
27 | extern u_long atari_mch_cookie; | ||
28 | extern u_long atari_mch_type; | ||
29 | extern u_long atari_switches; | ||
30 | extern int atari_rtc_year_offset; | ||
31 | extern int atari_dont_touch_floppy_select; | ||
32 | |||
33 | /* convenience macros for testing machine type */ | ||
34 | #define MACH_IS_ST ((atari_mch_cookie >> 16) == ATARI_MCH_ST) | ||
35 | #define MACH_IS_STE ((atari_mch_cookie >> 16) == ATARI_MCH_STE && \ | ||
36 | (atari_mch_cookie & 0xffff) == 0) | ||
37 | #define MACH_IS_MSTE ((atari_mch_cookie >> 16) == ATARI_MCH_STE && \ | ||
38 | (atari_mch_cookie & 0xffff) == 0x10) | ||
39 | #define MACH_IS_TT ((atari_mch_cookie >> 16) == ATARI_MCH_TT) | ||
40 | #define MACH_IS_FALCON ((atari_mch_cookie >> 16) == ATARI_MCH_FALCON) | ||
41 | #define MACH_IS_MEDUSA (atari_mch_type == ATARI_MACH_MEDUSA) | ||
42 | #define MACH_IS_HADES (atari_mch_type == ATARI_MACH_HADES) | ||
43 | #define MACH_IS_AB40 (atari_mch_type == ATARI_MACH_AB40) | ||
44 | |||
45 | /* values for atari_switches */ | ||
46 | #define ATARI_SWITCH_IKBD 0x01 | ||
47 | #define ATARI_SWITCH_MIDI 0x02 | ||
48 | #define ATARI_SWITCH_SND6 0x04 | ||
49 | #define ATARI_SWITCH_SND7 0x08 | ||
50 | #define ATARI_SWITCH_OVSC_SHIFT 16 | ||
51 | #define ATARI_SWITCH_OVSC_IKBD (ATARI_SWITCH_IKBD << ATARI_SWITCH_OVSC_SHIFT) | ||
52 | #define ATARI_SWITCH_OVSC_MIDI (ATARI_SWITCH_MIDI << ATARI_SWITCH_OVSC_SHIFT) | ||
53 | #define ATARI_SWITCH_OVSC_SND6 (ATARI_SWITCH_SND6 << ATARI_SWITCH_OVSC_SHIFT) | ||
54 | #define ATARI_SWITCH_OVSC_SND7 (ATARI_SWITCH_SND7 << ATARI_SWITCH_OVSC_SHIFT) | ||
55 | #define ATARI_SWITCH_OVSC_MASK 0xffff0000 | ||
56 | |||
57 | /* | ||
58 | * Define several Hardware-Chips for indication so that for the ATARI we do | ||
59 | * no longer decide whether it is a Falcon or other machine . It's just | ||
60 | * important what hardware the machine uses | ||
61 | */ | ||
62 | |||
63 | /* ++roman 08/08/95: rewritten from ORing constants to a C bitfield */ | ||
64 | |||
65 | #define ATARIHW_DECLARE(name) unsigned name : 1 | ||
66 | #define ATARIHW_SET(name) (atari_hw_present.name = 1) | ||
67 | #define ATARIHW_PRESENT(name) (atari_hw_present.name) | ||
68 | |||
69 | struct atari_hw_present { | ||
70 | /* video hardware */ | ||
71 | ATARIHW_DECLARE(STND_SHIFTER); /* ST-Shifter - no base low ! */ | ||
72 | ATARIHW_DECLARE(EXTD_SHIFTER); /* STe-Shifter - 24 bit address */ | ||
73 | ATARIHW_DECLARE(TT_SHIFTER); /* TT-Shifter */ | ||
74 | ATARIHW_DECLARE(VIDEL_SHIFTER); /* Falcon-Shifter */ | ||
75 | /* sound hardware */ | ||
76 | ATARIHW_DECLARE(YM_2149); /* Yamaha YM 2149 */ | ||
77 | ATARIHW_DECLARE(PCM_8BIT); /* PCM-Sound in STe-ATARI */ | ||
78 | ATARIHW_DECLARE(CODEC); /* CODEC Sound (Falcon) */ | ||
79 | /* disk storage interfaces */ | ||
80 | ATARIHW_DECLARE(TT_SCSI); /* Directly mapped NCR5380 */ | ||
81 | ATARIHW_DECLARE(ST_SCSI); /* NCR5380 via ST-DMA (Falcon) */ | ||
82 | ATARIHW_DECLARE(ACSI); /* Standard ACSI like in STs */ | ||
83 | ATARIHW_DECLARE(IDE); /* IDE Interface */ | ||
84 | ATARIHW_DECLARE(FDCSPEED); /* 8/16 MHz switch for FDC */ | ||
85 | /* other I/O hardware */ | ||
86 | ATARIHW_DECLARE(ST_MFP); /* The ST-MFP (there should be no Atari | ||
87 | without it... but who knows?) */ | ||
88 | ATARIHW_DECLARE(TT_MFP); /* 2nd MFP */ | ||
89 | ATARIHW_DECLARE(SCC); /* Serial Communications Contr. */ | ||
90 | ATARIHW_DECLARE(ST_ESCC); /* SCC Z83230 in an ST */ | ||
91 | ATARIHW_DECLARE(ANALOG_JOY); /* Paddle Interface for STe | ||
92 | and Falcon */ | ||
93 | ATARIHW_DECLARE(MICROWIRE); /* Microwire Interface */ | ||
94 | /* DMA */ | ||
95 | ATARIHW_DECLARE(STND_DMA); /* 24 Bit limited ST-DMA */ | ||
96 | ATARIHW_DECLARE(EXTD_DMA); /* 32 Bit ST-DMA */ | ||
97 | ATARIHW_DECLARE(SCSI_DMA); /* DMA for the NCR5380 */ | ||
98 | ATARIHW_DECLARE(SCC_DMA); /* DMA for the SCC */ | ||
99 | /* real time clocks */ | ||
100 | ATARIHW_DECLARE(TT_CLK); /* TT compatible clock chip */ | ||
101 | ATARIHW_DECLARE(MSTE_CLK); /* Mega ST(E) clock chip */ | ||
102 | /* supporting hardware */ | ||
103 | ATARIHW_DECLARE(SCU); /* System Control Unit */ | ||
104 | ATARIHW_DECLARE(BLITTER); /* Blitter */ | ||
105 | ATARIHW_DECLARE(VME); /* VME Bus */ | ||
106 | ATARIHW_DECLARE(DSP56K); /* DSP56k processor in Falcon */ | ||
107 | }; | ||
108 | |||
109 | extern struct atari_hw_present atari_hw_present; | ||
110 | |||
111 | |||
112 | /* Reading the MFP port register gives a machine independent delay, since the | ||
113 | * MFP always has a 8 MHz clock. This avoids problems with the varying length | ||
114 | * of nops on various machines. Somebody claimed that the tstb takes 600 ns. | ||
115 | */ | ||
116 | #define MFPDELAY() \ | ||
117 | __asm__ __volatile__ ( "tstb %0" : : "m" (mfp.par_dt_reg) : "cc" ); | ||
118 | |||
119 | /* Do cache push/invalidate for DMA read/write. This function obeys the | ||
120 | * snooping on some machines (Medusa) and processors: The Medusa itself can | ||
121 | * snoop, but only the '040 can source data from its cache to DMA writes i.e., | ||
122 | * reads from memory). Both '040 and '060 invalidate cache entries on snooped | ||
123 | * DMA reads (i.e., writes to memory). | ||
124 | */ | ||
125 | |||
126 | |||
127 | #define atari_readb raw_inb | ||
128 | #define atari_writeb raw_outb | ||
129 | |||
130 | #define atari_inb_p raw_inb | ||
131 | #define atari_outb_p raw_outb | ||
132 | |||
133 | |||
134 | |||
135 | #include <linux/mm.h> | ||
136 | #include <asm/cacheflush.h> | ||
137 | |||
138 | static inline void dma_cache_maintenance( unsigned long paddr, | ||
139 | unsigned long len, | ||
140 | int writeflag ) | ||
141 | |||
142 | { | ||
143 | if (writeflag) { | ||
144 | if (!MACH_IS_MEDUSA || CPU_IS_060) | ||
145 | cache_push( paddr, len ); | ||
146 | } | ||
147 | else { | ||
148 | if (!MACH_IS_MEDUSA) | ||
149 | cache_clear( paddr, len ); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | |||
154 | /* | ||
155 | ** Shifter | ||
156 | */ | ||
157 | #define ST_LOW 0 | ||
158 | #define ST_MID 1 | ||
159 | #define ST_HIGH 2 | ||
160 | #define TT_LOW 7 | ||
161 | #define TT_MID 4 | ||
162 | #define TT_HIGH 6 | ||
163 | |||
164 | #define SHF_BAS (0xffff8200) | ||
165 | struct SHIFTER | ||
166 | { | ||
167 | u_char pad1; | ||
168 | u_char bas_hi; | ||
169 | u_char pad2; | ||
170 | u_char bas_md; | ||
171 | u_char pad3; | ||
172 | u_char volatile vcounthi; | ||
173 | u_char pad4; | ||
174 | u_char volatile vcountmid; | ||
175 | u_char pad5; | ||
176 | u_char volatile vcountlow; | ||
177 | u_char volatile syncmode; | ||
178 | u_char pad6; | ||
179 | u_char pad7; | ||
180 | u_char bas_lo; | ||
181 | }; | ||
182 | # define shifter ((*(volatile struct SHIFTER *)SHF_BAS)) | ||
183 | |||
184 | #define SHF_FBAS (0xffff820e) | ||
185 | struct SHIFTER_F030 | ||
186 | { | ||
187 | u_short off_next; | ||
188 | u_short scn_width; | ||
189 | }; | ||
190 | # define shifter_f030 ((*(volatile struct SHIFTER_F030 *)SHF_FBAS)) | ||
191 | |||
192 | |||
193 | #define SHF_TBAS (0xffff8200) | ||
194 | struct SHIFTER_TT { | ||
195 | u_char char_dummy0; | ||
196 | u_char bas_hi; /* video mem base addr, high and mid byte */ | ||
197 | u_char char_dummy1; | ||
198 | u_char bas_md; | ||
199 | u_char char_dummy2; | ||
200 | u_char vcount_hi; /* pointer to currently displayed byte */ | ||
201 | u_char char_dummy3; | ||
202 | u_char vcount_md; | ||
203 | u_char char_dummy4; | ||
204 | u_char vcount_lo; | ||
205 | u_short st_sync; /* ST compatible sync mode register, unused */ | ||
206 | u_char char_dummy5; | ||
207 | u_char bas_lo; /* video mem addr, low byte */ | ||
208 | u_char char_dummy6[2+3*16]; | ||
209 | /* $ffff8240: */ | ||
210 | u_short color_reg[16]; /* 16 color registers */ | ||
211 | u_char st_shiftmode; /* ST compatible shift mode register, unused */ | ||
212 | u_char char_dummy7; | ||
213 | u_short tt_shiftmode; /* TT shift mode register */ | ||
214 | |||
215 | |||
216 | }; | ||
217 | #define shifter_tt ((*(volatile struct SHIFTER_TT *)SHF_TBAS)) | ||
218 | |||
219 | /* values for shifter_tt->tt_shiftmode */ | ||
220 | #define TT_SHIFTER_STLOW 0x0000 | ||
221 | #define TT_SHIFTER_STMID 0x0100 | ||
222 | #define TT_SHIFTER_STHIGH 0x0200 | ||
223 | #define TT_SHIFTER_TTLOW 0x0700 | ||
224 | #define TT_SHIFTER_TTMID 0x0400 | ||
225 | #define TT_SHIFTER_TTHIGH 0x0600 | ||
226 | #define TT_SHIFTER_MODEMASK 0x0700 | ||
227 | #define TT_SHIFTER_NUMMODE 0x0008 | ||
228 | #define TT_SHIFTER_PALETTE_MASK 0x000f | ||
229 | #define TT_SHIFTER_GRAYMODE 0x1000 | ||
230 | |||
231 | /* 256 TT palette registers */ | ||
232 | #define TT_PALETTE_BASE (0xffff8400) | ||
233 | #define tt_palette ((volatile u_short *)TT_PALETTE_BASE) | ||
234 | |||
235 | #define TT_PALETTE_RED_MASK 0x0f00 | ||
236 | #define TT_PALETTE_GREEN_MASK 0x00f0 | ||
237 | #define TT_PALETTE_BLUE_MASK 0x000f | ||
238 | |||
239 | /* | ||
240 | ** Falcon030 VIDEL Video Controller | ||
241 | ** for description see File 'linux\tools\atari\hardware.txt | ||
242 | */ | ||
243 | #define f030_col ((u_long *) 0xffff9800) | ||
244 | #define f030_xreg ((u_short*) 0xffff8282) | ||
245 | #define f030_yreg ((u_short*) 0xffff82a2) | ||
246 | #define f030_creg ((u_short*) 0xffff82c0) | ||
247 | #define f030_sreg ((u_short*) 0xffff8260) | ||
248 | #define f030_mreg ((u_short*) 0xffff820a) | ||
249 | #define f030_linewidth ((u_short*) 0xffff820e) | ||
250 | #define f030_hscroll ((u_char*) 0xffff8265) | ||
251 | |||
252 | #define VIDEL_BAS (0xffff8260) | ||
253 | struct VIDEL { | ||
254 | u_short st_shift; | ||
255 | u_short pad1; | ||
256 | u_char xoffset_s; | ||
257 | u_char xoffset; | ||
258 | u_short f_shift; | ||
259 | u_char pad2[0x1a]; | ||
260 | u_short hht; | ||
261 | u_short hbb; | ||
262 | u_short hbe; | ||
263 | u_short hdb; | ||
264 | u_short hde; | ||
265 | u_short hss; | ||
266 | u_char pad3[0x14]; | ||
267 | u_short vft; | ||
268 | u_short vbb; | ||
269 | u_short vbe; | ||
270 | u_short vdb; | ||
271 | u_short vde; | ||
272 | u_short vss; | ||
273 | u_char pad4[0x12]; | ||
274 | u_short control; | ||
275 | u_short mode; | ||
276 | }; | ||
277 | #define videl ((*(volatile struct VIDEL *)VIDEL_BAS)) | ||
278 | |||
279 | /* | ||
280 | ** DMA/WD1772 Disk Controller | ||
281 | */ | ||
282 | |||
283 | #define FWD_BAS (0xffff8604) | ||
284 | struct DMA_WD | ||
285 | { | ||
286 | u_short fdc_acces_seccount; | ||
287 | u_short dma_mode_status; | ||
288 | u_char dma_vhi; /* Some extended ST-DMAs can handle 32 bit addresses */ | ||
289 | u_char dma_hi; | ||
290 | u_char char_dummy2; | ||
291 | u_char dma_md; | ||
292 | u_char char_dummy3; | ||
293 | u_char dma_lo; | ||
294 | u_short fdc_speed; | ||
295 | }; | ||
296 | # define dma_wd ((*(volatile struct DMA_WD *)FWD_BAS)) | ||
297 | /* alias */ | ||
298 | #define st_dma dma_wd | ||
299 | /* The two highest bytes of an extended DMA as a short; this is a must | ||
300 | * for the Medusa. | ||
301 | */ | ||
302 | #define st_dma_ext_dmahi (*((volatile unsigned short *)0xffff8608)) | ||
303 | |||
304 | /* | ||
305 | ** YM2149 Sound Chip | ||
306 | ** access in bytes | ||
307 | */ | ||
308 | |||
309 | #define YM_BAS (0xffff8800) | ||
310 | struct SOUND_YM | ||
311 | { | ||
312 | u_char rd_data_reg_sel; | ||
313 | u_char char_dummy1; | ||
314 | u_char wd_data; | ||
315 | }; | ||
316 | #define sound_ym ((*(volatile struct SOUND_YM *)YM_BAS)) | ||
317 | |||
318 | /* TT SCSI DMA */ | ||
319 | |||
320 | #define TT_SCSI_DMA_BAS (0xffff8700) | ||
321 | struct TT_DMA { | ||
322 | u_char char_dummy0; | ||
323 | u_char dma_addr_hi; | ||
324 | u_char char_dummy1; | ||
325 | u_char dma_addr_hmd; | ||
326 | u_char char_dummy2; | ||
327 | u_char dma_addr_lmd; | ||
328 | u_char char_dummy3; | ||
329 | u_char dma_addr_lo; | ||
330 | u_char char_dummy4; | ||
331 | u_char dma_cnt_hi; | ||
332 | u_char char_dummy5; | ||
333 | u_char dma_cnt_hmd; | ||
334 | u_char char_dummy6; | ||
335 | u_char dma_cnt_lmd; | ||
336 | u_char char_dummy7; | ||
337 | u_char dma_cnt_lo; | ||
338 | u_long dma_restdata; | ||
339 | u_short dma_ctrl; | ||
340 | }; | ||
341 | #define tt_scsi_dma ((*(volatile struct TT_DMA *)TT_SCSI_DMA_BAS)) | ||
342 | |||
343 | /* TT SCSI Controller 5380 */ | ||
344 | |||
345 | #define TT_5380_BAS (0xffff8781) | ||
346 | struct TT_5380 { | ||
347 | u_char scsi_data; | ||
348 | u_char char_dummy1; | ||
349 | u_char scsi_icr; | ||
350 | u_char char_dummy2; | ||
351 | u_char scsi_mode; | ||
352 | u_char char_dummy3; | ||
353 | u_char scsi_tcr; | ||
354 | u_char char_dummy4; | ||
355 | u_char scsi_idstat; | ||
356 | u_char char_dummy5; | ||
357 | u_char scsi_dmastat; | ||
358 | u_char char_dummy6; | ||
359 | u_char scsi_targrcv; | ||
360 | u_char char_dummy7; | ||
361 | u_char scsi_inircv; | ||
362 | }; | ||
363 | #define tt_scsi ((*(volatile struct TT_5380 *)TT_5380_BAS)) | ||
364 | #define tt_scsi_regp ((volatile char *)TT_5380_BAS) | ||
365 | |||
366 | |||
367 | /* | ||
368 | ** Falcon DMA Sound Subsystem | ||
369 | */ | ||
370 | |||
371 | #define MATRIX_BASE (0xffff8930) | ||
372 | struct MATRIX | ||
373 | { | ||
374 | u_short source; | ||
375 | u_short destination; | ||
376 | u_char external_frequency_divider; | ||
377 | u_char internal_frequency_divider; | ||
378 | }; | ||
379 | #define falcon_matrix (*(volatile struct MATRIX *)MATRIX_BASE) | ||
380 | |||
381 | #define CODEC_BASE (0xffff8936) | ||
382 | struct CODEC | ||
383 | { | ||
384 | u_char tracks; | ||
385 | u_char input_source; | ||
386 | #define CODEC_SOURCE_ADC 1 | ||
387 | #define CODEC_SOURCE_MATRIX 2 | ||
388 | u_char adc_source; | ||
389 | #define ADC_SOURCE_RIGHT_PSG 1 | ||
390 | #define ADC_SOURCE_LEFT_PSG 2 | ||
391 | u_char gain; | ||
392 | #define CODEC_GAIN_RIGHT 0x0f | ||
393 | #define CODEC_GAIN_LEFT 0xf0 | ||
394 | u_char attenuation; | ||
395 | #define CODEC_ATTENUATION_RIGHT 0x0f | ||
396 | #define CODEC_ATTENUATION_LEFT 0xf0 | ||
397 | u_char unused1; | ||
398 | u_char status; | ||
399 | #define CODEC_OVERFLOW_RIGHT 1 | ||
400 | #define CODEC_OVERFLOW_LEFT 2 | ||
401 | u_char unused2, unused3, unused4, unused5; | ||
402 | u_char gpio_directions; | ||
403 | #define GPIO_IN 0 | ||
404 | #define GPIO_OUT 1 | ||
405 | u_char unused6; | ||
406 | u_char gpio_data; | ||
407 | }; | ||
408 | #define falcon_codec (*(volatile struct CODEC *)CODEC_BASE) | ||
409 | |||
410 | /* | ||
411 | ** Falcon Blitter | ||
412 | */ | ||
413 | |||
414 | #define BLT_BAS (0xffff8a00) | ||
415 | |||
416 | struct BLITTER | ||
417 | { | ||
418 | u_short halftone[16]; | ||
419 | u_short src_x_inc; | ||
420 | u_short src_y_inc; | ||
421 | u_long src_address; | ||
422 | u_short endmask1; | ||
423 | u_short endmask2; | ||
424 | u_short endmask3; | ||
425 | u_short dst_x_inc; | ||
426 | u_short dst_y_inc; | ||
427 | u_long dst_address; | ||
428 | u_short wd_per_line; | ||
429 | u_short ln_per_bb; | ||
430 | u_short hlf_op_reg; | ||
431 | u_short log_op_reg; | ||
432 | u_short lin_nm_reg; | ||
433 | u_short skew_reg; | ||
434 | }; | ||
435 | # define blitter ((*(volatile struct BLITTER *)BLT_BAS)) | ||
436 | |||
437 | |||
438 | /* | ||
439 | ** SCC Z8530 | ||
440 | */ | ||
441 | |||
442 | #define SCC_BAS (0xffff8c81) | ||
443 | struct SCC | ||
444 | { | ||
445 | u_char cha_a_ctrl; | ||
446 | u_char char_dummy1; | ||
447 | u_char cha_a_data; | ||
448 | u_char char_dummy2; | ||
449 | u_char cha_b_ctrl; | ||
450 | u_char char_dummy3; | ||
451 | u_char cha_b_data; | ||
452 | }; | ||
453 | # define scc ((*(volatile struct SCC*)SCC_BAS)) | ||
454 | |||
455 | /* The ESCC (Z85230) in an Atari ST. The channels are reversed! */ | ||
456 | # define st_escc ((*(volatile struct SCC*)0xfffffa31)) | ||
457 | # define st_escc_dsr ((*(volatile char *)0xfffffa39)) | ||
458 | |||
459 | /* TT SCC DMA Controller (same chip as SCSI DMA) */ | ||
460 | |||
461 | #define TT_SCC_DMA_BAS (0xffff8c00) | ||
462 | #define tt_scc_dma ((*(volatile struct TT_DMA *)TT_SCC_DMA_BAS)) | ||
463 | |||
464 | /* | ||
465 | ** VIDEL Palette Register | ||
466 | */ | ||
467 | |||
468 | #define FPL_BAS (0xffff9800) | ||
469 | struct VIDEL_PALETTE | ||
470 | { | ||
471 | u_long reg[256]; | ||
472 | }; | ||
473 | # define videl_palette ((*(volatile struct VIDEL_PALETTE*)FPL_BAS)) | ||
474 | |||
475 | |||
476 | /* | ||
477 | ** Falcon DSP Host Interface | ||
478 | */ | ||
479 | |||
480 | #define DSP56K_HOST_INTERFACE_BASE (0xffffa200) | ||
481 | struct DSP56K_HOST_INTERFACE { | ||
482 | u_char icr; | ||
483 | #define DSP56K_ICR_RREQ 0x01 | ||
484 | #define DSP56K_ICR_TREQ 0x02 | ||
485 | #define DSP56K_ICR_HF0 0x08 | ||
486 | #define DSP56K_ICR_HF1 0x10 | ||
487 | #define DSP56K_ICR_HM0 0x20 | ||
488 | #define DSP56K_ICR_HM1 0x40 | ||
489 | #define DSP56K_ICR_INIT 0x80 | ||
490 | |||
491 | u_char cvr; | ||
492 | #define DSP56K_CVR_HV_MASK 0x1f | ||
493 | #define DSP56K_CVR_HC 0x80 | ||
494 | |||
495 | u_char isr; | ||
496 | #define DSP56K_ISR_RXDF 0x01 | ||
497 | #define DSP56K_ISR_TXDE 0x02 | ||
498 | #define DSP56K_ISR_TRDY 0x04 | ||
499 | #define DSP56K_ISR_HF2 0x08 | ||
500 | #define DSP56K_ISR_HF3 0x10 | ||
501 | #define DSP56K_ISR_DMA 0x40 | ||
502 | #define DSP56K_ISR_HREQ 0x80 | ||
503 | |||
504 | u_char ivr; | ||
505 | |||
506 | union { | ||
507 | u_char b[4]; | ||
508 | u_short w[2]; | ||
509 | u_long l; | ||
510 | } data; | ||
511 | }; | ||
512 | #define dsp56k_host_interface ((*(volatile struct DSP56K_HOST_INTERFACE *)DSP56K_HOST_INTERFACE_BASE)) | ||
513 | |||
514 | /* | ||
515 | ** MFP 68901 | ||
516 | */ | ||
517 | |||
518 | #define MFP_BAS (0xfffffa01) | ||
519 | struct MFP | ||
520 | { | ||
521 | u_char par_dt_reg; | ||
522 | u_char char_dummy1; | ||
523 | u_char active_edge; | ||
524 | u_char char_dummy2; | ||
525 | u_char data_dir; | ||
526 | u_char char_dummy3; | ||
527 | u_char int_en_a; | ||
528 | u_char char_dummy4; | ||
529 | u_char int_en_b; | ||
530 | u_char char_dummy5; | ||
531 | u_char int_pn_a; | ||
532 | u_char char_dummy6; | ||
533 | u_char int_pn_b; | ||
534 | u_char char_dummy7; | ||
535 | u_char int_sv_a; | ||
536 | u_char char_dummy8; | ||
537 | u_char int_sv_b; | ||
538 | u_char char_dummy9; | ||
539 | u_char int_mk_a; | ||
540 | u_char char_dummy10; | ||
541 | u_char int_mk_b; | ||
542 | u_char char_dummy11; | ||
543 | u_char vec_adr; | ||
544 | u_char char_dummy12; | ||
545 | u_char tim_ct_a; | ||
546 | u_char char_dummy13; | ||
547 | u_char tim_ct_b; | ||
548 | u_char char_dummy14; | ||
549 | u_char tim_ct_cd; | ||
550 | u_char char_dummy15; | ||
551 | u_char tim_dt_a; | ||
552 | u_char char_dummy16; | ||
553 | u_char tim_dt_b; | ||
554 | u_char char_dummy17; | ||
555 | u_char tim_dt_c; | ||
556 | u_char char_dummy18; | ||
557 | u_char tim_dt_d; | ||
558 | u_char char_dummy19; | ||
559 | u_char sync_char; | ||
560 | u_char char_dummy20; | ||
561 | u_char usart_ctr; | ||
562 | u_char char_dummy21; | ||
563 | u_char rcv_stat; | ||
564 | u_char char_dummy22; | ||
565 | u_char trn_stat; | ||
566 | u_char char_dummy23; | ||
567 | u_char usart_dta; | ||
568 | }; | ||
569 | # define mfp ((*(volatile struct MFP*)MFP_BAS)) | ||
570 | |||
571 | /* TT's second MFP */ | ||
572 | |||
573 | #define TT_MFP_BAS (0xfffffa81) | ||
574 | # define tt_mfp ((*(volatile struct MFP*)TT_MFP_BAS)) | ||
575 | |||
576 | |||
577 | /* TT System Control Unit */ | ||
578 | |||
579 | #define TT_SCU_BAS (0xffff8e01) | ||
580 | struct TT_SCU { | ||
581 | u_char sys_mask; | ||
582 | u_char char_dummy1; | ||
583 | u_char sys_stat; | ||
584 | u_char char_dummy2; | ||
585 | u_char softint; | ||
586 | u_char char_dummy3; | ||
587 | u_char vmeint; | ||
588 | u_char char_dummy4; | ||
589 | u_char gp_reg1; | ||
590 | u_char char_dummy5; | ||
591 | u_char gp_reg2; | ||
592 | u_char char_dummy6; | ||
593 | u_char vme_mask; | ||
594 | u_char char_dummy7; | ||
595 | u_char vme_stat; | ||
596 | }; | ||
597 | #define tt_scu ((*(volatile struct TT_SCU *)TT_SCU_BAS)) | ||
598 | |||
599 | /* TT real time clock */ | ||
600 | |||
601 | #define TT_RTC_BAS (0xffff8961) | ||
602 | struct TT_RTC { | ||
603 | u_char regsel; | ||
604 | u_char dummy; | ||
605 | u_char data; | ||
606 | }; | ||
607 | #define tt_rtc ((*(volatile struct TT_RTC *)TT_RTC_BAS)) | ||
608 | |||
609 | |||
610 | /* | ||
611 | ** ACIA 6850 | ||
612 | */ | ||
613 | /* constants for the ACIA registers */ | ||
614 | |||
615 | /* baudrate selection and reset (Baudrate = clock/factor) */ | ||
616 | #define ACIA_DIV1 0 | ||
617 | #define ACIA_DIV16 1 | ||
618 | #define ACIA_DIV64 2 | ||
619 | #define ACIA_RESET 3 | ||
620 | |||
621 | /* character format */ | ||
622 | #define ACIA_D7E2S (0<<2) /* 7 data, even parity, 2 stop */ | ||
623 | #define ACIA_D7O2S (1<<2) /* 7 data, odd parity, 2 stop */ | ||
624 | #define ACIA_D7E1S (2<<2) /* 7 data, even parity, 1 stop */ | ||
625 | #define ACIA_D7O1S (3<<2) /* 7 data, odd parity, 1 stop */ | ||
626 | #define ACIA_D8N2S (4<<2) /* 8 data, no parity, 2 stop */ | ||
627 | #define ACIA_D8N1S (5<<2) /* 8 data, no parity, 1 stop */ | ||
628 | #define ACIA_D8E1S (6<<2) /* 8 data, even parity, 1 stop */ | ||
629 | #define ACIA_D8O1S (7<<2) /* 8 data, odd parity, 1 stop */ | ||
630 | |||
631 | /* transmit control */ | ||
632 | #define ACIA_RLTID (0<<5) /* RTS low, TxINT disabled */ | ||
633 | #define ACIA_RLTIE (1<<5) /* RTS low, TxINT enabled */ | ||
634 | #define ACIA_RHTID (2<<5) /* RTS high, TxINT disabled */ | ||
635 | #define ACIA_RLTIDSB (3<<5) /* RTS low, TxINT disabled, send break */ | ||
636 | |||
637 | /* receive control */ | ||
638 | #define ACIA_RID (0<<7) /* RxINT disabled */ | ||
639 | #define ACIA_RIE (1<<7) /* RxINT enabled */ | ||
640 | |||
641 | /* status fields of the ACIA */ | ||
642 | #define ACIA_RDRF 1 /* Receive Data Register Full */ | ||
643 | #define ACIA_TDRE (1<<1) /* Transmit Data Register Empty */ | ||
644 | #define ACIA_DCD (1<<2) /* Data Carrier Detect */ | ||
645 | #define ACIA_CTS (1<<3) /* Clear To Send */ | ||
646 | #define ACIA_FE (1<<4) /* Framing Error */ | ||
647 | #define ACIA_OVRN (1<<5) /* Receiver Overrun */ | ||
648 | #define ACIA_PE (1<<6) /* Parity Error */ | ||
649 | #define ACIA_IRQ (1<<7) /* Interrupt Request */ | ||
650 | |||
651 | #define ACIA_BAS (0xfffffc00) | ||
652 | struct ACIA | ||
653 | { | ||
654 | u_char key_ctrl; | ||
655 | u_char char_dummy1; | ||
656 | u_char key_data; | ||
657 | u_char char_dummy2; | ||
658 | u_char mid_ctrl; | ||
659 | u_char char_dummy3; | ||
660 | u_char mid_data; | ||
661 | }; | ||
662 | # define acia ((*(volatile struct ACIA*)ACIA_BAS)) | ||
663 | |||
664 | #define TT_DMASND_BAS (0xffff8900) | ||
665 | struct TT_DMASND { | ||
666 | u_char int_ctrl; /* Falcon: Interrupt control */ | ||
667 | u_char ctrl; | ||
668 | u_char pad2; | ||
669 | u_char bas_hi; | ||
670 | u_char pad3; | ||
671 | u_char bas_mid; | ||
672 | u_char pad4; | ||
673 | u_char bas_low; | ||
674 | u_char pad5; | ||
675 | u_char addr_hi; | ||
676 | u_char pad6; | ||
677 | u_char addr_mid; | ||
678 | u_char pad7; | ||
679 | u_char addr_low; | ||
680 | u_char pad8; | ||
681 | u_char end_hi; | ||
682 | u_char pad9; | ||
683 | u_char end_mid; | ||
684 | u_char pad10; | ||
685 | u_char end_low; | ||
686 | u_char pad11[12]; | ||
687 | u_char track_select; /* Falcon */ | ||
688 | u_char mode; | ||
689 | u_char pad12[14]; | ||
690 | /* Falcon only: */ | ||
691 | u_short cbar_src; | ||
692 | u_short cbar_dst; | ||
693 | u_char ext_div; | ||
694 | u_char int_div; | ||
695 | u_char rec_track_select; | ||
696 | u_char dac_src; | ||
697 | u_char adc_src; | ||
698 | u_char input_gain; | ||
699 | u_short output_atten; | ||
700 | }; | ||
701 | # define tt_dmasnd ((*(volatile struct TT_DMASND *)TT_DMASND_BAS)) | ||
702 | |||
703 | #define DMASND_MFP_INT_REPLAY 0x01 | ||
704 | #define DMASND_MFP_INT_RECORD 0x02 | ||
705 | #define DMASND_TIMERA_INT_REPLAY 0x04 | ||
706 | #define DMASND_TIMERA_INT_RECORD 0x08 | ||
707 | |||
708 | #define DMASND_CTRL_OFF 0x00 | ||
709 | #define DMASND_CTRL_ON 0x01 | ||
710 | #define DMASND_CTRL_REPEAT 0x02 | ||
711 | #define DMASND_CTRL_RECORD_ON 0x10 | ||
712 | #define DMASND_CTRL_RECORD_OFF 0x00 | ||
713 | #define DMASND_CTRL_RECORD_REPEAT 0x20 | ||
714 | #define DMASND_CTRL_SELECT_REPLAY 0x00 | ||
715 | #define DMASND_CTRL_SELECT_RECORD 0x80 | ||
716 | #define DMASND_MODE_MONO 0x80 | ||
717 | #define DMASND_MODE_STEREO 0x00 | ||
718 | #define DMASND_MODE_8BIT 0x00 | ||
719 | #define DMASND_MODE_16BIT 0x40 /* Falcon only */ | ||
720 | #define DMASND_MODE_6KHZ 0x00 /* Falcon: mute */ | ||
721 | #define DMASND_MODE_12KHZ 0x01 | ||
722 | #define DMASND_MODE_25KHZ 0x02 | ||
723 | #define DMASND_MODE_50KHZ 0x03 | ||
724 | |||
725 | |||
726 | #define DMASNDSetBase(bufstart) \ | ||
727 | do { \ | ||
728 | tt_dmasnd.bas_hi = (unsigned char)(((bufstart) & 0xff0000) >> 16); \ | ||
729 | tt_dmasnd.bas_mid = (unsigned char)(((bufstart) & 0x00ff00) >> 8); \ | ||
730 | tt_dmasnd.bas_low = (unsigned char) ((bufstart) & 0x0000ff); \ | ||
731 | } while( 0 ) | ||
732 | |||
733 | #define DMASNDGetAdr() ((tt_dmasnd.addr_hi << 16) + \ | ||
734 | (tt_dmasnd.addr_mid << 8) + \ | ||
735 | (tt_dmasnd.addr_low)) | ||
736 | |||
737 | #define DMASNDSetEnd(bufend) \ | ||
738 | do { \ | ||
739 | tt_dmasnd.end_hi = (unsigned char)(((bufend) & 0xff0000) >> 16); \ | ||
740 | tt_dmasnd.end_mid = (unsigned char)(((bufend) & 0x00ff00) >> 8); \ | ||
741 | tt_dmasnd.end_low = (unsigned char) ((bufend) & 0x0000ff); \ | ||
742 | } while( 0 ) | ||
743 | |||
744 | |||
745 | #define TT_MICROWIRE_BAS (0xffff8922) | ||
746 | struct TT_MICROWIRE { | ||
747 | u_short data; | ||
748 | u_short mask; | ||
749 | }; | ||
750 | # define tt_microwire ((*(volatile struct TT_MICROWIRE *)TT_MICROWIRE_BAS)) | ||
751 | |||
752 | #define MW_LM1992_ADDR 0x0400 | ||
753 | |||
754 | #define MW_LM1992_VOLUME(dB) \ | ||
755 | (0x0c0 | ((dB) < -80 ? 0 : (dB) > 0 ? 40 : (((dB) + 80) / 2))) | ||
756 | #define MW_LM1992_BALLEFT(dB) \ | ||
757 | (0x140 | ((dB) < -40 ? 0 : (dB) > 0 ? 20 : (((dB) + 40) / 2))) | ||
758 | #define MW_LM1992_BALRIGHT(dB) \ | ||
759 | (0x100 | ((dB) < -40 ? 0 : (dB) > 0 ? 20 : (((dB) + 40) / 2))) | ||
760 | #define MW_LM1992_TREBLE(dB) \ | ||
761 | (0x080 | ((dB) < -12 ? 0 : (dB) > 12 ? 12 : (((dB) / 2) + 6))) | ||
762 | #define MW_LM1992_BASS(dB) \ | ||
763 | (0x040 | ((dB) < -12 ? 0 : (dB) > 12 ? 12 : (((dB) / 2) + 6))) | ||
764 | |||
765 | #define MW_LM1992_PSG_LOW 0x000 | ||
766 | #define MW_LM1992_PSG_HIGH 0x001 | ||
767 | #define MW_LM1992_PSG_OFF 0x002 | ||
768 | |||
769 | #define MSTE_RTC_BAS (0xfffffc21) | ||
770 | |||
771 | struct MSTE_RTC { | ||
772 | u_char sec_ones; | ||
773 | u_char dummy1; | ||
774 | u_char sec_tens; | ||
775 | u_char dummy2; | ||
776 | u_char min_ones; | ||
777 | u_char dummy3; | ||
778 | u_char min_tens; | ||
779 | u_char dummy4; | ||
780 | u_char hr_ones; | ||
781 | u_char dummy5; | ||
782 | u_char hr_tens; | ||
783 | u_char dummy6; | ||
784 | u_char weekday; | ||
785 | u_char dummy7; | ||
786 | u_char day_ones; | ||
787 | u_char dummy8; | ||
788 | u_char day_tens; | ||
789 | u_char dummy9; | ||
790 | u_char mon_ones; | ||
791 | u_char dummy10; | ||
792 | u_char mon_tens; | ||
793 | u_char dummy11; | ||
794 | u_char year_ones; | ||
795 | u_char dummy12; | ||
796 | u_char year_tens; | ||
797 | u_char dummy13; | ||
798 | u_char mode; | ||
799 | u_char dummy14; | ||
800 | u_char test; | ||
801 | u_char dummy15; | ||
802 | u_char reset; | ||
803 | }; | ||
804 | |||
805 | #define mste_rtc ((*(volatile struct MSTE_RTC *)MSTE_RTC_BAS)) | ||
806 | |||
807 | #endif /* linux/atarihw.h */ | ||
808 | |||
diff --git a/include/asm-m68k/atariints.h b/include/asm-m68k/atariints.h new file mode 100644 index 000000000000..42952c890593 --- /dev/null +++ b/include/asm-m68k/atariints.h | |||
@@ -0,0 +1,215 @@ | |||
1 | /* | ||
2 | ** atariints.h -- Atari Linux interrupt handling structs and prototypes | ||
3 | ** | ||
4 | ** Copyright 1994 by Bj”rn Brauel | ||
5 | ** | ||
6 | ** 5/2/94 Roman Hodek: | ||
7 | ** TT interrupt definitions added. | ||
8 | ** | ||
9 | ** 12/02/96: (Roman) | ||
10 | ** Adapted to new int handling scheme (see ataints.c); revised numbering | ||
11 | ** | ||
12 | ** This file is subject to the terms and conditions of the GNU General Public | ||
13 | ** License. See the file COPYING in the main directory of this archive | ||
14 | ** for more details. | ||
15 | ** | ||
16 | */ | ||
17 | |||
18 | #ifndef _LINUX_ATARIINTS_H_ | ||
19 | #define _LINUX_ATARIINTS_H_ | ||
20 | |||
21 | #include <asm/irq.h> | ||
22 | #include <asm/atarihw.h> | ||
23 | |||
24 | /* | ||
25 | ** Atari Interrupt sources. | ||
26 | ** | ||
27 | */ | ||
28 | |||
29 | #define STMFP_SOURCE_BASE 8 | ||
30 | #define TTMFP_SOURCE_BASE 24 | ||
31 | #define SCC_SOURCE_BASE 40 | ||
32 | #define VME_SOURCE_BASE 56 | ||
33 | #define VME_MAX_SOURCES 16 | ||
34 | |||
35 | #define NUM_ATARI_SOURCES (VME_SOURCE_BASE+VME_MAX_SOURCES-STMFP_SOURCE_BASE) | ||
36 | |||
37 | /* convert vector number to int source number */ | ||
38 | #define IRQ_VECTOR_TO_SOURCE(v) ((v) - ((v) < 0x20 ? 0x18 : (0x40-8))) | ||
39 | |||
40 | /* convert irq_handler index to vector number */ | ||
41 | #define IRQ_SOURCE_TO_VECTOR(i) ((i) + ((i) < 8 ? 0x18 : (0x40-8))) | ||
42 | |||
43 | /* interrupt service types */ | ||
44 | #define IRQ_TYPE_SLOW 0 | ||
45 | #define IRQ_TYPE_FAST 1 | ||
46 | #define IRQ_TYPE_PRIO 2 | ||
47 | |||
48 | #define IRQ_SPURIOUS (0) | ||
49 | |||
50 | /* auto-vector interrupts */ | ||
51 | #define IRQ_AUTO_1 (1) | ||
52 | #define IRQ_AUTO_2 (2) | ||
53 | #define IRQ_AUTO_3 (3) | ||
54 | #define IRQ_AUTO_4 (4) | ||
55 | #define IRQ_AUTO_5 (5) | ||
56 | #define IRQ_AUTO_6 (6) | ||
57 | #define IRQ_AUTO_7 (7) | ||
58 | |||
59 | /* ST-MFP interrupts */ | ||
60 | #define IRQ_MFP_BUSY (8) | ||
61 | #define IRQ_MFP_DCD (9) | ||
62 | #define IRQ_MFP_CTS (10) | ||
63 | #define IRQ_MFP_GPU (11) | ||
64 | #define IRQ_MFP_TIMD (12) | ||
65 | #define IRQ_MFP_TIMC (13) | ||
66 | #define IRQ_MFP_ACIA (14) | ||
67 | #define IRQ_MFP_FDC (15) | ||
68 | #define IRQ_MFP_ACSI IRQ_MFP_FDC | ||
69 | #define IRQ_MFP_FSCSI IRQ_MFP_FDC | ||
70 | #define IRQ_MFP_IDE IRQ_MFP_FDC | ||
71 | #define IRQ_MFP_TIMB (16) | ||
72 | #define IRQ_MFP_SERERR (17) | ||
73 | #define IRQ_MFP_SEREMPT (18) | ||
74 | #define IRQ_MFP_RECERR (19) | ||
75 | #define IRQ_MFP_RECFULL (20) | ||
76 | #define IRQ_MFP_TIMA (21) | ||
77 | #define IRQ_MFP_RI (22) | ||
78 | #define IRQ_MFP_MMD (23) | ||
79 | |||
80 | /* TT-MFP interrupts */ | ||
81 | #define IRQ_TT_MFP_IO0 (24) | ||
82 | #define IRQ_TT_MFP_IO1 (25) | ||
83 | #define IRQ_TT_MFP_SCC (26) | ||
84 | #define IRQ_TT_MFP_RI (27) | ||
85 | #define IRQ_TT_MFP_TIMD (28) | ||
86 | #define IRQ_TT_MFP_TIMC (29) | ||
87 | #define IRQ_TT_MFP_DRVRDY (30) | ||
88 | #define IRQ_TT_MFP_SCSIDMA (31) | ||
89 | #define IRQ_TT_MFP_TIMB (32) | ||
90 | #define IRQ_TT_MFP_SERERR (33) | ||
91 | #define IRQ_TT_MFP_SEREMPT (34) | ||
92 | #define IRQ_TT_MFP_RECERR (35) | ||
93 | #define IRQ_TT_MFP_RECFULL (36) | ||
94 | #define IRQ_TT_MFP_TIMA (37) | ||
95 | #define IRQ_TT_MFP_RTC (38) | ||
96 | #define IRQ_TT_MFP_SCSI (39) | ||
97 | |||
98 | /* SCC interrupts */ | ||
99 | #define IRQ_SCCB_TX (40) | ||
100 | #define IRQ_SCCB_STAT (42) | ||
101 | #define IRQ_SCCB_RX (44) | ||
102 | #define IRQ_SCCB_SPCOND (46) | ||
103 | #define IRQ_SCCA_TX (48) | ||
104 | #define IRQ_SCCA_STAT (50) | ||
105 | #define IRQ_SCCA_RX (52) | ||
106 | #define IRQ_SCCA_SPCOND (54) | ||
107 | |||
108 | |||
109 | #define INT_CLK 24576 /* CLK while int_clk =2.456MHz and divide = 100 */ | ||
110 | #define INT_TICKS 246 /* to make sched_time = 99.902... HZ */ | ||
111 | |||
112 | |||
113 | #define MFP_ENABLE 0 | ||
114 | #define MFP_PENDING 1 | ||
115 | #define MFP_SERVICE 2 | ||
116 | #define MFP_MASK 3 | ||
117 | |||
118 | /* Utility functions for setting/clearing bits in the interrupt registers of | ||
119 | * the MFP. 'type' should be constant, if 'irq' is constant, too, code size is | ||
120 | * reduced. set_mfp_bit() is nonsense for PENDING and SERVICE registers. */ | ||
121 | |||
122 | static inline int get_mfp_bit( unsigned irq, int type ) | ||
123 | |||
124 | { unsigned char mask, *reg; | ||
125 | |||
126 | mask = 1 << (irq & 7); | ||
127 | reg = (unsigned char *)&mfp.int_en_a + type*4 + | ||
128 | ((irq & 8) >> 2) + (((irq-8) & 16) << 3); | ||
129 | return( *reg & mask ); | ||
130 | } | ||
131 | |||
132 | static inline void set_mfp_bit( unsigned irq, int type ) | ||
133 | |||
134 | { unsigned char mask, *reg; | ||
135 | |||
136 | mask = 1 << (irq & 7); | ||
137 | reg = (unsigned char *)&mfp.int_en_a + type*4 + | ||
138 | ((irq & 8) >> 2) + (((irq-8) & 16) << 3); | ||
139 | __asm__ __volatile__ ( "orb %0,%1" | ||
140 | : : "di" (mask), "m" (*reg) : "memory" ); | ||
141 | } | ||
142 | |||
143 | static inline void clear_mfp_bit( unsigned irq, int type ) | ||
144 | |||
145 | { unsigned char mask, *reg; | ||
146 | |||
147 | mask = ~(1 << (irq & 7)); | ||
148 | reg = (unsigned char *)&mfp.int_en_a + type*4 + | ||
149 | ((irq & 8) >> 2) + (((irq-8) & 16) << 3); | ||
150 | if (type == MFP_PENDING || type == MFP_SERVICE) | ||
151 | __asm__ __volatile__ ( "moveb %0,%1" | ||
152 | : : "di" (mask), "m" (*reg) : "memory" ); | ||
153 | else | ||
154 | __asm__ __volatile__ ( "andb %0,%1" | ||
155 | : : "di" (mask), "m" (*reg) : "memory" ); | ||
156 | } | ||
157 | |||
158 | /* | ||
159 | * {en,dis}able_irq have the usual semantics of temporary blocking the | ||
160 | * interrupt, but not loosing requests that happen between disabling and | ||
161 | * enabling. This is done with the MFP mask registers. | ||
162 | */ | ||
163 | |||
164 | static inline void atari_enable_irq( unsigned irq ) | ||
165 | |||
166 | { | ||
167 | if (irq < STMFP_SOURCE_BASE || irq >= SCC_SOURCE_BASE) return; | ||
168 | set_mfp_bit( irq, MFP_MASK ); | ||
169 | } | ||
170 | |||
171 | static inline void atari_disable_irq( unsigned irq ) | ||
172 | |||
173 | { | ||
174 | if (irq < STMFP_SOURCE_BASE || irq >= SCC_SOURCE_BASE) return; | ||
175 | clear_mfp_bit( irq, MFP_MASK ); | ||
176 | } | ||
177 | |||
178 | /* | ||
179 | * In opposite to {en,dis}able_irq, requests between turn{off,on}_irq are not | ||
180 | * "stored" | ||
181 | */ | ||
182 | |||
183 | static inline void atari_turnon_irq( unsigned irq ) | ||
184 | |||
185 | { | ||
186 | if (irq < STMFP_SOURCE_BASE || irq >= SCC_SOURCE_BASE) return; | ||
187 | set_mfp_bit( irq, MFP_ENABLE ); | ||
188 | } | ||
189 | |||
190 | static inline void atari_turnoff_irq( unsigned irq ) | ||
191 | |||
192 | { | ||
193 | if (irq < STMFP_SOURCE_BASE || irq >= SCC_SOURCE_BASE) return; | ||
194 | clear_mfp_bit( irq, MFP_ENABLE ); | ||
195 | clear_mfp_bit( irq, MFP_PENDING ); | ||
196 | } | ||
197 | |||
198 | static inline void atari_clear_pending_irq( unsigned irq ) | ||
199 | |||
200 | { | ||
201 | if (irq < STMFP_SOURCE_BASE || irq >= SCC_SOURCE_BASE) return; | ||
202 | clear_mfp_bit( irq, MFP_PENDING ); | ||
203 | } | ||
204 | |||
205 | static inline int atari_irq_pending( unsigned irq ) | ||
206 | |||
207 | { | ||
208 | if (irq < STMFP_SOURCE_BASE || irq >= SCC_SOURCE_BASE) return( 0 ); | ||
209 | return( get_mfp_bit( irq, MFP_PENDING ) ); | ||
210 | } | ||
211 | |||
212 | unsigned long atari_register_vme_int( void ); | ||
213 | void atari_unregister_vme_int( unsigned long ); | ||
214 | |||
215 | #endif /* linux/atariints.h */ | ||
diff --git a/include/asm-m68k/atarikb.h b/include/asm-m68k/atarikb.h new file mode 100644 index 000000000000..18926058fde7 --- /dev/null +++ b/include/asm-m68k/atarikb.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | ** atarikb.h -- This header contains the prototypes of functions of | ||
3 | ** the intelligent keyboard of the Atari needed by the | ||
4 | ** mouse and joystick drivers. | ||
5 | ** | ||
6 | ** Copyright 1994 by Robert de Vries | ||
7 | ** | ||
8 | ** This file is subject to the terms and conditions of the GNU General Public | ||
9 | ** License. See the file COPYING in the main directory of this archive | ||
10 | ** for more details. | ||
11 | ** | ||
12 | ** Created: 20 Feb 1994 by Robert de Vries | ||
13 | */ | ||
14 | |||
15 | #ifndef _LINUX_ATARIKB_H | ||
16 | #define _LINUX_ATARIKB_H | ||
17 | |||
18 | void ikbd_write(const char *, int); | ||
19 | void ikbd_mouse_button_action(int mode); | ||
20 | void ikbd_mouse_rel_pos(void); | ||
21 | void ikbd_mouse_abs_pos(int xmax, int ymax); | ||
22 | void ikbd_mouse_kbd_mode(int dx, int dy); | ||
23 | void ikbd_mouse_thresh(int x, int y); | ||
24 | void ikbd_mouse_scale(int x, int y); | ||
25 | void ikbd_mouse_pos_get(int *x, int *y); | ||
26 | void ikbd_mouse_pos_set(int x, int y); | ||
27 | void ikbd_mouse_y0_bot(void); | ||
28 | void ikbd_mouse_y0_top(void); | ||
29 | void ikbd_mouse_disable(void); | ||
30 | void ikbd_joystick_event_on(void); | ||
31 | void ikbd_joystick_event_off(void); | ||
32 | void ikbd_joystick_get_state(void); | ||
33 | void ikbd_joystick_disable(void); | ||
34 | |||
35 | /* Hook for MIDI serial driver */ | ||
36 | extern void (*atari_MIDI_interrupt_hook) (void); | ||
37 | /* Hook for mouse driver */ | ||
38 | extern void (*atari_mouse_interrupt_hook) (char *); | ||
39 | |||
40 | #endif /* _LINUX_ATARIKB_H */ | ||
diff --git a/include/asm-m68k/atomic.h b/include/asm-m68k/atomic.h new file mode 100644 index 000000000000..38f3043e7fe1 --- /dev/null +++ b/include/asm-m68k/atomic.h | |||
@@ -0,0 +1,148 @@ | |||
1 | #ifndef __ARCH_M68K_ATOMIC__ | ||
2 | #define __ARCH_M68K_ATOMIC__ | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | |||
6 | #include <asm/system.h> /* local_irq_XXX() */ | ||
7 | |||
8 | /* | ||
9 | * Atomic operations that C can't guarantee us. Useful for | ||
10 | * resource counting etc.. | ||
11 | */ | ||
12 | |||
13 | /* | ||
14 | * We do not have SMP m68k systems, so we don't have to deal with that. | ||
15 | */ | ||
16 | |||
17 | typedef struct { int counter; } atomic_t; | ||
18 | #define ATOMIC_INIT(i) { (i) } | ||
19 | |||
20 | #define atomic_read(v) ((v)->counter) | ||
21 | #define atomic_set(v, i) (((v)->counter) = i) | ||
22 | |||
23 | static inline void atomic_add(int i, atomic_t *v) | ||
24 | { | ||
25 | __asm__ __volatile__("addl %1,%0" : "+m" (*v) : "id" (i)); | ||
26 | } | ||
27 | |||
28 | static inline void atomic_sub(int i, atomic_t *v) | ||
29 | { | ||
30 | __asm__ __volatile__("subl %1,%0" : "+m" (*v) : "id" (i)); | ||
31 | } | ||
32 | |||
33 | static inline void atomic_inc(atomic_t *v) | ||
34 | { | ||
35 | __asm__ __volatile__("addql #1,%0" : "+m" (*v)); | ||
36 | } | ||
37 | |||
38 | static inline void atomic_dec(atomic_t *v) | ||
39 | { | ||
40 | __asm__ __volatile__("subql #1,%0" : "+m" (*v)); | ||
41 | } | ||
42 | |||
43 | static inline int atomic_dec_and_test(atomic_t *v) | ||
44 | { | ||
45 | char c; | ||
46 | __asm__ __volatile__("subql #1,%1; seq %0" : "=d" (c), "+m" (*v)); | ||
47 | return c != 0; | ||
48 | } | ||
49 | |||
50 | static inline int atomic_inc_and_test(atomic_t *v) | ||
51 | { | ||
52 | char c; | ||
53 | __asm__ __volatile__("addql #1,%1; seq %0" : "=d" (c), "+m" (*v)); | ||
54 | return c != 0; | ||
55 | } | ||
56 | |||
57 | #ifdef CONFIG_RMW_INSNS | ||
58 | static inline int atomic_add_return(int i, atomic_t *v) | ||
59 | { | ||
60 | int t, tmp; | ||
61 | |||
62 | __asm__ __volatile__( | ||
63 | "1: movel %2,%1\n" | ||
64 | " addl %3,%1\n" | ||
65 | " casl %2,%1,%0\n" | ||
66 | " jne 1b" | ||
67 | : "+m" (*v), "=&d" (t), "=&d" (tmp) | ||
68 | : "g" (i), "2" (atomic_read(v))); | ||
69 | return t; | ||
70 | } | ||
71 | |||
72 | static inline int atomic_sub_return(int i, atomic_t *v) | ||
73 | { | ||
74 | int t, tmp; | ||
75 | |||
76 | __asm__ __volatile__( | ||
77 | "1: movel %2,%1\n" | ||
78 | " subl %3,%1\n" | ||
79 | " casl %2,%1,%0\n" | ||
80 | " jne 1b" | ||
81 | : "+m" (*v), "=&d" (t), "=&d" (tmp) | ||
82 | : "g" (i), "2" (atomic_read(v))); | ||
83 | return t; | ||
84 | } | ||
85 | #else /* !CONFIG_RMW_INSNS */ | ||
86 | static inline int atomic_add_return(int i, atomic_t * v) | ||
87 | { | ||
88 | unsigned long flags; | ||
89 | int t; | ||
90 | |||
91 | local_irq_save(flags); | ||
92 | t = atomic_read(v); | ||
93 | t += i; | ||
94 | atomic_set(v, t); | ||
95 | local_irq_restore(flags); | ||
96 | |||
97 | return t; | ||
98 | } | ||
99 | |||
100 | static inline int atomic_sub_return(int i, atomic_t * v) | ||
101 | { | ||
102 | unsigned long flags; | ||
103 | int t; | ||
104 | |||
105 | local_irq_save(flags); | ||
106 | t = atomic_read(v); | ||
107 | t -= i; | ||
108 | atomic_set(v, t); | ||
109 | local_irq_restore(flags); | ||
110 | |||
111 | return t; | ||
112 | } | ||
113 | #endif /* !CONFIG_RMW_INSNS */ | ||
114 | |||
115 | #define atomic_dec_return(v) atomic_sub_return(1, (v)) | ||
116 | #define atomic_inc_return(v) atomic_add_return(1, (v)) | ||
117 | |||
118 | static inline int atomic_sub_and_test(int i, atomic_t *v) | ||
119 | { | ||
120 | char c; | ||
121 | __asm__ __volatile__("subl %2,%1; seq %0" : "=d" (c), "+m" (*v): "g" (i)); | ||
122 | return c != 0; | ||
123 | } | ||
124 | |||
125 | static inline int atomic_add_negative(int i, atomic_t *v) | ||
126 | { | ||
127 | char c; | ||
128 | __asm__ __volatile__("addl %2,%1; smi %0" : "=d" (c), "+m" (*v): "g" (i)); | ||
129 | return c != 0; | ||
130 | } | ||
131 | |||
132 | static inline void atomic_clear_mask(unsigned long mask, unsigned long *v) | ||
133 | { | ||
134 | __asm__ __volatile__("andl %1,%0" : "+m" (*v) : "id" (~(mask))); | ||
135 | } | ||
136 | |||
137 | static inline void atomic_set_mask(unsigned long mask, unsigned long *v) | ||
138 | { | ||
139 | __asm__ __volatile__("orl %1,%0" : "+m" (*v) : "id" (mask)); | ||
140 | } | ||
141 | |||
142 | /* Atomic operations are already serializing */ | ||
143 | #define smp_mb__before_atomic_dec() barrier() | ||
144 | #define smp_mb__after_atomic_dec() barrier() | ||
145 | #define smp_mb__before_atomic_inc() barrier() | ||
146 | #define smp_mb__after_atomic_inc() barrier() | ||
147 | |||
148 | #endif /* __ARCH_M68K_ATOMIC __ */ | ||
diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h new file mode 100644 index 000000000000..b1bcf7c66516 --- /dev/null +++ b/include/asm-m68k/bitops.h | |||
@@ -0,0 +1,436 @@ | |||
1 | #ifndef _M68K_BITOPS_H | ||
2 | #define _M68K_BITOPS_H | ||
3 | /* | ||
4 | * Copyright 1992, Linus Torvalds. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file COPYING in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/compiler.h> | ||
12 | |||
13 | /* | ||
14 | * Require 68020 or better. | ||
15 | * | ||
16 | * They use the standard big-endian m680x0 bit ordering. | ||
17 | */ | ||
18 | |||
19 | #define test_and_set_bit(nr,vaddr) \ | ||
20 | (__builtin_constant_p(nr) ? \ | ||
21 | __constant_test_and_set_bit(nr, vaddr) : \ | ||
22 | __generic_test_and_set_bit(nr, vaddr)) | ||
23 | |||
24 | #define __test_and_set_bit(nr,vaddr) test_and_set_bit(nr,vaddr) | ||
25 | |||
26 | static inline int __constant_test_and_set_bit(int nr, unsigned long *vaddr) | ||
27 | { | ||
28 | char *p = (char *)vaddr + (nr ^ 31) / 8; | ||
29 | char retval; | ||
30 | |||
31 | __asm__ __volatile__ ("bset %2,%1; sne %0" | ||
32 | : "=d" (retval), "+m" (*p) | ||
33 | : "di" (nr & 7)); | ||
34 | |||
35 | return retval; | ||
36 | } | ||
37 | |||
38 | static inline int __generic_test_and_set_bit(int nr, unsigned long *vaddr) | ||
39 | { | ||
40 | char retval; | ||
41 | |||
42 | __asm__ __volatile__ ("bfset %2{%1:#1}; sne %0" | ||
43 | : "=d" (retval) : "d" (nr^31), "o" (*vaddr) : "memory"); | ||
44 | |||
45 | return retval; | ||
46 | } | ||
47 | |||
48 | #define set_bit(nr,vaddr) \ | ||
49 | (__builtin_constant_p(nr) ? \ | ||
50 | __constant_set_bit(nr, vaddr) : \ | ||
51 | __generic_set_bit(nr, vaddr)) | ||
52 | |||
53 | #define __set_bit(nr,vaddr) set_bit(nr,vaddr) | ||
54 | |||
55 | static inline void __constant_set_bit(int nr, volatile unsigned long *vaddr) | ||
56 | { | ||
57 | char *p = (char *)vaddr + (nr ^ 31) / 8; | ||
58 | __asm__ __volatile__ ("bset %1,%0" | ||
59 | : "+m" (*p) : "di" (nr & 7)); | ||
60 | } | ||
61 | |||
62 | static inline void __generic_set_bit(int nr, volatile unsigned long *vaddr) | ||
63 | { | ||
64 | __asm__ __volatile__ ("bfset %1{%0:#1}" | ||
65 | : : "d" (nr^31), "o" (*vaddr) : "memory"); | ||
66 | } | ||
67 | |||
68 | #define test_and_clear_bit(nr,vaddr) \ | ||
69 | (__builtin_constant_p(nr) ? \ | ||
70 | __constant_test_and_clear_bit(nr, vaddr) : \ | ||
71 | __generic_test_and_clear_bit(nr, vaddr)) | ||
72 | |||
73 | #define __test_and_clear_bit(nr,vaddr) test_and_clear_bit(nr,vaddr) | ||
74 | |||
75 | static inline int __constant_test_and_clear_bit(int nr, unsigned long *vaddr) | ||
76 | { | ||
77 | char *p = (char *)vaddr + (nr ^ 31) / 8; | ||
78 | char retval; | ||
79 | |||
80 | __asm__ __volatile__ ("bclr %2,%1; sne %0" | ||
81 | : "=d" (retval), "+m" (*p) | ||
82 | : "di" (nr & 7)); | ||
83 | |||
84 | return retval; | ||
85 | } | ||
86 | |||
87 | static inline int __generic_test_and_clear_bit(int nr, unsigned long *vaddr) | ||
88 | { | ||
89 | char retval; | ||
90 | |||
91 | __asm__ __volatile__ ("bfclr %2{%1:#1}; sne %0" | ||
92 | : "=d" (retval) : "d" (nr^31), "o" (*vaddr) : "memory"); | ||
93 | |||
94 | return retval; | ||
95 | } | ||
96 | |||
97 | /* | ||
98 | * clear_bit() doesn't provide any barrier for the compiler. | ||
99 | */ | ||
100 | #define smp_mb__before_clear_bit() barrier() | ||
101 | #define smp_mb__after_clear_bit() barrier() | ||
102 | |||
103 | #define clear_bit(nr,vaddr) \ | ||
104 | (__builtin_constant_p(nr) ? \ | ||
105 | __constant_clear_bit(nr, vaddr) : \ | ||
106 | __generic_clear_bit(nr, vaddr)) | ||
107 | #define __clear_bit(nr,vaddr) clear_bit(nr,vaddr) | ||
108 | |||
109 | static inline void __constant_clear_bit(int nr, volatile unsigned long *vaddr) | ||
110 | { | ||
111 | char *p = (char *)vaddr + (nr ^ 31) / 8; | ||
112 | __asm__ __volatile__ ("bclr %1,%0" | ||
113 | : "+m" (*p) : "di" (nr & 7)); | ||
114 | } | ||
115 | |||
116 | static inline void __generic_clear_bit(int nr, volatile unsigned long *vaddr) | ||
117 | { | ||
118 | __asm__ __volatile__ ("bfclr %1{%0:#1}" | ||
119 | : : "d" (nr^31), "o" (*vaddr) : "memory"); | ||
120 | } | ||
121 | |||
122 | #define test_and_change_bit(nr,vaddr) \ | ||
123 | (__builtin_constant_p(nr) ? \ | ||
124 | __constant_test_and_change_bit(nr, vaddr) : \ | ||
125 | __generic_test_and_change_bit(nr, vaddr)) | ||
126 | |||
127 | #define __test_and_change_bit(nr,vaddr) test_and_change_bit(nr,vaddr) | ||
128 | #define __change_bit(nr,vaddr) change_bit(nr,vaddr) | ||
129 | |||
130 | static inline int __constant_test_and_change_bit(int nr, unsigned long *vaddr) | ||
131 | { | ||
132 | char *p = (char *)vaddr + (nr ^ 31) / 8; | ||
133 | char retval; | ||
134 | |||
135 | __asm__ __volatile__ ("bchg %2,%1; sne %0" | ||
136 | : "=d" (retval), "+m" (*p) | ||
137 | : "di" (nr & 7)); | ||
138 | |||
139 | return retval; | ||
140 | } | ||
141 | |||
142 | static inline int __generic_test_and_change_bit(int nr, unsigned long *vaddr) | ||
143 | { | ||
144 | char retval; | ||
145 | |||
146 | __asm__ __volatile__ ("bfchg %2{%1:#1}; sne %0" | ||
147 | : "=d" (retval) : "d" (nr^31), "o" (*vaddr) : "memory"); | ||
148 | |||
149 | return retval; | ||
150 | } | ||
151 | |||
152 | #define change_bit(nr,vaddr) \ | ||
153 | (__builtin_constant_p(nr) ? \ | ||
154 | __constant_change_bit(nr, vaddr) : \ | ||
155 | __generic_change_bit(nr, vaddr)) | ||
156 | |||
157 | static inline void __constant_change_bit(int nr, unsigned long *vaddr) | ||
158 | { | ||
159 | char *p = (char *)vaddr + (nr ^ 31) / 8; | ||
160 | __asm__ __volatile__ ("bchg %1,%0" | ||
161 | : "+m" (*p) : "di" (nr & 7)); | ||
162 | } | ||
163 | |||
164 | static inline void __generic_change_bit(int nr, unsigned long *vaddr) | ||
165 | { | ||
166 | __asm__ __volatile__ ("bfchg %1{%0:#1}" | ||
167 | : : "d" (nr^31), "o" (*vaddr) : "memory"); | ||
168 | } | ||
169 | |||
170 | static inline int test_bit(int nr, const unsigned long *vaddr) | ||
171 | { | ||
172 | return (vaddr[nr >> 5] & (1UL << (nr & 31))) != 0; | ||
173 | } | ||
174 | |||
175 | static inline int find_first_zero_bit(const unsigned long *vaddr, | ||
176 | unsigned size) | ||
177 | { | ||
178 | const unsigned long *p = vaddr; | ||
179 | int res = 32; | ||
180 | unsigned long num; | ||
181 | |||
182 | if (!size) | ||
183 | return 0; | ||
184 | |||
185 | size = (size + 31) >> 5; | ||
186 | while (!(num = ~*p++)) { | ||
187 | if (!--size) | ||
188 | goto out; | ||
189 | } | ||
190 | |||
191 | __asm__ __volatile__ ("bfffo %1{#0,#0},%0" | ||
192 | : "=d" (res) : "d" (num & -num)); | ||
193 | res ^= 31; | ||
194 | out: | ||
195 | return ((long)p - (long)vaddr - 4) * 8 + res; | ||
196 | } | ||
197 | |||
198 | static inline int find_next_zero_bit(const unsigned long *vaddr, int size, | ||
199 | int offset) | ||
200 | { | ||
201 | const unsigned long *p = vaddr + (offset >> 5); | ||
202 | int bit = offset & 31UL, res; | ||
203 | |||
204 | if (offset >= size) | ||
205 | return size; | ||
206 | |||
207 | if (bit) { | ||
208 | unsigned long num = ~*p++ & (~0UL << bit); | ||
209 | offset -= bit; | ||
210 | |||
211 | /* Look for zero in first longword */ | ||
212 | __asm__ __volatile__ ("bfffo %1{#0,#0},%0" | ||
213 | : "=d" (res) : "d" (num & -num)); | ||
214 | if (res < 32) | ||
215 | return offset + (res ^ 31); | ||
216 | offset += 32; | ||
217 | } | ||
218 | /* No zero yet, search remaining full bytes for a zero */ | ||
219 | res = find_first_zero_bit(p, size - ((long)p - (long)vaddr) * 8); | ||
220 | return offset + res; | ||
221 | } | ||
222 | |||
223 | static inline int find_first_bit(const unsigned long *vaddr, unsigned size) | ||
224 | { | ||
225 | const unsigned long *p = vaddr; | ||
226 | int res = 32; | ||
227 | unsigned long num; | ||
228 | |||
229 | if (!size) | ||
230 | return 0; | ||
231 | |||
232 | size = (size + 31) >> 5; | ||
233 | while (!(num = *p++)) { | ||
234 | if (!--size) | ||
235 | goto out; | ||
236 | } | ||
237 | |||
238 | __asm__ __volatile__ ("bfffo %1{#0,#0},%0" | ||
239 | : "=d" (res) : "d" (num & -num)); | ||
240 | res ^= 31; | ||
241 | out: | ||
242 | return ((long)p - (long)vaddr - 4) * 8 + res; | ||
243 | } | ||
244 | |||
245 | static inline int find_next_bit(const unsigned long *vaddr, int size, | ||
246 | int offset) | ||
247 | { | ||
248 | const unsigned long *p = vaddr + (offset >> 5); | ||
249 | int bit = offset & 31UL, res; | ||
250 | |||
251 | if (offset >= size) | ||
252 | return size; | ||
253 | |||
254 | if (bit) { | ||
255 | unsigned long num = *p++ & (~0UL << bit); | ||
256 | offset -= bit; | ||
257 | |||
258 | /* Look for one in first longword */ | ||
259 | __asm__ __volatile__ ("bfffo %1{#0,#0},%0" | ||
260 | : "=d" (res) : "d" (num & -num)); | ||
261 | if (res < 32) | ||
262 | return offset + (res ^ 31); | ||
263 | offset += 32; | ||
264 | } | ||
265 | /* No one yet, search remaining full bytes for a one */ | ||
266 | res = find_first_bit(p, size - ((long)p - (long)vaddr) * 8); | ||
267 | return offset + res; | ||
268 | } | ||
269 | |||
270 | /* | ||
271 | * ffz = Find First Zero in word. Undefined if no zero exists, | ||
272 | * so code should check against ~0UL first.. | ||
273 | */ | ||
274 | static inline unsigned long ffz(unsigned long word) | ||
275 | { | ||
276 | int res; | ||
277 | |||
278 | __asm__ __volatile__ ("bfffo %1{#0,#0},%0" | ||
279 | : "=d" (res) : "d" (~word & -~word)); | ||
280 | return res ^ 31; | ||
281 | } | ||
282 | |||
283 | #ifdef __KERNEL__ | ||
284 | |||
285 | /* | ||
286 | * ffs: find first bit set. This is defined the same way as | ||
287 | * the libc and compiler builtin ffs routines, therefore | ||
288 | * differs in spirit from the above ffz (man ffs). | ||
289 | */ | ||
290 | |||
291 | static inline int ffs(int x) | ||
292 | { | ||
293 | int cnt; | ||
294 | |||
295 | asm ("bfffo %1{#0:#0},%0" : "=d" (cnt) : "dm" (x & -x)); | ||
296 | |||
297 | return 32 - cnt; | ||
298 | } | ||
299 | #define __ffs(x) (ffs(x) - 1) | ||
300 | |||
301 | /* | ||
302 | * fls: find last bit set. | ||
303 | */ | ||
304 | |||
305 | static inline int fls(int x) | ||
306 | { | ||
307 | int cnt; | ||
308 | |||
309 | asm ("bfffo %1{#0,#0},%0" : "=d" (cnt) : "dm" (x)); | ||
310 | |||
311 | return 32 - cnt; | ||
312 | } | ||
313 | |||
314 | /* | ||
315 | * Every architecture must define this function. It's the fastest | ||
316 | * way of searching a 140-bit bitmap where the first 100 bits are | ||
317 | * unlikely to be set. It's guaranteed that at least one of the 140 | ||
318 | * bits is cleared. | ||
319 | */ | ||
320 | static inline int sched_find_first_bit(const unsigned long *b) | ||
321 | { | ||
322 | if (unlikely(b[0])) | ||
323 | return __ffs(b[0]); | ||
324 | if (unlikely(b[1])) | ||
325 | return __ffs(b[1]) + 32; | ||
326 | if (unlikely(b[2])) | ||
327 | return __ffs(b[2]) + 64; | ||
328 | if (b[3]) | ||
329 | return __ffs(b[3]) + 96; | ||
330 | return __ffs(b[4]) + 128; | ||
331 | } | ||
332 | |||
333 | |||
334 | /* | ||
335 | * hweightN: returns the hamming weight (i.e. the number | ||
336 | * of bits set) of a N-bit word | ||
337 | */ | ||
338 | |||
339 | #define hweight32(x) generic_hweight32(x) | ||
340 | #define hweight16(x) generic_hweight16(x) | ||
341 | #define hweight8(x) generic_hweight8(x) | ||
342 | |||
343 | /* Bitmap functions for the minix filesystem */ | ||
344 | |||
345 | static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size) | ||
346 | { | ||
347 | const unsigned short *p = vaddr, *addr = vaddr; | ||
348 | int res; | ||
349 | unsigned short num; | ||
350 | |||
351 | if (!size) | ||
352 | return 0; | ||
353 | |||
354 | size = (size >> 4) + ((size & 15) > 0); | ||
355 | while (*p++ == 0xffff) | ||
356 | { | ||
357 | if (--size == 0) | ||
358 | return (p - addr) << 4; | ||
359 | } | ||
360 | |||
361 | num = ~*--p; | ||
362 | __asm__ __volatile__ ("bfffo %1{#16,#16},%0" | ||
363 | : "=d" (res) : "d" (num & -num)); | ||
364 | return ((p - addr) << 4) + (res ^ 31); | ||
365 | } | ||
366 | |||
367 | #define minix_test_and_set_bit(nr, addr) test_and_set_bit((nr) ^ 16, (unsigned long *)(addr)) | ||
368 | #define minix_set_bit(nr,addr) set_bit((nr) ^ 16, (unsigned long *)(addr)) | ||
369 | #define minix_test_and_clear_bit(nr, addr) test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr)) | ||
370 | |||
371 | static inline int minix_test_bit(int nr, const void *vaddr) | ||
372 | { | ||
373 | const unsigned short *p = vaddr; | ||
374 | return (p[nr >> 4] & (1U << (nr & 15))) != 0; | ||
375 | } | ||
376 | |||
377 | /* Bitmap functions for the ext2 filesystem. */ | ||
378 | |||
379 | #define ext2_set_bit(nr, addr) test_and_set_bit((nr) ^ 24, (unsigned long *)(addr)) | ||
380 | #define ext2_set_bit_atomic(lock, nr, addr) test_and_set_bit((nr) ^ 24, (unsigned long *)(addr)) | ||
381 | #define ext2_clear_bit(nr, addr) test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr)) | ||
382 | #define ext2_clear_bit_atomic(lock, nr, addr) test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr)) | ||
383 | |||
384 | static inline int ext2_test_bit(int nr, const void *vaddr) | ||
385 | { | ||
386 | const unsigned char *p = vaddr; | ||
387 | return (p[nr >> 3] & (1U << (nr & 7))) != 0; | ||
388 | } | ||
389 | |||
390 | static inline int ext2_find_first_zero_bit(const void *vaddr, unsigned size) | ||
391 | { | ||
392 | const unsigned long *p = vaddr, *addr = vaddr; | ||
393 | int res; | ||
394 | |||
395 | if (!size) | ||
396 | return 0; | ||
397 | |||
398 | size = (size >> 5) + ((size & 31) > 0); | ||
399 | while (*p++ == ~0UL) | ||
400 | { | ||
401 | if (--size == 0) | ||
402 | return (p - addr) << 5; | ||
403 | } | ||
404 | |||
405 | --p; | ||
406 | for (res = 0; res < 32; res++) | ||
407 | if (!ext2_test_bit (res, p)) | ||
408 | break; | ||
409 | return (p - addr) * 32 + res; | ||
410 | } | ||
411 | |||
412 | static inline int ext2_find_next_zero_bit(const void *vaddr, unsigned size, | ||
413 | unsigned offset) | ||
414 | { | ||
415 | const unsigned long *addr = vaddr; | ||
416 | const unsigned long *p = addr + (offset >> 5); | ||
417 | int bit = offset & 31UL, res; | ||
418 | |||
419 | if (offset >= size) | ||
420 | return size; | ||
421 | |||
422 | if (bit) { | ||
423 | /* Look for zero in first longword */ | ||
424 | for (res = bit; res < 32; res++) | ||
425 | if (!ext2_test_bit (res, p)) | ||
426 | return (p - addr) * 32 + res; | ||
427 | p++; | ||
428 | } | ||
429 | /* No zero yet, search remaining full bytes for a zero */ | ||
430 | res = ext2_find_first_zero_bit (p, size - 32 * (p - addr)); | ||
431 | return (p - addr) * 32 + res; | ||
432 | } | ||
433 | |||
434 | #endif /* __KERNEL__ */ | ||
435 | |||
436 | #endif /* _M68K_BITOPS_H */ | ||
diff --git a/include/asm-m68k/blinken.h b/include/asm-m68k/blinken.h new file mode 100644 index 000000000000..1a749cf7b06d --- /dev/null +++ b/include/asm-m68k/blinken.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | ** asm/blinken.h -- m68k blinkenlights support (currently hp300 only) | ||
3 | ** | ||
4 | ** (c) 1998 Phil Blundell <philb@gnu.org> | ||
5 | ** | ||
6 | ** This file is subject to the terms and conditions of the GNU General Public | ||
7 | ** License. See the file COPYING in the main directory of this archive | ||
8 | ** for more details. | ||
9 | ** | ||
10 | */ | ||
11 | |||
12 | #ifndef _M68K_BLINKEN_H | ||
13 | #define _M68K_BLINKEN_H | ||
14 | |||
15 | #include <asm/setup.h> | ||
16 | #include <asm/io.h> | ||
17 | |||
18 | #define HP300_LEDS 0xf001ffff | ||
19 | |||
20 | extern unsigned char ledstate; | ||
21 | |||
22 | static __inline__ void blinken_leds(int on, int off) | ||
23 | { | ||
24 | if (MACH_IS_HP300) | ||
25 | { | ||
26 | ledstate |= on; | ||
27 | ledstate &= ~off; | ||
28 | out_8(HP300_LEDS, ~ledstate); | ||
29 | } | ||
30 | } | ||
31 | |||
32 | #endif | ||
diff --git a/include/asm-m68k/bootinfo.h b/include/asm-m68k/bootinfo.h new file mode 100644 index 000000000000..fb8a06b9ab6a --- /dev/null +++ b/include/asm-m68k/bootinfo.h | |||
@@ -0,0 +1,378 @@ | |||
1 | /* | ||
2 | ** asm/bootinfo.h -- Definition of the Linux/m68k boot information structure | ||
3 | ** | ||
4 | ** Copyright 1992 by Greg Harp | ||
5 | ** | ||
6 | ** This file is subject to the terms and conditions of the GNU General Public | ||
7 | ** License. See the file COPYING in the main directory of this archive | ||
8 | ** for more details. | ||
9 | ** | ||
10 | ** Created 09/29/92 by Greg Harp | ||
11 | ** | ||
12 | ** 5/2/94 Roman Hodek: | ||
13 | ** Added bi_atari part of the machine dependent union bi_un; for now it | ||
14 | ** contains just a model field to distinguish between TT and Falcon. | ||
15 | ** 26/7/96 Roman Zippel: | ||
16 | ** Renamed to setup.h; added some useful macros to allow gcc some | ||
17 | ** optimizations if possible. | ||
18 | ** 5/10/96 Geert Uytterhoeven: | ||
19 | ** Redesign of the boot information structure; renamed to bootinfo.h again | ||
20 | ** 27/11/96 Geert Uytterhoeven: | ||
21 | ** Backwards compatibility with bootinfo interface version 1.0 | ||
22 | */ | ||
23 | |||
24 | #ifndef _M68K_BOOTINFO_H | ||
25 | #define _M68K_BOOTINFO_H | ||
26 | |||
27 | |||
28 | /* | ||
29 | * Bootinfo definitions | ||
30 | * | ||
31 | * This is an easily parsable and extendable structure containing all | ||
32 | * information to be passed from the bootstrap to the kernel. | ||
33 | * | ||
34 | * This way I hope to keep all future changes back/forewards compatible. | ||
35 | * Thus, keep your fingers crossed... | ||
36 | * | ||
37 | * This structure is copied right after the kernel bss by the bootstrap | ||
38 | * routine. | ||
39 | */ | ||
40 | |||
41 | #ifndef __ASSEMBLY__ | ||
42 | |||
43 | struct bi_record { | ||
44 | unsigned short tag; /* tag ID */ | ||
45 | unsigned short size; /* size of record (in bytes) */ | ||
46 | unsigned long data[0]; /* data */ | ||
47 | }; | ||
48 | |||
49 | #endif /* __ASSEMBLY__ */ | ||
50 | |||
51 | |||
52 | /* | ||
53 | * Tag Definitions | ||
54 | * | ||
55 | * Machine independent tags start counting from 0x0000 | ||
56 | * Machine dependent tags start counting from 0x8000 | ||
57 | */ | ||
58 | |||
59 | #define BI_LAST 0x0000 /* last record (sentinel) */ | ||
60 | #define BI_MACHTYPE 0x0001 /* machine type (u_long) */ | ||
61 | #define BI_CPUTYPE 0x0002 /* cpu type (u_long) */ | ||
62 | #define BI_FPUTYPE 0x0003 /* fpu type (u_long) */ | ||
63 | #define BI_MMUTYPE 0x0004 /* mmu type (u_long) */ | ||
64 | #define BI_MEMCHUNK 0x0005 /* memory chunk address and size */ | ||
65 | /* (struct mem_info) */ | ||
66 | #define BI_RAMDISK 0x0006 /* ramdisk address and size */ | ||
67 | /* (struct mem_info) */ | ||
68 | #define BI_COMMAND_LINE 0x0007 /* kernel command line parameters */ | ||
69 | /* (string) */ | ||
70 | |||
71 | /* | ||
72 | * Amiga-specific tags | ||
73 | */ | ||
74 | |||
75 | #define BI_AMIGA_MODEL 0x8000 /* model (u_long) */ | ||
76 | #define BI_AMIGA_AUTOCON 0x8001 /* AutoConfig device */ | ||
77 | /* (struct ConfigDev) */ | ||
78 | #define BI_AMIGA_CHIP_SIZE 0x8002 /* size of Chip RAM (u_long) */ | ||
79 | #define BI_AMIGA_VBLANK 0x8003 /* VBLANK frequency (u_char) */ | ||
80 | #define BI_AMIGA_PSFREQ 0x8004 /* power supply frequency (u_char) */ | ||
81 | #define BI_AMIGA_ECLOCK 0x8005 /* EClock frequency (u_long) */ | ||
82 | #define BI_AMIGA_CHIPSET 0x8006 /* native chipset present (u_long) */ | ||
83 | #define BI_AMIGA_SERPER 0x8007 /* serial port period (u_short) */ | ||
84 | |||
85 | /* | ||
86 | * Atari-specific tags | ||
87 | */ | ||
88 | |||
89 | #define BI_ATARI_MCH_COOKIE 0x8000 /* _MCH cookie from TOS (u_long) */ | ||
90 | #define BI_ATARI_MCH_TYPE 0x8001 /* special machine type (u_long) */ | ||
91 | /* (values are ATARI_MACH_* defines */ | ||
92 | |||
93 | /* mch_cookie values (upper word) */ | ||
94 | #define ATARI_MCH_ST 0 | ||
95 | #define ATARI_MCH_STE 1 | ||
96 | #define ATARI_MCH_TT 2 | ||
97 | #define ATARI_MCH_FALCON 3 | ||
98 | |||
99 | /* mch_type values */ | ||
100 | #define ATARI_MACH_NORMAL 0 /* no special machine type */ | ||
101 | #define ATARI_MACH_MEDUSA 1 /* Medusa 040 */ | ||
102 | #define ATARI_MACH_HADES 2 /* Hades 040 or 060 */ | ||
103 | #define ATARI_MACH_AB40 3 /* Afterburner040 on Falcon */ | ||
104 | |||
105 | /* | ||
106 | * VME-specific tags | ||
107 | */ | ||
108 | |||
109 | #define BI_VME_TYPE 0x8000 /* VME sub-architecture (u_long) */ | ||
110 | #define BI_VME_BRDINFO 0x8001 /* VME board information (struct) */ | ||
111 | |||
112 | /* BI_VME_TYPE codes */ | ||
113 | #define VME_TYPE_TP34V 0x0034 /* Tadpole TP34V */ | ||
114 | #define VME_TYPE_MVME147 0x0147 /* Motorola MVME147 */ | ||
115 | #define VME_TYPE_MVME162 0x0162 /* Motorola MVME162 */ | ||
116 | #define VME_TYPE_MVME166 0x0166 /* Motorola MVME166 */ | ||
117 | #define VME_TYPE_MVME167 0x0167 /* Motorola MVME167 */ | ||
118 | #define VME_TYPE_MVME172 0x0172 /* Motorola MVME172 */ | ||
119 | #define VME_TYPE_MVME177 0x0177 /* Motorola MVME177 */ | ||
120 | #define VME_TYPE_BVME4000 0x4000 /* BVM Ltd. BVME4000 */ | ||
121 | #define VME_TYPE_BVME6000 0x6000 /* BVM Ltd. BVME6000 */ | ||
122 | |||
123 | /* BI_VME_BRDINFO is a 32 byte struct as returned by the Bug code on | ||
124 | * Motorola VME boards. Contains board number, Bug version, board | ||
125 | * configuration options, etc. See include/asm/mvme16xhw.h for details. | ||
126 | */ | ||
127 | |||
128 | |||
129 | /* | ||
130 | * Macintosh-specific tags (all u_long) | ||
131 | */ | ||
132 | |||
133 | #define BI_MAC_MODEL 0x8000 /* Mac Gestalt ID (model type) */ | ||
134 | #define BI_MAC_VADDR 0x8001 /* Mac video base address */ | ||
135 | #define BI_MAC_VDEPTH 0x8002 /* Mac video depth */ | ||
136 | #define BI_MAC_VROW 0x8003 /* Mac video rowbytes */ | ||
137 | #define BI_MAC_VDIM 0x8004 /* Mac video dimensions */ | ||
138 | #define BI_MAC_VLOGICAL 0x8005 /* Mac video logical base */ | ||
139 | #define BI_MAC_SCCBASE 0x8006 /* Mac SCC base address */ | ||
140 | #define BI_MAC_BTIME 0x8007 /* Mac boot time */ | ||
141 | #define BI_MAC_GMTBIAS 0x8008 /* Mac GMT timezone offset */ | ||
142 | #define BI_MAC_MEMSIZE 0x8009 /* Mac RAM size (sanity check) */ | ||
143 | #define BI_MAC_CPUID 0x800a /* Mac CPU type (sanity check) */ | ||
144 | #define BI_MAC_ROMBASE 0x800b /* Mac system ROM base address */ | ||
145 | |||
146 | /* | ||
147 | * Macintosh hardware profile data - unused, see macintosh.h for | ||
148 | * resonable type values | ||
149 | */ | ||
150 | |||
151 | #define BI_MAC_VIA1BASE 0x8010 /* Mac VIA1 base address (always present) */ | ||
152 | #define BI_MAC_VIA2BASE 0x8011 /* Mac VIA2 base address (type varies) */ | ||
153 | #define BI_MAC_VIA2TYPE 0x8012 /* Mac VIA2 type (VIA, RBV, OSS) */ | ||
154 | #define BI_MAC_ADBTYPE 0x8013 /* Mac ADB interface type */ | ||
155 | #define BI_MAC_ASCBASE 0x8014 /* Mac Apple Sound Chip base address */ | ||
156 | #define BI_MAC_SCSI5380 0x8015 /* Mac NCR 5380 SCSI (base address, multi) */ | ||
157 | #define BI_MAC_SCSIDMA 0x8016 /* Mac SCSI DMA (base address) */ | ||
158 | #define BI_MAC_SCSI5396 0x8017 /* Mac NCR 53C96 SCSI (base address, multi) */ | ||
159 | #define BI_MAC_IDETYPE 0x8018 /* Mac IDE interface type */ | ||
160 | #define BI_MAC_IDEBASE 0x8019 /* Mac IDE interface base address */ | ||
161 | #define BI_MAC_NUBUS 0x801a /* Mac Nubus type (none, regular, pseudo) */ | ||
162 | #define BI_MAC_SLOTMASK 0x801b /* Mac Nubus slots present */ | ||
163 | #define BI_MAC_SCCTYPE 0x801c /* Mac SCC serial type (normal, IOP) */ | ||
164 | #define BI_MAC_ETHTYPE 0x801d /* Mac builtin ethernet type (Sonic, MACE */ | ||
165 | #define BI_MAC_ETHBASE 0x801e /* Mac builtin ethernet base address */ | ||
166 | #define BI_MAC_PMU 0x801f /* Mac power management / poweroff hardware */ | ||
167 | #define BI_MAC_IOP_SWIM 0x8020 /* Mac SWIM floppy IOP */ | ||
168 | #define BI_MAC_IOP_ADB 0x8021 /* Mac ADB IOP */ | ||
169 | |||
170 | /* | ||
171 | * Mac: compatibility with old booter data format (temporarily) | ||
172 | * Fields unused with the new bootinfo can be deleted now; instead of | ||
173 | * adding new fields the struct might be splitted into a hardware address | ||
174 | * part and a hardware type part | ||
175 | */ | ||
176 | |||
177 | #ifndef __ASSEMBLY__ | ||
178 | |||
179 | struct mac_booter_data | ||
180 | { | ||
181 | unsigned long videoaddr; | ||
182 | unsigned long videorow; | ||
183 | unsigned long videodepth; | ||
184 | unsigned long dimensions; | ||
185 | unsigned long args; | ||
186 | unsigned long boottime; | ||
187 | unsigned long gmtbias; | ||
188 | unsigned long bootver; | ||
189 | unsigned long videological; | ||
190 | unsigned long sccbase; | ||
191 | unsigned long id; | ||
192 | unsigned long memsize; | ||
193 | unsigned long serialmf; | ||
194 | unsigned long serialhsk; | ||
195 | unsigned long serialgpi; | ||
196 | unsigned long printmf; | ||
197 | unsigned long printhsk; | ||
198 | unsigned long printgpi; | ||
199 | unsigned long cpuid; | ||
200 | unsigned long rombase; | ||
201 | unsigned long adbdelay; | ||
202 | unsigned long timedbra; | ||
203 | }; | ||
204 | |||
205 | extern struct mac_booter_data | ||
206 | mac_bi_data; | ||
207 | |||
208 | #endif | ||
209 | |||
210 | /* | ||
211 | * Apollo-specific tags | ||
212 | */ | ||
213 | |||
214 | #define BI_APOLLO_MODEL 0x8000 /* model (u_long) */ | ||
215 | |||
216 | /* | ||
217 | * HP300-specific tags | ||
218 | */ | ||
219 | |||
220 | #define BI_HP300_MODEL 0x8000 /* model (u_long) */ | ||
221 | #define BI_HP300_UART_SCODE 0x8001 /* UART select code (u_long) */ | ||
222 | #define BI_HP300_UART_ADDR 0x8002 /* phys. addr of UART (u_long) */ | ||
223 | |||
224 | /* | ||
225 | * Stuff for bootinfo interface versioning | ||
226 | * | ||
227 | * At the start of kernel code, a 'struct bootversion' is located. | ||
228 | * bootstrap checks for a matching version of the interface before booting | ||
229 | * a kernel, to avoid user confusion if kernel and bootstrap don't work | ||
230 | * together :-) | ||
231 | * | ||
232 | * If incompatible changes are made to the bootinfo interface, the major | ||
233 | * number below should be stepped (and the minor reset to 0) for the | ||
234 | * appropriate machine. If a change is backward-compatible, the minor | ||
235 | * should be stepped. "Backwards-compatible" means that booting will work, | ||
236 | * but certain features may not. | ||
237 | */ | ||
238 | |||
239 | #define BOOTINFOV_MAGIC 0x4249561A /* 'BIV^Z' */ | ||
240 | #define MK_BI_VERSION(major,minor) (((major)<<16)+(minor)) | ||
241 | #define BI_VERSION_MAJOR(v) (((v) >> 16) & 0xffff) | ||
242 | #define BI_VERSION_MINOR(v) ((v) & 0xffff) | ||
243 | |||
244 | #ifndef __ASSEMBLY__ | ||
245 | |||
246 | struct bootversion { | ||
247 | unsigned short branch; | ||
248 | unsigned long magic; | ||
249 | struct { | ||
250 | unsigned long machtype; | ||
251 | unsigned long version; | ||
252 | } machversions[0]; | ||
253 | }; | ||
254 | |||
255 | #endif /* __ASSEMBLY__ */ | ||
256 | |||
257 | #define AMIGA_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) | ||
258 | #define ATARI_BOOTI_VERSION MK_BI_VERSION( 2, 1 ) | ||
259 | #define MAC_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) | ||
260 | #define MVME147_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) | ||
261 | #define MVME16x_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) | ||
262 | #define BVME6000_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) | ||
263 | #define Q40_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) | ||
264 | #define HP300_BOOTI_VERSION MK_BI_VERSION( 2, 0 ) | ||
265 | |||
266 | #ifdef BOOTINFO_COMPAT_1_0 | ||
267 | |||
268 | /* | ||
269 | * Backwards compatibility with bootinfo interface version 1.0 | ||
270 | */ | ||
271 | |||
272 | #define COMPAT_AMIGA_BOOTI_VERSION MK_BI_VERSION( 1, 0 ) | ||
273 | #define COMPAT_ATARI_BOOTI_VERSION MK_BI_VERSION( 1, 0 ) | ||
274 | #define COMPAT_MAC_BOOTI_VERSION MK_BI_VERSION( 1, 0 ) | ||
275 | |||
276 | #include <linux/zorro.h> | ||
277 | |||
278 | #define COMPAT_NUM_AUTO 16 | ||
279 | |||
280 | struct compat_bi_Amiga { | ||
281 | int model; | ||
282 | int num_autocon; | ||
283 | struct ConfigDev autocon[COMPAT_NUM_AUTO]; | ||
284 | unsigned long chip_size; | ||
285 | unsigned char vblank; | ||
286 | unsigned char psfreq; | ||
287 | unsigned long eclock; | ||
288 | unsigned long chipset; | ||
289 | unsigned long hw_present; | ||
290 | }; | ||
291 | |||
292 | struct compat_bi_Atari { | ||
293 | unsigned long hw_present; | ||
294 | unsigned long mch_cookie; | ||
295 | }; | ||
296 | |||
297 | #ifndef __ASSEMBLY__ | ||
298 | |||
299 | struct compat_bi_Macintosh | ||
300 | { | ||
301 | unsigned long videoaddr; | ||
302 | unsigned long videorow; | ||
303 | unsigned long videodepth; | ||
304 | unsigned long dimensions; | ||
305 | unsigned long args; | ||
306 | unsigned long boottime; | ||
307 | unsigned long gmtbias; | ||
308 | unsigned long bootver; | ||
309 | unsigned long videological; | ||
310 | unsigned long sccbase; | ||
311 | unsigned long id; | ||
312 | unsigned long memsize; | ||
313 | unsigned long serialmf; | ||
314 | unsigned long serialhsk; | ||
315 | unsigned long serialgpi; | ||
316 | unsigned long printmf; | ||
317 | unsigned long printhsk; | ||
318 | unsigned long printgpi; | ||
319 | unsigned long cpuid; | ||
320 | unsigned long rombase; | ||
321 | unsigned long adbdelay; | ||
322 | unsigned long timedbra; | ||
323 | }; | ||
324 | |||
325 | #endif | ||
326 | |||
327 | struct compat_mem_info { | ||
328 | unsigned long addr; | ||
329 | unsigned long size; | ||
330 | }; | ||
331 | |||
332 | #define COMPAT_NUM_MEMINFO 4 | ||
333 | |||
334 | #define COMPAT_CPUB_68020 0 | ||
335 | #define COMPAT_CPUB_68030 1 | ||
336 | #define COMPAT_CPUB_68040 2 | ||
337 | #define COMPAT_CPUB_68060 3 | ||
338 | #define COMPAT_FPUB_68881 5 | ||
339 | #define COMPAT_FPUB_68882 6 | ||
340 | #define COMPAT_FPUB_68040 7 | ||
341 | #define COMPAT_FPUB_68060 8 | ||
342 | |||
343 | #define COMPAT_CPU_68020 (1<<COMPAT_CPUB_68020) | ||
344 | #define COMPAT_CPU_68030 (1<<COMPAT_CPUB_68030) | ||
345 | #define COMPAT_CPU_68040 (1<<COMPAT_CPUB_68040) | ||
346 | #define COMPAT_CPU_68060 (1<<COMPAT_CPUB_68060) | ||
347 | #define COMPAT_CPU_MASK (31) | ||
348 | #define COMPAT_FPU_68881 (1<<COMPAT_FPUB_68881) | ||
349 | #define COMPAT_FPU_68882 (1<<COMPAT_FPUB_68882) | ||
350 | #define COMPAT_FPU_68040 (1<<COMPAT_FPUB_68040) | ||
351 | #define COMPAT_FPU_68060 (1<<COMPAT_FPUB_68060) | ||
352 | #define COMPAT_FPU_MASK (0xfe0) | ||
353 | |||
354 | #define COMPAT_CL_SIZE (256) | ||
355 | |||
356 | struct compat_bootinfo { | ||
357 | unsigned long machtype; | ||
358 | unsigned long cputype; | ||
359 | struct compat_mem_info memory[COMPAT_NUM_MEMINFO]; | ||
360 | int num_memory; | ||
361 | unsigned long ramdisk_size; | ||
362 | unsigned long ramdisk_addr; | ||
363 | char command_line[COMPAT_CL_SIZE]; | ||
364 | union { | ||
365 | struct compat_bi_Amiga bi_ami; | ||
366 | struct compat_bi_Atari bi_ata; | ||
367 | struct compat_bi_Macintosh bi_mac; | ||
368 | } bi_un; | ||
369 | }; | ||
370 | |||
371 | #define bi_amiga bi_un.bi_ami | ||
372 | #define bi_atari bi_un.bi_ata | ||
373 | #define bi_mac bi_un.bi_mac | ||
374 | |||
375 | #endif /* BOOTINFO_COMPAT_1_0 */ | ||
376 | |||
377 | |||
378 | #endif /* _M68K_BOOTINFO_H */ | ||
diff --git a/include/asm-m68k/bug.h b/include/asm-m68k/bug.h new file mode 100644 index 000000000000..3e1d2266fa69 --- /dev/null +++ b/include/asm-m68k/bug.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef _M68K_BUG_H | ||
2 | #define _M68K_BUG_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | |||
6 | #ifdef CONFIG_DEBUG_BUGVERBOSE | ||
7 | #ifndef CONFIG_SUN3 | ||
8 | #define BUG() do { \ | ||
9 | printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ | ||
10 | asm volatile("illegal"); \ | ||
11 | } while (0) | ||
12 | #else | ||
13 | #define BUG() do { \ | ||
14 | printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ | ||
15 | panic("BUG!"); \ | ||
16 | } while (0) | ||
17 | #endif | ||
18 | #else | ||
19 | #define BUG() do { \ | ||
20 | asm volatile("illegal"); \ | ||
21 | } while (0) | ||
22 | #endif | ||
23 | |||
24 | #define HAVE_ARCH_BUG | ||
25 | #include <asm-generic/bug.h> | ||
26 | |||
27 | #endif | ||
diff --git a/include/asm-m68k/bugs.h b/include/asm-m68k/bugs.h new file mode 100644 index 000000000000..d01935592410 --- /dev/null +++ b/include/asm-m68k/bugs.h | |||
@@ -0,0 +1,14 @@ | |||
1 | /* | ||
2 | * include/asm-m68k/bugs.h | ||
3 | * | ||
4 | * Copyright (C) 1994 Linus Torvalds | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * This is included by init/main.c to check for architecture-dependent bugs. | ||
9 | * | ||
10 | * Needs: | ||
11 | * void check_bugs(void); | ||
12 | */ | ||
13 | |||
14 | extern void check_bugs(void); /* in arch/m68k/kernel/setup.c */ | ||
diff --git a/include/asm-m68k/bvme6000hw.h b/include/asm-m68k/bvme6000hw.h new file mode 100644 index 000000000000..28a859b03959 --- /dev/null +++ b/include/asm-m68k/bvme6000hw.h | |||
@@ -0,0 +1,150 @@ | |||
1 | #ifndef _M68K_BVME6000HW_H_ | ||
2 | #define _M68K_BVME6000HW_H_ | ||
3 | |||
4 | #include <asm/irq.h> | ||
5 | |||
6 | /* | ||
7 | * PIT structure | ||
8 | */ | ||
9 | |||
10 | #define BVME_PIT_BASE 0xffa00000 | ||
11 | |||
12 | typedef struct { | ||
13 | unsigned char | ||
14 | pad_a[3], pgcr, | ||
15 | pad_b[3], psrr, | ||
16 | pad_c[3], paddr, | ||
17 | pad_d[3], pbddr, | ||
18 | pad_e[3], pcddr, | ||
19 | pad_f[3], pivr, | ||
20 | pad_g[3], pacr, | ||
21 | pad_h[3], pbcr, | ||
22 | pad_i[3], padr, | ||
23 | pad_j[3], pbdr, | ||
24 | pad_k[3], paar, | ||
25 | pad_l[3], pbar, | ||
26 | pad_m[3], pcdr, | ||
27 | pad_n[3], psr, | ||
28 | pad_o[3], res1, | ||
29 | pad_p[3], res2, | ||
30 | pad_q[3], tcr, | ||
31 | pad_r[3], tivr, | ||
32 | pad_s[3], res3, | ||
33 | pad_t[3], cprh, | ||
34 | pad_u[3], cprm, | ||
35 | pad_v[3], cprl, | ||
36 | pad_w[3], res4, | ||
37 | pad_x[3], crh, | ||
38 | pad_y[3], crm, | ||
39 | pad_z[3], crl, | ||
40 | pad_A[3], tsr, | ||
41 | pad_B[3], res5; | ||
42 | } PitRegs_t, *PitRegsPtr; | ||
43 | |||
44 | #define bvmepit ((*(volatile PitRegsPtr)(BVME_PIT_BASE))) | ||
45 | |||
46 | #define BVME_RTC_BASE 0xff900000 | ||
47 | |||
48 | typedef struct { | ||
49 | unsigned char | ||
50 | pad_a[3], msr, | ||
51 | pad_b[3], t0cr_rtmr, | ||
52 | pad_c[3], t1cr_omr, | ||
53 | pad_d[3], pfr_icr0, | ||
54 | pad_e[3], irr_icr1, | ||
55 | pad_f[3], bcd_tenms, | ||
56 | pad_g[3], bcd_sec, | ||
57 | pad_h[3], bcd_min, | ||
58 | pad_i[3], bcd_hr, | ||
59 | pad_j[3], bcd_dom, | ||
60 | pad_k[3], bcd_mth, | ||
61 | pad_l[3], bcd_year, | ||
62 | pad_m[3], bcd_ujcc, | ||
63 | pad_n[3], bcd_hjcc, | ||
64 | pad_o[3], bcd_dow, | ||
65 | pad_p[3], t0lsb, | ||
66 | pad_q[3], t0msb, | ||
67 | pad_r[3], t1lsb, | ||
68 | pad_s[3], t1msb, | ||
69 | pad_t[3], cmp_sec, | ||
70 | pad_u[3], cmp_min, | ||
71 | pad_v[3], cmp_hr, | ||
72 | pad_w[3], cmp_dom, | ||
73 | pad_x[3], cmp_mth, | ||
74 | pad_y[3], cmp_dow, | ||
75 | pad_z[3], sav_sec, | ||
76 | pad_A[3], sav_min, | ||
77 | pad_B[3], sav_hr, | ||
78 | pad_C[3], sav_dom, | ||
79 | pad_D[3], sav_mth, | ||
80 | pad_E[3], ram, | ||
81 | pad_F[3], test; | ||
82 | } RtcRegs_t, *RtcPtr_t; | ||
83 | |||
84 | |||
85 | #define BVME_I596_BASE 0xff100000 | ||
86 | |||
87 | #define BVME_ETHIRQ_REG 0xff20000b | ||
88 | |||
89 | #define BVME_LOCAL_IRQ_STAT 0xff20000f | ||
90 | |||
91 | #define BVME_ETHERR 0x02 | ||
92 | #define BVME_ABORT_STATUS 0x08 | ||
93 | |||
94 | #define BVME_NCR53C710_BASE 0xff000000 | ||
95 | |||
96 | #define BVME_SCC_A_ADDR 0xffb0000b | ||
97 | #define BVME_SCC_B_ADDR 0xffb00003 | ||
98 | #define BVME_SCC_RTxC 7372800 | ||
99 | |||
100 | #define BVME_CONFIG_REG 0xff500003 | ||
101 | |||
102 | #define config_reg_ptr (volatile unsigned char *)BVME_CONFIG_REG | ||
103 | |||
104 | #define BVME_CONFIG_SW1 0x08 | ||
105 | #define BVME_CONFIG_SW2 0x04 | ||
106 | #define BVME_CONFIG_SW3 0x02 | ||
107 | #define BVME_CONFIG_SW4 0x01 | ||
108 | |||
109 | |||
110 | #define BVME_IRQ_TYPE_PRIO 0 | ||
111 | |||
112 | #define BVME_IRQ_PRN 0x54 | ||
113 | #define BVME_IRQ_I596 0x1a | ||
114 | #define BVME_IRQ_SCSI 0x1b | ||
115 | #define BVME_IRQ_TIMER 0x59 | ||
116 | #define BVME_IRQ_RTC 0x1e | ||
117 | #define BVME_IRQ_ABORT 0x1f | ||
118 | |||
119 | /* SCC interrupts */ | ||
120 | #define BVME_IRQ_SCC_BASE 0x40 | ||
121 | #define BVME_IRQ_SCCB_TX 0x40 | ||
122 | #define BVME_IRQ_SCCB_STAT 0x42 | ||
123 | #define BVME_IRQ_SCCB_RX 0x44 | ||
124 | #define BVME_IRQ_SCCB_SPCOND 0x46 | ||
125 | #define BVME_IRQ_SCCA_TX 0x48 | ||
126 | #define BVME_IRQ_SCCA_STAT 0x4a | ||
127 | #define BVME_IRQ_SCCA_RX 0x4c | ||
128 | #define BVME_IRQ_SCCA_SPCOND 0x4e | ||
129 | |||
130 | /* Address control registers */ | ||
131 | |||
132 | #define BVME_ACR_A32VBA 0xff400003 | ||
133 | #define BVME_ACR_A32MSK 0xff410003 | ||
134 | #define BVME_ACR_A24VBA 0xff420003 | ||
135 | #define BVME_ACR_A24MSK 0xff430003 | ||
136 | #define BVME_ACR_A16VBA 0xff440003 | ||
137 | #define BVME_ACR_A32LBA 0xff450003 | ||
138 | #define BVME_ACR_A24LBA 0xff460003 | ||
139 | #define BVME_ACR_ADDRCTL 0xff470003 | ||
140 | |||
141 | #define bvme_acr_a32vba *(volatile unsigned char *)BVME_ACR_A32VBA | ||
142 | #define bvme_acr_a32msk *(volatile unsigned char *)BVME_ACR_A32MSK | ||
143 | #define bvme_acr_a24vba *(volatile unsigned char *)BVME_ACR_A24VBA | ||
144 | #define bvme_acr_a24msk *(volatile unsigned char *)BVME_ACR_A24MSK | ||
145 | #define bvme_acr_a16vba *(volatile unsigned char *)BVME_ACR_A16VBA | ||
146 | #define bvme_acr_a32lba *(volatile unsigned char *)BVME_ACR_A32LBA | ||
147 | #define bvme_acr_a24lba *(volatile unsigned char *)BVME_ACR_A24LBA | ||
148 | #define bvme_acr_addrctl *(volatile unsigned char *)BVME_ACR_ADDRCTL | ||
149 | |||
150 | #endif | ||
diff --git a/include/asm-m68k/byteorder.h b/include/asm-m68k/byteorder.h new file mode 100644 index 000000000000..81d420b35c80 --- /dev/null +++ b/include/asm-m68k/byteorder.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _M68K_BYTEORDER_H | ||
2 | #define _M68K_BYTEORDER_H | ||
3 | |||
4 | #include <asm/types.h> | ||
5 | #include <linux/compiler.h> | ||
6 | |||
7 | #ifdef __GNUC__ | ||
8 | |||
9 | static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 val) | ||
10 | { | ||
11 | __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val)); | ||
12 | return val; | ||
13 | } | ||
14 | #define __arch__swab32(x) ___arch__swab32(x) | ||
15 | |||
16 | #endif | ||
17 | |||
18 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) | ||
19 | # define __BYTEORDER_HAS_U64__ | ||
20 | # define __SWAB_64_THRU_32__ | ||
21 | #endif | ||
22 | |||
23 | #include <linux/byteorder/big_endian.h> | ||
24 | |||
25 | #endif /* _M68K_BYTEORDER_H */ | ||
diff --git a/include/asm-m68k/cache.h b/include/asm-m68k/cache.h new file mode 100644 index 000000000000..6161fd3d8600 --- /dev/null +++ b/include/asm-m68k/cache.h | |||
@@ -0,0 +1,13 @@ | |||
1 | /* | ||
2 | * include/asm-m68k/cache.h | ||
3 | */ | ||
4 | #ifndef __ARCH_M68K_CACHE_H | ||
5 | #define __ARCH_M68K_CACHE_H | ||
6 | |||
7 | /* bytes per L1 cache line */ | ||
8 | #define L1_CACHE_SHIFT 4 | ||
9 | #define L1_CACHE_BYTES (1<< L1_CACHE_SHIFT) | ||
10 | |||
11 | #define L1_CACHE_SHIFT_MAX 4 /* largest L1 which this arch supports */ | ||
12 | |||
13 | #endif | ||
diff --git a/include/asm-m68k/cachectl.h b/include/asm-m68k/cachectl.h new file mode 100644 index 000000000000..525978e959e3 --- /dev/null +++ b/include/asm-m68k/cachectl.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef _M68K_CACHECTL_H | ||
2 | #define _M68K_CACHECTL_H | ||
3 | |||
4 | /* Definitions for the cacheflush system call. */ | ||
5 | |||
6 | #define FLUSH_SCOPE_LINE 1 /* Flush a cache line */ | ||
7 | #define FLUSH_SCOPE_PAGE 2 /* Flush a page */ | ||
8 | #define FLUSH_SCOPE_ALL 3 /* Flush the whole cache -- superuser only */ | ||
9 | |||
10 | #define FLUSH_CACHE_DATA 1 /* Writeback and flush data cache */ | ||
11 | #define FLUSH_CACHE_INSN 2 /* Flush instruction cache */ | ||
12 | #define FLUSH_CACHE_BOTH 3 /* Flush both caches */ | ||
13 | |||
14 | #endif /* _M68K_CACHECTL_H */ | ||
diff --git a/include/asm-m68k/cacheflush.h b/include/asm-m68k/cacheflush.h new file mode 100644 index 000000000000..e4773946f10d --- /dev/null +++ b/include/asm-m68k/cacheflush.h | |||
@@ -0,0 +1,149 @@ | |||
1 | #ifndef _M68K_CACHEFLUSH_H | ||
2 | #define _M68K_CACHEFLUSH_H | ||
3 | |||
4 | #include <linux/mm.h> | ||
5 | |||
6 | /* | ||
7 | * Cache handling functions | ||
8 | */ | ||
9 | |||
10 | #define flush_icache() \ | ||
11 | ({ \ | ||
12 | if (CPU_IS_040_OR_060) \ | ||
13 | __asm__ __volatile__("nop\n\t" \ | ||
14 | ".chip 68040\n\t" \ | ||
15 | "cinva %%ic\n\t" \ | ||
16 | ".chip 68k" : ); \ | ||
17 | else { \ | ||
18 | unsigned long _tmp; \ | ||
19 | __asm__ __volatile__("movec %%cacr,%0\n\t" \ | ||
20 | "orw %1,%0\n\t" \ | ||
21 | "movec %0,%%cacr" \ | ||
22 | : "=&d" (_tmp) \ | ||
23 | : "id" (FLUSH_I)); \ | ||
24 | } \ | ||
25 | }) | ||
26 | |||
27 | /* | ||
28 | * invalidate the cache for the specified memory range. | ||
29 | * It starts at the physical address specified for | ||
30 | * the given number of bytes. | ||
31 | */ | ||
32 | extern void cache_clear(unsigned long paddr, int len); | ||
33 | /* | ||
34 | * push any dirty cache in the specified memory range. | ||
35 | * It starts at the physical address specified for | ||
36 | * the given number of bytes. | ||
37 | */ | ||
38 | extern void cache_push(unsigned long paddr, int len); | ||
39 | |||
40 | /* | ||
41 | * push and invalidate pages in the specified user virtual | ||
42 | * memory range. | ||
43 | */ | ||
44 | extern void cache_push_v(unsigned long vaddr, int len); | ||
45 | |||
46 | /* cache code */ | ||
47 | #define FLUSH_I_AND_D (0x00000808) | ||
48 | #define FLUSH_I (0x00000008) | ||
49 | |||
50 | /* This is needed whenever the virtual mapping of the current | ||
51 | process changes. */ | ||
52 | #define __flush_cache_all() \ | ||
53 | ({ \ | ||
54 | if (CPU_IS_040_OR_060) \ | ||
55 | __asm__ __volatile__("nop\n\t" \ | ||
56 | ".chip 68040\n\t" \ | ||
57 | "cpusha %dc\n\t" \ | ||
58 | ".chip 68k"); \ | ||
59 | else { \ | ||
60 | unsigned long _tmp; \ | ||
61 | __asm__ __volatile__("movec %%cacr,%0\n\t" \ | ||
62 | "orw %1,%0\n\t" \ | ||
63 | "movec %0,%%cacr" \ | ||
64 | : "=&d" (_tmp) \ | ||
65 | : "di" (FLUSH_I_AND_D)); \ | ||
66 | } \ | ||
67 | }) | ||
68 | |||
69 | #define __flush_cache_030() \ | ||
70 | ({ \ | ||
71 | if (CPU_IS_020_OR_030) { \ | ||
72 | unsigned long _tmp; \ | ||
73 | __asm__ __volatile__("movec %%cacr,%0\n\t" \ | ||
74 | "orw %1,%0\n\t" \ | ||
75 | "movec %0,%%cacr" \ | ||
76 | : "=&d" (_tmp) \ | ||
77 | : "di" (FLUSH_I_AND_D)); \ | ||
78 | } \ | ||
79 | }) | ||
80 | |||
81 | #define flush_cache_all() __flush_cache_all() | ||
82 | |||
83 | #define flush_cache_vmap(start, end) flush_cache_all() | ||
84 | #define flush_cache_vunmap(start, end) flush_cache_all() | ||
85 | |||
86 | static inline void flush_cache_mm(struct mm_struct *mm) | ||
87 | { | ||
88 | if (mm == current->mm) | ||
89 | __flush_cache_030(); | ||
90 | } | ||
91 | |||
92 | /* flush_cache_range/flush_cache_page must be macros to avoid | ||
93 | a dependency on linux/mm.h, which includes this file... */ | ||
94 | static inline void flush_cache_range(struct vm_area_struct *vma, | ||
95 | unsigned long start, | ||
96 | unsigned long end) | ||
97 | { | ||
98 | if (vma->vm_mm == current->mm) | ||
99 | __flush_cache_030(); | ||
100 | } | ||
101 | |||
102 | static inline void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn) | ||
103 | { | ||
104 | if (vma->vm_mm == current->mm) | ||
105 | __flush_cache_030(); | ||
106 | } | ||
107 | |||
108 | |||
109 | /* Push the page at kernel virtual address and clear the icache */ | ||
110 | /* RZ: use cpush %bc instead of cpush %dc, cinv %ic */ | ||
111 | static inline void __flush_page_to_ram(void *vaddr) | ||
112 | { | ||
113 | if (CPU_IS_040_OR_060) { | ||
114 | __asm__ __volatile__("nop\n\t" | ||
115 | ".chip 68040\n\t" | ||
116 | "cpushp %%bc,(%0)\n\t" | ||
117 | ".chip 68k" | ||
118 | : : "a" (__pa(vaddr))); | ||
119 | } else { | ||
120 | unsigned long _tmp; | ||
121 | __asm__ __volatile__("movec %%cacr,%0\n\t" | ||
122 | "orw %1,%0\n\t" | ||
123 | "movec %0,%%cacr" | ||
124 | : "=&d" (_tmp) | ||
125 | : "di" (FLUSH_I)); | ||
126 | } | ||
127 | } | ||
128 | |||
129 | #define flush_dcache_page(page) __flush_page_to_ram(page_address(page)) | ||
130 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | ||
131 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | ||
132 | #define flush_icache_page(vma, page) __flush_page_to_ram(page_address(page)) | ||
133 | #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) | ||
134 | |||
135 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | ||
136 | do { \ | ||
137 | flush_cache_page(vma, vaddr, page_to_pfn(page));\ | ||
138 | memcpy(dst, src, len); \ | ||
139 | } while (0) | ||
140 | |||
141 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | ||
142 | do { \ | ||
143 | flush_cache_page(vma, vaddr, page_to_pfn(page));\ | ||
144 | memcpy(dst, src, len); \ | ||
145 | } while (0) | ||
146 | |||
147 | extern void flush_icache_range(unsigned long address, unsigned long endaddr); | ||
148 | |||
149 | #endif /* _M68K_CACHEFLUSH_H */ | ||
diff --git a/include/asm-m68k/checksum.h b/include/asm-m68k/checksum.h new file mode 100644 index 000000000000..78860c20db01 --- /dev/null +++ b/include/asm-m68k/checksum.h | |||
@@ -0,0 +1,150 @@ | |||
1 | #ifndef _M68K_CHECKSUM_H | ||
2 | #define _M68K_CHECKSUM_H | ||
3 | |||
4 | #include <linux/in6.h> | ||
5 | |||
6 | /* | ||
7 | * computes the checksum of a memory block at buff, length len, | ||
8 | * and adds in "sum" (32-bit) | ||
9 | * | ||
10 | * returns a 32-bit number suitable for feeding into itself | ||
11 | * or csum_tcpudp_magic | ||
12 | * | ||
13 | * this function must be called with even lengths, except | ||
14 | * for the last fragment, which may be odd | ||
15 | * | ||
16 | * it's best to have buff aligned on a 32-bit boundary | ||
17 | */ | ||
18 | unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); | ||
19 | |||
20 | /* | ||
21 | * the same as csum_partial, but copies from src while it | ||
22 | * checksums | ||
23 | * | ||
24 | * here even more important to align src and dst on a 32-bit (or even | ||
25 | * better 64-bit) boundary | ||
26 | */ | ||
27 | |||
28 | extern unsigned int csum_partial_copy_from_user(const unsigned char *src, | ||
29 | unsigned char *dst, | ||
30 | int len, int sum, | ||
31 | int *csum_err); | ||
32 | |||
33 | extern unsigned int csum_partial_copy_nocheck(const unsigned char *src, | ||
34 | unsigned char *dst, int len, | ||
35 | int sum); | ||
36 | |||
37 | /* | ||
38 | * This is a version of ip_compute_csum() optimized for IP headers, | ||
39 | * which always checksum on 4 octet boundaries. | ||
40 | * | ||
41 | */ | ||
42 | static inline unsigned short | ||
43 | ip_fast_csum(unsigned char *iph, unsigned int ihl) | ||
44 | { | ||
45 | unsigned int sum = 0; | ||
46 | unsigned long tmp; | ||
47 | |||
48 | __asm__ ("subqw #1,%2\n" | ||
49 | "1:\t" | ||
50 | "movel %1@+,%3\n\t" | ||
51 | "addxl %3,%0\n\t" | ||
52 | "dbra %2,1b\n\t" | ||
53 | "movel %0,%3\n\t" | ||
54 | "swap %3\n\t" | ||
55 | "addxw %3,%0\n\t" | ||
56 | "clrw %3\n\t" | ||
57 | "addxw %3,%0\n\t" | ||
58 | : "=d" (sum), "=&a" (iph), "=&d" (ihl), "=&d" (tmp) | ||
59 | : "0" (sum), "1" (iph), "2" (ihl) | ||
60 | : "memory"); | ||
61 | return ~sum; | ||
62 | } | ||
63 | |||
64 | /* | ||
65 | * Fold a partial checksum | ||
66 | */ | ||
67 | |||
68 | static inline unsigned int csum_fold(unsigned int sum) | ||
69 | { | ||
70 | unsigned int tmp = sum; | ||
71 | __asm__("swap %1\n\t" | ||
72 | "addw %1, %0\n\t" | ||
73 | "clrw %1\n\t" | ||
74 | "addxw %1, %0" | ||
75 | : "=&d" (sum), "=&d" (tmp) | ||
76 | : "0" (sum), "1" (tmp)); | ||
77 | return ~sum; | ||
78 | } | ||
79 | |||
80 | |||
81 | static inline unsigned int | ||
82 | csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, | ||
83 | unsigned short proto, unsigned int sum) | ||
84 | { | ||
85 | __asm__ ("addl %2,%0\n\t" | ||
86 | "addxl %3,%0\n\t" | ||
87 | "addxl %4,%0\n\t" | ||
88 | "clrl %1\n\t" | ||
89 | "addxl %1,%0" | ||
90 | : "=&d" (sum), "=d" (saddr) | ||
91 | : "g" (daddr), "1" (saddr), "d" (len + proto), | ||
92 | "0" (sum)); | ||
93 | return sum; | ||
94 | } | ||
95 | |||
96 | |||
97 | /* | ||
98 | * computes the checksum of the TCP/UDP pseudo-header | ||
99 | * returns a 16-bit checksum, already complemented | ||
100 | */ | ||
101 | static inline unsigned short int | ||
102 | csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, | ||
103 | unsigned short proto, unsigned int sum) | ||
104 | { | ||
105 | return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); | ||
106 | } | ||
107 | |||
108 | /* | ||
109 | * this routine is used for miscellaneous IP-like checksums, mainly | ||
110 | * in icmp.c | ||
111 | */ | ||
112 | |||
113 | static inline unsigned short | ||
114 | ip_compute_csum(unsigned char * buff, int len) | ||
115 | { | ||
116 | return csum_fold (csum_partial(buff, len, 0)); | ||
117 | } | ||
118 | |||
119 | #define _HAVE_ARCH_IPV6_CSUM | ||
120 | static __inline__ unsigned short int | ||
121 | csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, | ||
122 | __u32 len, unsigned short proto, unsigned int sum) | ||
123 | { | ||
124 | register unsigned long tmp; | ||
125 | __asm__("addl %2@,%0\n\t" | ||
126 | "movel %2@(4),%1\n\t" | ||
127 | "addxl %1,%0\n\t" | ||
128 | "movel %2@(8),%1\n\t" | ||
129 | "addxl %1,%0\n\t" | ||
130 | "movel %2@(12),%1\n\t" | ||
131 | "addxl %1,%0\n\t" | ||
132 | "movel %3@,%1\n\t" | ||
133 | "addxl %1,%0\n\t" | ||
134 | "movel %3@(4),%1\n\t" | ||
135 | "addxl %1,%0\n\t" | ||
136 | "movel %3@(8),%1\n\t" | ||
137 | "addxl %1,%0\n\t" | ||
138 | "movel %3@(12),%1\n\t" | ||
139 | "addxl %1,%0\n\t" | ||
140 | "addxl %4,%0\n\t" | ||
141 | "clrl %1\n\t" | ||
142 | "addxl %1,%0" | ||
143 | : "=&d" (sum), "=&d" (tmp) | ||
144 | : "a" (saddr), "a" (daddr), "d" (len + proto), | ||
145 | "0" (sum)); | ||
146 | |||
147 | return csum_fold(sum); | ||
148 | } | ||
149 | |||
150 | #endif /* _M68K_CHECKSUM_H */ | ||
diff --git a/include/asm-m68k/contregs.h b/include/asm-m68k/contregs.h new file mode 100644 index 000000000000..1e233e7d191e --- /dev/null +++ b/include/asm-m68k/contregs.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef _M68K_CONTREGS_H | ||
2 | #define _M68K_CONTREGS_H | ||
3 | #include <asm-sparc/contregs.h> | ||
4 | #endif /* _M68K_CONTREGS_H */ | ||
diff --git a/include/asm-m68k/cputime.h b/include/asm-m68k/cputime.h new file mode 100644 index 000000000000..c79c5e892305 --- /dev/null +++ b/include/asm-m68k/cputime.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __M68K_CPUTIME_H | ||
2 | #define __M68K_CPUTIME_H | ||
3 | |||
4 | #include <asm-generic/cputime.h> | ||
5 | |||
6 | #endif /* __M68K_CPUTIME_H */ | ||
diff --git a/include/asm-m68k/current.h b/include/asm-m68k/current.h new file mode 100644 index 000000000000..8de8f8ceda61 --- /dev/null +++ b/include/asm-m68k/current.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _M68K_CURRENT_H | ||
2 | #define _M68K_CURRENT_H | ||
3 | |||
4 | register struct task_struct *current __asm__("%a2"); | ||
5 | |||
6 | #endif /* !(_M68K_CURRENT_H) */ | ||
diff --git a/include/asm-m68k/delay.h b/include/asm-m68k/delay.h new file mode 100644 index 000000000000..5ed92851bc6f --- /dev/null +++ b/include/asm-m68k/delay.h | |||
@@ -0,0 +1,57 @@ | |||
1 | #ifndef _M68K_DELAY_H | ||
2 | #define _M68K_DELAY_H | ||
3 | |||
4 | #include <asm/param.h> | ||
5 | |||
6 | /* | ||
7 | * Copyright (C) 1994 Hamish Macdonald | ||
8 | * | ||
9 | * Delay routines, using a pre-computed "loops_per_jiffy" value. | ||
10 | */ | ||
11 | |||
12 | static inline void __delay(unsigned long loops) | ||
13 | { | ||
14 | __asm__ __volatile__ ("1: subql #1,%0; jcc 1b" | ||
15 | : "=d" (loops) : "0" (loops)); | ||
16 | } | ||
17 | |||
18 | extern void __bad_udelay(void); | ||
19 | |||
20 | /* | ||
21 | * Use only for very small delays ( < 1 msec). Should probably use a | ||
22 | * lookup table, really, as the multiplications take much too long with | ||
23 | * short delays. This is a "reasonable" implementation, though (and the | ||
24 | * first constant multiplications gets optimized away if the delay is | ||
25 | * a constant) | ||
26 | */ | ||
27 | static inline void __const_udelay(unsigned long xloops) | ||
28 | { | ||
29 | unsigned long tmp; | ||
30 | |||
31 | __asm__ ("mulul %2,%0:%1" | ||
32 | : "=d" (xloops), "=d" (tmp) | ||
33 | : "d" (xloops), "1" (loops_per_jiffy)); | ||
34 | __delay(xloops * HZ); | ||
35 | } | ||
36 | |||
37 | static inline void __udelay(unsigned long usecs) | ||
38 | { | ||
39 | __const_udelay(usecs * 4295); /* 2**32 / 1000000 */ | ||
40 | } | ||
41 | |||
42 | #define udelay(n) (__builtin_constant_p(n) ? \ | ||
43 | ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 4295)) : \ | ||
44 | __udelay(n)) | ||
45 | |||
46 | static inline unsigned long muldiv(unsigned long a, unsigned long b, | ||
47 | unsigned long c) | ||
48 | { | ||
49 | unsigned long tmp; | ||
50 | |||
51 | __asm__ ("mulul %2,%0:%1; divul %3,%0:%1" | ||
52 | : "=d" (tmp), "=d" (a) | ||
53 | : "d" (b), "d" (c), "1" (a)); | ||
54 | return a; | ||
55 | } | ||
56 | |||
57 | #endif /* defined(_M68K_DELAY_H) */ | ||
diff --git a/include/asm-m68k/div64.h b/include/asm-m68k/div64.h new file mode 100644 index 000000000000..9f65de1a2480 --- /dev/null +++ b/include/asm-m68k/div64.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef _M68K_DIV64_H | ||
2 | #define _M68K_DIV64_H | ||
3 | |||
4 | /* n = n / base; return rem; */ | ||
5 | |||
6 | #define do_div(n, base) ({ \ | ||
7 | union { \ | ||
8 | unsigned long n32[2]; \ | ||
9 | unsigned long long n64; \ | ||
10 | } __n; \ | ||
11 | unsigned long __rem, __upper; \ | ||
12 | \ | ||
13 | __n.n64 = (n); \ | ||
14 | if ((__upper = __n.n32[0])) { \ | ||
15 | asm ("divul.l %2,%1:%0" \ | ||
16 | : "=d" (__n.n32[0]), "=d" (__upper) \ | ||
17 | : "d" (base), "0" (__n.n32[0])); \ | ||
18 | } \ | ||
19 | asm ("divu.l %2,%1:%0" \ | ||
20 | : "=d" (__n.n32[1]), "=d" (__rem) \ | ||
21 | : "d" (base), "1" (__upper), "0" (__n.n32[1])); \ | ||
22 | (n) = __n.n64; \ | ||
23 | __rem; \ | ||
24 | }) | ||
25 | |||
26 | #endif /* _M68K_DIV64_H */ | ||
diff --git a/include/asm-m68k/dma-mapping.h b/include/asm-m68k/dma-mapping.h new file mode 100644 index 000000000000..b1920c703d82 --- /dev/null +++ b/include/asm-m68k/dma-mapping.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef _M68K_DMA_MAPPING_H | ||
2 | #define _M68K_DMA_MAPPING_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | |||
6 | #ifdef CONFIG_PCI | ||
7 | #include <asm-generic/dma-mapping.h> | ||
8 | #else | ||
9 | #include <asm-generic/dma-mapping-broken.h> | ||
10 | #endif | ||
11 | |||
12 | #endif /* _M68K_DMA_MAPPING_H */ | ||
diff --git a/include/asm-m68k/dma.h b/include/asm-m68k/dma.h new file mode 100644 index 000000000000..d5266a886226 --- /dev/null +++ b/include/asm-m68k/dma.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef _M68K_DMA_H | ||
2 | #define _M68K_DMA_H 1 | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | |||
6 | /* it's useless on the m68k, but unfortunately needed by the new | ||
7 | bootmem allocator (but this should do it for this) */ | ||
8 | #define MAX_DMA_ADDRESS PAGE_OFFSET | ||
9 | |||
10 | #define MAX_DMA_CHANNELS 8 | ||
11 | |||
12 | extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */ | ||
13 | extern void free_dma(unsigned int dmanr); /* release it again */ | ||
14 | |||
15 | #ifdef CONFIG_PCI | ||
16 | extern int isa_dma_bridge_buggy; | ||
17 | #else | ||
18 | #define isa_dma_bridge_buggy (0) | ||
19 | #endif | ||
20 | |||
21 | #endif /* _M68K_DMA_H */ | ||
diff --git a/include/asm-m68k/dsp56k.h b/include/asm-m68k/dsp56k.h new file mode 100644 index 000000000000..ab3dd33e23a1 --- /dev/null +++ b/include/asm-m68k/dsp56k.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * linux/include/asm-m68k/dsp56k.h - defines and declarations for | ||
3 | * DSP56k device driver | ||
4 | * | ||
5 | * Copyright (C) 1996,1997 Fredrik Noring, lars brinkhoff & Tomas Berndtsson | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file COPYING in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
11 | |||
12 | |||
13 | /* Used for uploading DSP binary code */ | ||
14 | struct dsp56k_upload { | ||
15 | int len; | ||
16 | char *bin; | ||
17 | }; | ||
18 | |||
19 | /* For the DSP host flags */ | ||
20 | struct dsp56k_host_flags { | ||
21 | int dir; /* Bit field. 1 = write output bit, 0 = do nothing. | ||
22 | * 0x0000 means reading only, 0x0011 means | ||
23 | * writing the bits stored in `out' on HF0 and HF1. | ||
24 | * Note that HF2 and HF3 can only be read. | ||
25 | */ | ||
26 | int out; /* Bit field like above. */ | ||
27 | int status; /* Host register's current state is returned */ | ||
28 | }; | ||
29 | |||
30 | /* ioctl command codes */ | ||
31 | #define DSP56K_UPLOAD 1 /* Upload DSP binary program */ | ||
32 | #define DSP56K_SET_TX_WSIZE 2 /* Host transmit word size (1-4) */ | ||
33 | #define DSP56K_SET_RX_WSIZE 3 /* Host receive word size (1-4) */ | ||
34 | #define DSP56K_HOST_FLAGS 4 /* Host flag registers */ | ||
35 | #define DSP56K_HOST_CMD 5 /* Trig Host Command (0-31) */ | ||
diff --git a/include/asm-m68k/dvma.h b/include/asm-m68k/dvma.h new file mode 100644 index 000000000000..5978f87b0a8a --- /dev/null +++ b/include/asm-m68k/dvma.h | |||
@@ -0,0 +1,243 @@ | |||
1 | /* $Id: dvma.h,v 1.4 1999/03/27 20:23:41 tsbogend Exp $ | ||
2 | * include/asm-m68k/dma.h | ||
3 | * | ||
4 | * Copyright 1995 (C) David S. Miller (davem@caip.rutgers.edu) | ||
5 | * | ||
6 | * Hacked to fit Sun3x needs by Thomas Bogendoerfer | ||
7 | */ | ||
8 | |||
9 | #ifndef __M68K_DVMA_H | ||
10 | #define __M68K_DVMA_H | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | |||
14 | #define DVMA_PAGE_SHIFT 13 | ||
15 | #define DVMA_PAGE_SIZE (1UL << DVMA_PAGE_SHIFT) | ||
16 | #define DVMA_PAGE_MASK (~(DVMA_PAGE_SIZE-1)) | ||
17 | #define DVMA_PAGE_ALIGN(addr) (((addr)+DVMA_PAGE_SIZE-1)&DVMA_PAGE_MASK) | ||
18 | |||
19 | extern void dvma_init(void); | ||
20 | extern int dvma_map_iommu(unsigned long kaddr, unsigned long baddr, | ||
21 | int len); | ||
22 | |||
23 | #define dvma_malloc(x) dvma_malloc_align(x, 0) | ||
24 | #define dvma_map(x, y) dvma_map_align(x, y, 0) | ||
25 | #define dvma_map_vme(x, y) (dvma_map(x, y) & 0xfffff) | ||
26 | #define dvma_map_align_vme(x, y, z) (dvma_map_align (x, y, z) & 0xfffff) | ||
27 | extern unsigned long dvma_map_align(unsigned long kaddr, int len, | ||
28 | int align); | ||
29 | extern void *dvma_malloc_align(unsigned long len, unsigned long align); | ||
30 | |||
31 | extern void dvma_unmap(void *baddr); | ||
32 | extern void dvma_free(void *vaddr); | ||
33 | |||
34 | |||
35 | #ifdef CONFIG_SUN3 | ||
36 | /* sun3 dvma page support */ | ||
37 | |||
38 | /* memory and pmegs potentially reserved for dvma */ | ||
39 | #define DVMA_PMEG_START 10 | ||
40 | #define DVMA_PMEG_END 16 | ||
41 | #define DVMA_START 0xf00000 | ||
42 | #define DVMA_END 0xfe0000 | ||
43 | #define DVMA_SIZE (DVMA_END-DVMA_START) | ||
44 | #define IOMMU_TOTAL_ENTRIES 128 | ||
45 | #define IOMMU_ENTRIES 120 | ||
46 | |||
47 | /* empirical kludge -- dvma regions only seem to work right on 0x10000 | ||
48 | byte boundaries */ | ||
49 | #define DVMA_REGION_SIZE 0x10000 | ||
50 | #define DVMA_ALIGN(addr) (((addr)+DVMA_REGION_SIZE-1) & \ | ||
51 | ~(DVMA_REGION_SIZE-1)) | ||
52 | |||
53 | /* virt <-> phys conversions */ | ||
54 | #define dvma_vtop(x) ((unsigned long)(x) & 0xffffff) | ||
55 | #define dvma_ptov(x) ((unsigned long)(x) | 0xf000000) | ||
56 | #define dvma_vtovme(x) ((unsigned long)(x) & 0x00fffff) | ||
57 | #define dvma_vmetov(x) ((unsigned long)(x) | 0xff00000) | ||
58 | #define dvma_vtob(x) dvma_vtop(x) | ||
59 | #define dvma_btov(x) dvma_ptov(x) | ||
60 | |||
61 | static inline int dvma_map_cpu(unsigned long kaddr, unsigned long vaddr, | ||
62 | int len) | ||
63 | { | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | extern unsigned long dvma_page(unsigned long kaddr, unsigned long vaddr); | ||
68 | |||
69 | #else /* Sun3x */ | ||
70 | |||
71 | /* sun3x dvma page support */ | ||
72 | |||
73 | #define DVMA_START 0x0 | ||
74 | #define DVMA_END 0xf00000 | ||
75 | #define DVMA_SIZE (DVMA_END-DVMA_START) | ||
76 | #define IOMMU_TOTAL_ENTRIES 2048 | ||
77 | /* the prom takes the top meg */ | ||
78 | #define IOMMU_ENTRIES (IOMMU_TOTAL_ENTRIES - 0x80) | ||
79 | |||
80 | #define dvma_vtob(x) ((unsigned long)(x) & 0x00ffffff) | ||
81 | #define dvma_btov(x) ((unsigned long)(x) | 0xff000000) | ||
82 | |||
83 | extern int dvma_map_cpu(unsigned long kaddr, unsigned long vaddr, int len); | ||
84 | |||
85 | |||
86 | |||
87 | /* everything below this line is specific to dma used for the onboard | ||
88 | ESP scsi on sun3x */ | ||
89 | |||
90 | /* Structure to describe the current status of DMA registers on the Sparc */ | ||
91 | struct sparc_dma_registers { | ||
92 | __volatile__ unsigned long cond_reg; /* DMA condition register */ | ||
93 | __volatile__ unsigned long st_addr; /* Start address of this transfer */ | ||
94 | __volatile__ unsigned long cnt; /* How many bytes to transfer */ | ||
95 | __volatile__ unsigned long dma_test; /* DMA test register */ | ||
96 | }; | ||
97 | |||
98 | /* DVMA chip revisions */ | ||
99 | enum dvma_rev { | ||
100 | dvmarev0, | ||
101 | dvmaesc1, | ||
102 | dvmarev1, | ||
103 | dvmarev2, | ||
104 | dvmarev3, | ||
105 | dvmarevplus, | ||
106 | dvmahme | ||
107 | }; | ||
108 | |||
109 | #define DMA_HASCOUNT(rev) ((rev)==dvmaesc1) | ||
110 | |||
111 | /* Linux DMA information structure, filled during probe. */ | ||
112 | struct Linux_SBus_DMA { | ||
113 | struct Linux_SBus_DMA *next; | ||
114 | struct linux_sbus_device *SBus_dev; | ||
115 | struct sparc_dma_registers *regs; | ||
116 | |||
117 | /* Status, misc info */ | ||
118 | int node; /* Prom node for this DMA device */ | ||
119 | int running; /* Are we doing DMA now? */ | ||
120 | int allocated; /* Are we "owned" by anyone yet? */ | ||
121 | |||
122 | /* Transfer information. */ | ||
123 | unsigned long addr; /* Start address of current transfer */ | ||
124 | int nbytes; /* Size of current transfer */ | ||
125 | int realbytes; /* For splitting up large transfers, etc. */ | ||
126 | |||
127 | /* DMA revision */ | ||
128 | enum dvma_rev revision; | ||
129 | }; | ||
130 | |||
131 | extern struct Linux_SBus_DMA *dma_chain; | ||
132 | |||
133 | /* Broken hardware... */ | ||
134 | #define DMA_ISBROKEN(dma) ((dma)->revision == dvmarev1) | ||
135 | #define DMA_ISESC1(dma) ((dma)->revision == dvmaesc1) | ||
136 | |||
137 | /* Fields in the cond_reg register */ | ||
138 | /* First, the version identification bits */ | ||
139 | #define DMA_DEVICE_ID 0xf0000000 /* Device identification bits */ | ||
140 | #define DMA_VERS0 0x00000000 /* Sunray DMA version */ | ||
141 | #define DMA_ESCV1 0x40000000 /* DMA ESC Version 1 */ | ||
142 | #define DMA_VERS1 0x80000000 /* DMA rev 1 */ | ||
143 | #define DMA_VERS2 0xa0000000 /* DMA rev 2 */ | ||
144 | #define DMA_VERHME 0xb0000000 /* DMA hme gate array */ | ||
145 | #define DMA_VERSPLUS 0x90000000 /* DMA rev 1 PLUS */ | ||
146 | |||
147 | #define DMA_HNDL_INTR 0x00000001 /* An IRQ needs to be handled */ | ||
148 | #define DMA_HNDL_ERROR 0x00000002 /* We need to take an error */ | ||
149 | #define DMA_FIFO_ISDRAIN 0x0000000c /* The DMA FIFO is draining */ | ||
150 | #define DMA_INT_ENAB 0x00000010 /* Turn on interrupts */ | ||
151 | #define DMA_FIFO_INV 0x00000020 /* Invalidate the FIFO */ | ||
152 | #define DMA_ACC_SZ_ERR 0x00000040 /* The access size was bad */ | ||
153 | #define DMA_FIFO_STDRAIN 0x00000040 /* DMA_VERS1 Drain the FIFO */ | ||
154 | #define DMA_RST_SCSI 0x00000080 /* Reset the SCSI controller */ | ||
155 | #define DMA_RST_ENET DMA_RST_SCSI /* Reset the ENET controller */ | ||
156 | #define DMA_ST_WRITE 0x00000100 /* write from device to memory */ | ||
157 | #define DMA_ENABLE 0x00000200 /* Fire up DMA, handle requests */ | ||
158 | #define DMA_PEND_READ 0x00000400 /* DMA_VERS1/0/PLUS Pending Read */ | ||
159 | #define DMA_ESC_BURST 0x00000800 /* 1=16byte 0=32byte */ | ||
160 | #define DMA_READ_AHEAD 0x00001800 /* DMA read ahead partial longword */ | ||
161 | #define DMA_DSBL_RD_DRN 0x00001000 /* No EC drain on slave reads */ | ||
162 | #define DMA_BCNT_ENAB 0x00002000 /* If on, use the byte counter */ | ||
163 | #define DMA_TERM_CNTR 0x00004000 /* Terminal counter */ | ||
164 | #define DMA_CSR_DISAB 0x00010000 /* No FIFO drains during csr */ | ||
165 | #define DMA_SCSI_DISAB 0x00020000 /* No FIFO drains during reg */ | ||
166 | #define DMA_DSBL_WR_INV 0x00020000 /* No EC inval. on slave writes */ | ||
167 | #define DMA_ADD_ENABLE 0x00040000 /* Special ESC DVMA optimization */ | ||
168 | #define DMA_E_BURST8 0x00040000 /* ENET: SBUS r/w burst size */ | ||
169 | #define DMA_BRST_SZ 0x000c0000 /* SCSI: SBUS r/w burst size */ | ||
170 | #define DMA_BRST64 0x00080000 /* SCSI: 64byte bursts (HME on UltraSparc only) */ | ||
171 | #define DMA_BRST32 0x00040000 /* SCSI: 32byte bursts */ | ||
172 | #define DMA_BRST16 0x00000000 /* SCSI: 16byte bursts */ | ||
173 | #define DMA_BRST0 0x00080000 /* SCSI: no bursts (non-HME gate arrays) */ | ||
174 | #define DMA_ADDR_DISAB 0x00100000 /* No FIFO drains during addr */ | ||
175 | #define DMA_2CLKS 0x00200000 /* Each transfer = 2 clock ticks */ | ||
176 | #define DMA_3CLKS 0x00400000 /* Each transfer = 3 clock ticks */ | ||
177 | #define DMA_EN_ENETAUI DMA_3CLKS /* Put lance into AUI-cable mode */ | ||
178 | #define DMA_CNTR_DISAB 0x00800000 /* No IRQ when DMA_TERM_CNTR set */ | ||
179 | #define DMA_AUTO_NADDR 0x01000000 /* Use "auto nxt addr" feature */ | ||
180 | #define DMA_SCSI_ON 0x02000000 /* Enable SCSI dma */ | ||
181 | #define DMA_PARITY_OFF 0x02000000 /* HME: disable parity checking */ | ||
182 | #define DMA_LOADED_ADDR 0x04000000 /* Address has been loaded */ | ||
183 | #define DMA_LOADED_NADDR 0x08000000 /* Next address has been loaded */ | ||
184 | |||
185 | /* Values describing the burst-size property from the PROM */ | ||
186 | #define DMA_BURST1 0x01 | ||
187 | #define DMA_BURST2 0x02 | ||
188 | #define DMA_BURST4 0x04 | ||
189 | #define DMA_BURST8 0x08 | ||
190 | #define DMA_BURST16 0x10 | ||
191 | #define DMA_BURST32 0x20 | ||
192 | #define DMA_BURST64 0x40 | ||
193 | #define DMA_BURSTBITS 0x7f | ||
194 | |||
195 | /* Determine highest possible final transfer address given a base */ | ||
196 | #define DMA_MAXEND(addr) (0x01000000UL-(((unsigned long)(addr))&0x00ffffffUL)) | ||
197 | |||
198 | /* Yes, I hack a lot of elisp in my spare time... */ | ||
199 | #define DMA_ERROR_P(regs) ((((regs)->cond_reg) & DMA_HNDL_ERROR)) | ||
200 | #define DMA_IRQ_P(regs) ((((regs)->cond_reg) & (DMA_HNDL_INTR | DMA_HNDL_ERROR))) | ||
201 | #define DMA_WRITE_P(regs) ((((regs)->cond_reg) & DMA_ST_WRITE)) | ||
202 | #define DMA_OFF(regs) ((((regs)->cond_reg) &= (~DMA_ENABLE))) | ||
203 | #define DMA_INTSOFF(regs) ((((regs)->cond_reg) &= (~DMA_INT_ENAB))) | ||
204 | #define DMA_INTSON(regs) ((((regs)->cond_reg) |= (DMA_INT_ENAB))) | ||
205 | #define DMA_PUNTFIFO(regs) ((((regs)->cond_reg) |= DMA_FIFO_INV)) | ||
206 | #define DMA_SETSTART(regs, addr) ((((regs)->st_addr) = (char *) addr)) | ||
207 | #define DMA_BEGINDMA_W(regs) \ | ||
208 | ((((regs)->cond_reg |= (DMA_ST_WRITE|DMA_ENABLE|DMA_INT_ENAB)))) | ||
209 | #define DMA_BEGINDMA_R(regs) \ | ||
210 | ((((regs)->cond_reg |= ((DMA_ENABLE|DMA_INT_ENAB)&(~DMA_ST_WRITE))))) | ||
211 | |||
212 | /* For certain DMA chips, we need to disable ints upon irq entry | ||
213 | * and turn them back on when we are done. So in any ESP interrupt | ||
214 | * handler you *must* call DMA_IRQ_ENTRY upon entry and DMA_IRQ_EXIT | ||
215 | * when leaving the handler. You have been warned... | ||
216 | */ | ||
217 | #define DMA_IRQ_ENTRY(dma, dregs) do { \ | ||
218 | if(DMA_ISBROKEN(dma)) DMA_INTSOFF(dregs); \ | ||
219 | } while (0) | ||
220 | |||
221 | #define DMA_IRQ_EXIT(dma, dregs) do { \ | ||
222 | if(DMA_ISBROKEN(dma)) DMA_INTSON(dregs); \ | ||
223 | } while(0) | ||
224 | |||
225 | /* Reset the friggin' thing... */ | ||
226 | #define DMA_RESET(dma) do { \ | ||
227 | struct sparc_dma_registers *regs = dma->regs; \ | ||
228 | /* Let the current FIFO drain itself */ \ | ||
229 | sparc_dma_pause(regs, (DMA_FIFO_ISDRAIN)); \ | ||
230 | /* Reset the logic */ \ | ||
231 | regs->cond_reg |= (DMA_RST_SCSI); /* assert */ \ | ||
232 | __delay(400); /* let the bits set ;) */ \ | ||
233 | regs->cond_reg &= ~(DMA_RST_SCSI); /* de-assert */ \ | ||
234 | sparc_dma_enable_interrupts(regs); /* Re-enable interrupts */ \ | ||
235 | /* Enable FAST transfers if available */ \ | ||
236 | if(dma->revision>dvmarev1) regs->cond_reg |= DMA_3CLKS; \ | ||
237 | dma->running = 0; \ | ||
238 | } while(0) | ||
239 | |||
240 | |||
241 | #endif /* !CONFIG_SUN3 */ | ||
242 | |||
243 | #endif /* !(__M68K_DVMA_H) */ | ||
diff --git a/include/asm-m68k/elf.h b/include/asm-m68k/elf.h new file mode 100644 index 000000000000..38bf8347f14d --- /dev/null +++ b/include/asm-m68k/elf.h | |||
@@ -0,0 +1,122 @@ | |||
1 | #ifndef __ASMm68k_ELF_H | ||
2 | #define __ASMm68k_ELF_H | ||
3 | |||
4 | /* | ||
5 | * ELF register definitions.. | ||
6 | */ | ||
7 | |||
8 | #include <linux/config.h> | ||
9 | #include <asm/ptrace.h> | ||
10 | #include <asm/user.h> | ||
11 | |||
12 | /* | ||
13 | * 68k ELF relocation types | ||
14 | */ | ||
15 | #define R_68K_NONE 0 | ||
16 | #define R_68K_32 1 | ||
17 | #define R_68K_16 2 | ||
18 | #define R_68K_8 3 | ||
19 | #define R_68K_PC32 4 | ||
20 | #define R_68K_PC16 5 | ||
21 | #define R_68K_PC8 6 | ||
22 | #define R_68K_GOT32 7 | ||
23 | #define R_68K_GOT16 8 | ||
24 | #define R_68K_GOT8 9 | ||
25 | #define R_68K_GOT32O 10 | ||
26 | #define R_68K_GOT16O 11 | ||
27 | #define R_68K_GOT8O 12 | ||
28 | #define R_68K_PLT32 13 | ||
29 | #define R_68K_PLT16 14 | ||
30 | #define R_68K_PLT8 15 | ||
31 | #define R_68K_PLT32O 16 | ||
32 | #define R_68K_PLT16O 17 | ||
33 | #define R_68K_PLT8O 18 | ||
34 | #define R_68K_COPY 19 | ||
35 | #define R_68K_GLOB_DAT 20 | ||
36 | #define R_68K_JMP_SLOT 21 | ||
37 | #define R_68K_RELATIVE 22 | ||
38 | |||
39 | typedef unsigned long elf_greg_t; | ||
40 | |||
41 | #define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t)) | ||
42 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
43 | |||
44 | typedef struct user_m68kfp_struct elf_fpregset_t; | ||
45 | |||
46 | /* | ||
47 | * This is used to ensure we don't load something for the wrong architecture. | ||
48 | */ | ||
49 | #define elf_check_arch(x) ((x)->e_machine == EM_68K) | ||
50 | |||
51 | /* | ||
52 | * These are used to set parameters in the core dumps. | ||
53 | */ | ||
54 | #define ELF_CLASS ELFCLASS32 | ||
55 | #define ELF_DATA ELFDATA2MSB | ||
56 | #define ELF_ARCH EM_68K | ||
57 | |||
58 | /* For SVR4/m68k the function pointer to be registered with `atexit' is | ||
59 | passed in %a1. Although my copy of the ABI has no such statement, it | ||
60 | is actually used on ASV. */ | ||
61 | #define ELF_PLAT_INIT(_r, load_addr) _r->a1 = 0 | ||
62 | |||
63 | #define USE_ELF_CORE_DUMP | ||
64 | #ifndef CONFIG_SUN3 | ||
65 | #define ELF_EXEC_PAGESIZE 4096 | ||
66 | #else | ||
67 | #define ELF_EXEC_PAGESIZE 8192 | ||
68 | #endif | ||
69 | |||
70 | /* This is the location that an ET_DYN program is loaded if exec'ed. Typical | ||
71 | use of this is to invoke "./ld.so someprog" to test out a new version of | ||
72 | the loader. We need to make sure that it is out of the way of the program | ||
73 | that it will "exec", and that there is sufficient room for the brk. */ | ||
74 | |||
75 | #ifndef CONFIG_SUN3 | ||
76 | #define ELF_ET_DYN_BASE 0xD0000000UL | ||
77 | #else | ||
78 | #define ELF_ET_DYN_BASE 0x0D800000UL | ||
79 | #endif | ||
80 | |||
81 | #define ELF_CORE_COPY_REGS(pr_reg, regs) \ | ||
82 | /* Bleech. */ \ | ||
83 | pr_reg[0] = regs->d1; \ | ||
84 | pr_reg[1] = regs->d2; \ | ||
85 | pr_reg[2] = regs->d3; \ | ||
86 | pr_reg[3] = regs->d4; \ | ||
87 | pr_reg[4] = regs->d5; \ | ||
88 | pr_reg[7] = regs->a0; \ | ||
89 | pr_reg[8] = regs->a1; \ | ||
90 | pr_reg[9] = regs->a2; \ | ||
91 | pr_reg[14] = regs->d0; \ | ||
92 | pr_reg[15] = rdusp(); \ | ||
93 | pr_reg[16] = regs->orig_d0; \ | ||
94 | pr_reg[17] = regs->sr; \ | ||
95 | pr_reg[18] = regs->pc; \ | ||
96 | pr_reg[19] = (regs->format << 12) | regs->vector; \ | ||
97 | { \ | ||
98 | struct switch_stack *sw = ((struct switch_stack *)regs) - 1; \ | ||
99 | pr_reg[5] = sw->d6; \ | ||
100 | pr_reg[6] = sw->d7; \ | ||
101 | pr_reg[10] = sw->a3; \ | ||
102 | pr_reg[11] = sw->a4; \ | ||
103 | pr_reg[12] = sw->a5; \ | ||
104 | pr_reg[13] = sw->a6; \ | ||
105 | } | ||
106 | |||
107 | /* This yields a mask that user programs can use to figure out what | ||
108 | instruction set this cpu supports. */ | ||
109 | |||
110 | #define ELF_HWCAP (0) | ||
111 | |||
112 | /* This yields a string that ld.so will use to load implementation | ||
113 | specific libraries for optimization. This is more specific in | ||
114 | intent than poking at uname or /proc/cpuinfo. */ | ||
115 | |||
116 | #define ELF_PLATFORM (NULL) | ||
117 | |||
118 | #ifdef __KERNEL__ | ||
119 | #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) | ||
120 | #endif | ||
121 | |||
122 | #endif | ||
diff --git a/include/asm-m68k/entry.h b/include/asm-m68k/entry.h new file mode 100644 index 000000000000..0396495cd97d --- /dev/null +++ b/include/asm-m68k/entry.h | |||
@@ -0,0 +1,138 @@ | |||
1 | #ifndef __M68K_ENTRY_H | ||
2 | #define __M68K_ENTRY_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | #include <asm/setup.h> | ||
6 | #include <asm/page.h> | ||
7 | |||
8 | /* | ||
9 | * Stack layout in 'ret_from_exception': | ||
10 | * | ||
11 | * This allows access to the syscall arguments in registers d1-d5 | ||
12 | * | ||
13 | * 0(sp) - d1 | ||
14 | * 4(sp) - d2 | ||
15 | * 8(sp) - d3 | ||
16 | * C(sp) - d4 | ||
17 | * 10(sp) - d5 | ||
18 | * 14(sp) - a0 | ||
19 | * 18(sp) - a1 | ||
20 | * 1C(sp) - a2 | ||
21 | * 20(sp) - d0 | ||
22 | * 24(sp) - orig_d0 | ||
23 | * 28(sp) - stack adjustment | ||
24 | * 2C(sp) - sr | ||
25 | * 2E(sp) - pc | ||
26 | * 32(sp) - format & vector | ||
27 | */ | ||
28 | |||
29 | /* | ||
30 | * 97/05/14 Andreas: Register %a2 is now set to the current task throughout | ||
31 | * the whole kernel. | ||
32 | */ | ||
33 | |||
34 | /* the following macro is used when enabling interrupts */ | ||
35 | #if defined(MACH_ATARI_ONLY) && !defined(CONFIG_HADES) | ||
36 | /* block out HSYNC on the atari */ | ||
37 | #define ALLOWINT (~0x400) | ||
38 | #define MAX_NOINT_IPL 3 | ||
39 | #else | ||
40 | /* portable version */ | ||
41 | #define ALLOWINT (~0x700) | ||
42 | #define MAX_NOINT_IPL 0 | ||
43 | #endif /* machine compilation types */ | ||
44 | |||
45 | #ifdef __ASSEMBLY__ | ||
46 | |||
47 | #define curptr a2 | ||
48 | |||
49 | LFLUSH_I_AND_D = 0x00000808 | ||
50 | LSIGTRAP = 5 | ||
51 | |||
52 | /* process bits for task_struct.ptrace */ | ||
53 | PT_TRACESYS_OFF = 3 | ||
54 | PT_TRACESYS_BIT = 1 | ||
55 | PT_PTRACED_OFF = 3 | ||
56 | PT_PTRACED_BIT = 0 | ||
57 | PT_DTRACE_OFF = 3 | ||
58 | PT_DTRACE_BIT = 2 | ||
59 | |||
60 | #define SAVE_ALL_INT save_all_int | ||
61 | #define SAVE_ALL_SYS save_all_sys | ||
62 | #define RESTORE_ALL restore_all | ||
63 | /* | ||
64 | * This defines the normal kernel pt-regs layout. | ||
65 | * | ||
66 | * regs a3-a6 and d6-d7 are preserved by C code | ||
67 | * the kernel doesn't mess with usp unless it needs to | ||
68 | */ | ||
69 | |||
70 | /* | ||
71 | * a -1 in the orig_d0 field signifies | ||
72 | * that the stack frame is NOT for syscall | ||
73 | */ | ||
74 | .macro save_all_int | ||
75 | clrl %sp@- | stk_adj | ||
76 | pea -1:w | orig d0 | ||
77 | movel %d0,%sp@- | d0 | ||
78 | moveml %d1-%d5/%a0-%a1/%curptr,%sp@- | ||
79 | .endm | ||
80 | |||
81 | .macro save_all_sys | ||
82 | clrl %sp@- | stk_adj | ||
83 | movel %d0,%sp@- | orig d0 | ||
84 | movel %d0,%sp@- | d0 | ||
85 | moveml %d1-%d5/%a0-%a1/%curptr,%sp@- | ||
86 | .endm | ||
87 | |||
88 | .macro restore_all | ||
89 | moveml %sp@+,%a0-%a1/%curptr/%d1-%d5 | ||
90 | movel %sp@+,%d0 | ||
91 | addql #4,%sp | orig d0 | ||
92 | addl %sp@+,%sp | stk adj | ||
93 | rte | ||
94 | .endm | ||
95 | |||
96 | #define SWITCH_STACK_SIZE (6*4+4) /* includes return address */ | ||
97 | |||
98 | #define SAVE_SWITCH_STACK save_switch_stack | ||
99 | #define RESTORE_SWITCH_STACK restore_switch_stack | ||
100 | #define GET_CURRENT(tmp) get_current tmp | ||
101 | |||
102 | .macro save_switch_stack | ||
103 | moveml %a3-%a6/%d6-%d7,%sp@- | ||
104 | .endm | ||
105 | |||
106 | .macro restore_switch_stack | ||
107 | moveml %sp@+,%a3-%a6/%d6-%d7 | ||
108 | .endm | ||
109 | |||
110 | .macro get_current reg=%d0 | ||
111 | movel %sp,\reg | ||
112 | andw #-THREAD_SIZE,\reg | ||
113 | movel \reg,%curptr | ||
114 | movel %curptr@,%curptr | ||
115 | .endm | ||
116 | |||
117 | #else /* C source */ | ||
118 | |||
119 | #define STR(X) STR1(X) | ||
120 | #define STR1(X) #X | ||
121 | |||
122 | #define PT_OFF_ORIG_D0 0x24 | ||
123 | #define PT_OFF_FORMATVEC 0x32 | ||
124 | #define PT_OFF_SR 0x2C | ||
125 | #define SAVE_ALL_INT \ | ||
126 | "clrl %%sp@-;" /* stk_adj */ \ | ||
127 | "pea -1:w;" /* orig d0 = -1 */ \ | ||
128 | "movel %%d0,%%sp@-;" /* d0 */ \ | ||
129 | "moveml %%d1-%%d5/%%a0-%%a2,%%sp@-" | ||
130 | #define GET_CURRENT(tmp) \ | ||
131 | "movel %%sp,"#tmp"\n\t" \ | ||
132 | "andw #-"STR(THREAD_SIZE)","#tmp"\n\t" \ | ||
133 | "movel "#tmp",%%a2\n\t" \ | ||
134 | "movel %%a2@,%%a2" | ||
135 | |||
136 | #endif | ||
137 | |||
138 | #endif /* __M68K_ENTRY_H */ | ||
diff --git a/include/asm-m68k/errno.h b/include/asm-m68k/errno.h new file mode 100644 index 000000000000..0d4e188d6ef6 --- /dev/null +++ b/include/asm-m68k/errno.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _M68K_ERRNO_H | ||
2 | #define _M68K_ERRNO_H | ||
3 | |||
4 | #include <asm-generic/errno.h> | ||
5 | |||
6 | #endif /* _M68K_ERRNO_H */ | ||
diff --git a/include/asm-m68k/fbio.h b/include/asm-m68k/fbio.h new file mode 100644 index 000000000000..c17edf8c7bc4 --- /dev/null +++ b/include/asm-m68k/fbio.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-sparc/fbio.h> | |||
diff --git a/include/asm-m68k/fcntl.h b/include/asm-m68k/fcntl.h new file mode 100644 index 000000000000..0d4212983a33 --- /dev/null +++ b/include/asm-m68k/fcntl.h | |||
@@ -0,0 +1,87 @@ | |||
1 | #ifndef _M68K_FCNTL_H | ||
2 | #define _M68K_FCNTL_H | ||
3 | |||
4 | /* open/fcntl - O_SYNC is only implemented on blocks devices and on files | ||
5 | located on an ext2 file system */ | ||
6 | #define O_ACCMODE 0003 | ||
7 | #define O_RDONLY 00 | ||
8 | #define O_WRONLY 01 | ||
9 | #define O_RDWR 02 | ||
10 | #define O_CREAT 0100 /* not fcntl */ | ||
11 | #define O_EXCL 0200 /* not fcntl */ | ||
12 | #define O_NOCTTY 0400 /* not fcntl */ | ||
13 | #define O_TRUNC 01000 /* not fcntl */ | ||
14 | #define O_APPEND 02000 | ||
15 | #define O_NONBLOCK 04000 | ||
16 | #define O_NDELAY O_NONBLOCK | ||
17 | #define O_SYNC 010000 | ||
18 | #define FASYNC 020000 /* fcntl, for BSD compatibility */ | ||
19 | #define O_DIRECTORY 040000 /* must be a directory */ | ||
20 | #define O_NOFOLLOW 0100000 /* don't follow links */ | ||
21 | #define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ | ||
22 | #define O_LARGEFILE 0400000 | ||
23 | #define O_NOATIME 01000000 | ||
24 | |||
25 | #define F_DUPFD 0 /* dup */ | ||
26 | #define F_GETFD 1 /* get close_on_exec */ | ||
27 | #define F_SETFD 2 /* set/clear close_on_exec */ | ||
28 | #define F_GETFL 3 /* get file->f_flags */ | ||
29 | #define F_SETFL 4 /* set file->f_flags */ | ||
30 | #define F_GETLK 5 | ||
31 | #define F_SETLK 6 | ||
32 | #define F_SETLKW 7 | ||
33 | |||
34 | #define F_SETOWN 8 /* for sockets. */ | ||
35 | #define F_GETOWN 9 /* for sockets. */ | ||
36 | #define F_SETSIG 10 /* for sockets. */ | ||
37 | #define F_GETSIG 11 /* for sockets. */ | ||
38 | |||
39 | #define F_GETLK64 12 /* using 'struct flock64' */ | ||
40 | #define F_SETLK64 13 | ||
41 | #define F_SETLKW64 14 | ||
42 | |||
43 | /* for F_[GET|SET]FL */ | ||
44 | #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ | ||
45 | |||
46 | /* for posix fcntl() and lockf() */ | ||
47 | #define F_RDLCK 0 | ||
48 | #define F_WRLCK 1 | ||
49 | #define F_UNLCK 2 | ||
50 | |||
51 | /* for old implementation of bsd flock () */ | ||
52 | #define F_EXLCK 4 /* or 3 */ | ||
53 | #define F_SHLCK 8 /* or 4 */ | ||
54 | |||
55 | /* for leases */ | ||
56 | #define F_INPROGRESS 16 | ||
57 | |||
58 | /* operations for bsd flock(), also used by the kernel implementation */ | ||
59 | #define LOCK_SH 1 /* shared lock */ | ||
60 | #define LOCK_EX 2 /* exclusive lock */ | ||
61 | #define LOCK_NB 4 /* or'd with one of the above to prevent | ||
62 | blocking */ | ||
63 | #define LOCK_UN 8 /* remove lock */ | ||
64 | |||
65 | #define LOCK_MAND 32 /* This is a mandatory flock */ | ||
66 | #define LOCK_READ 64 /* ... Which allows concurrent read operations */ | ||
67 | #define LOCK_WRITE 128 /* ... Which allows concurrent write operations */ | ||
68 | #define LOCK_RW 192 /* ... Which allows concurrent read & write ops */ | ||
69 | |||
70 | struct flock { | ||
71 | short l_type; | ||
72 | short l_whence; | ||
73 | off_t l_start; | ||
74 | off_t l_len; | ||
75 | pid_t l_pid; | ||
76 | }; | ||
77 | |||
78 | struct flock64 { | ||
79 | short l_type; | ||
80 | short l_whence; | ||
81 | loff_t l_start; | ||
82 | loff_t l_len; | ||
83 | pid_t l_pid; | ||
84 | }; | ||
85 | |||
86 | #define F_LINUX_SPECIFIC_BASE 1024 | ||
87 | #endif /* _M68K_FCNTL_H */ | ||
diff --git a/include/asm-m68k/floppy.h b/include/asm-m68k/floppy.h new file mode 100644 index 000000000000..c6e708dd9f62 --- /dev/null +++ b/include/asm-m68k/floppy.h | |||
@@ -0,0 +1,259 @@ | |||
1 | /* | ||
2 | * Implementation independent bits of the Floppy driver. | ||
3 | * | ||
4 | * much of this file is derived from what was originally the Q40 floppy driver. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 1999, 2000, 2001 | ||
11 | * | ||
12 | * Sun3x support added 2/4/2000 Sam Creasey (sammy@sammy.net) | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #include <asm/io.h> | ||
17 | |||
18 | #include <linux/vmalloc.h> | ||
19 | |||
20 | asmlinkage irqreturn_t floppy_hardint(int irq, void *dev_id, | ||
21 | struct pt_regs *regs); | ||
22 | |||
23 | /* constants... */ | ||
24 | |||
25 | #undef MAX_DMA_ADDRESS | ||
26 | #define MAX_DMA_ADDRESS 0x00 /* nothing like that */ | ||
27 | |||
28 | |||
29 | /* | ||
30 | * Again, the CMOS information doesn't work on m68k.. | ||
31 | */ | ||
32 | #define FLOPPY0_TYPE (MACH_IS_Q40 ? 6 : 4) | ||
33 | #define FLOPPY1_TYPE 0 | ||
34 | |||
35 | #define FLOPPY_MOTOR_MASK 0xf0 | ||
36 | |||
37 | |||
38 | /* basically PC init + set use_virtual_dma */ | ||
39 | #define FDC1 m68k_floppy_init() | ||
40 | |||
41 | #define N_FDC 1 | ||
42 | #define N_DRIVE 8 | ||
43 | |||
44 | |||
45 | /* vdma globals adapted from asm-i386/floppy.h */ | ||
46 | |||
47 | static int virtual_dma_count=0; | ||
48 | static int virtual_dma_residue=0; | ||
49 | static char *virtual_dma_addr=0; | ||
50 | static int virtual_dma_mode=0; | ||
51 | static int doing_pdma=0; | ||
52 | |||
53 | #include <asm/sun3xflop.h> | ||
54 | |||
55 | extern spinlock_t dma_spin_lock; | ||
56 | |||
57 | static __inline__ unsigned long claim_dma_lock(void) | ||
58 | { | ||
59 | unsigned long flags; | ||
60 | spin_lock_irqsave(&dma_spin_lock, flags); | ||
61 | return flags; | ||
62 | } | ||
63 | |||
64 | static __inline__ void release_dma_lock(unsigned long flags) | ||
65 | { | ||
66 | spin_unlock_irqrestore(&dma_spin_lock, flags); | ||
67 | } | ||
68 | |||
69 | |||
70 | static __inline__ unsigned char fd_inb(int port) | ||
71 | { | ||
72 | if(MACH_IS_Q40) | ||
73 | return inb_p(port); | ||
74 | else if(MACH_IS_SUN3X) | ||
75 | return sun3x_82072_fd_inb(port); | ||
76 | return 0; | ||
77 | } | ||
78 | |||
79 | static __inline__ void fd_outb(unsigned char value, int port) | ||
80 | { | ||
81 | if(MACH_IS_Q40) | ||
82 | outb_p(value, port); | ||
83 | else if(MACH_IS_SUN3X) | ||
84 | sun3x_82072_fd_outb(value, port); | ||
85 | } | ||
86 | |||
87 | |||
88 | static int fd_request_irq(void) | ||
89 | { | ||
90 | if(MACH_IS_Q40) | ||
91 | return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT, | ||
92 | "floppy", floppy_hardint); | ||
93 | else if(MACH_IS_SUN3X) | ||
94 | return sun3xflop_request_irq(); | ||
95 | return -ENXIO; | ||
96 | } | ||
97 | |||
98 | static void fd_free_irq(void) | ||
99 | { | ||
100 | if(MACH_IS_Q40) | ||
101 | free_irq(FLOPPY_IRQ, floppy_hardint); | ||
102 | } | ||
103 | |||
104 | #define fd_request_dma() vdma_request_dma(FLOPPY_DMA,"floppy") | ||
105 | #define fd_get_dma_residue() vdma_get_dma_residue(FLOPPY_DMA) | ||
106 | #define fd_dma_mem_alloc(size) vdma_mem_alloc(size) | ||
107 | #define fd_dma_setup(addr, size, mode, io) vdma_dma_setup(addr, size, mode, io) | ||
108 | |||
109 | #define fd_enable_irq() /* nothing... */ | ||
110 | #define fd_disable_irq() /* nothing... */ | ||
111 | |||
112 | #define fd_free_dma() /* nothing */ | ||
113 | |||
114 | /* No 64k boundary crossing problems on Q40 - no DMA at all */ | ||
115 | #define CROSS_64KB(a,s) (0) | ||
116 | |||
117 | #define DMA_MODE_READ 0x44 /* i386 look-alike */ | ||
118 | #define DMA_MODE_WRITE 0x48 | ||
119 | |||
120 | |||
121 | static int m68k_floppy_init(void) | ||
122 | { | ||
123 | use_virtual_dma =1; | ||
124 | can_use_virtual_dma = 1; | ||
125 | |||
126 | |||
127 | if (MACH_IS_Q40) | ||
128 | return 0x3f0; | ||
129 | else if(MACH_IS_SUN3X) | ||
130 | return sun3xflop_init(); | ||
131 | else | ||
132 | return -1; | ||
133 | } | ||
134 | |||
135 | |||
136 | static int vdma_request_dma(unsigned int dmanr, const char * device_id) | ||
137 | { | ||
138 | return 0; | ||
139 | } | ||
140 | |||
141 | |||
142 | static int vdma_get_dma_residue(unsigned int dummy) | ||
143 | { | ||
144 | return virtual_dma_count + virtual_dma_residue; | ||
145 | } | ||
146 | |||
147 | |||
148 | static unsigned long vdma_mem_alloc(unsigned long size) | ||
149 | { | ||
150 | return (unsigned long) vmalloc(size); | ||
151 | |||
152 | } | ||
153 | |||
154 | static void _fd_dma_mem_free(unsigned long addr, unsigned long size) | ||
155 | { | ||
156 | vfree((void *)addr); | ||
157 | } | ||
158 | #define fd_dma_mem_free(addr,size) _fd_dma_mem_free(addr, size) | ||
159 | |||
160 | |||
161 | /* choose_dma_mode ???*/ | ||
162 | |||
163 | static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io) | ||
164 | { | ||
165 | doing_pdma = 1; | ||
166 | virtual_dma_port = (MACH_IS_Q40 ? io : 0); | ||
167 | virtual_dma_mode = (mode == DMA_MODE_WRITE); | ||
168 | virtual_dma_addr = addr; | ||
169 | virtual_dma_count = size; | ||
170 | virtual_dma_residue = 0; | ||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | |||
175 | |||
176 | static void fd_disable_dma(void) | ||
177 | { | ||
178 | doing_pdma = 0; | ||
179 | virtual_dma_residue += virtual_dma_count; | ||
180 | virtual_dma_count=0; | ||
181 | } | ||
182 | |||
183 | |||
184 | |||
185 | /* this is the only truly Q40 specific function */ | ||
186 | |||
187 | asmlinkage irqreturn_t floppy_hardint(int irq, void *dev_id, | ||
188 | struct pt_regs *regs) | ||
189 | { | ||
190 | register unsigned char st; | ||
191 | |||
192 | #undef TRACE_FLPY_INT | ||
193 | #define NO_FLOPPY_ASSEMBLER | ||
194 | |||
195 | #ifdef TRACE_FLPY_INT | ||
196 | static int calls=0; | ||
197 | static int bytes=0; | ||
198 | static int dma_wait=0; | ||
199 | #endif | ||
200 | if(!doing_pdma) { | ||
201 | floppy_interrupt(irq, dev_id, regs); | ||
202 | return IRQ_HANDLED; | ||
203 | } | ||
204 | |||
205 | #ifdef TRACE_FLPY_INT | ||
206 | if(!calls) | ||
207 | bytes = virtual_dma_count; | ||
208 | #endif | ||
209 | |||
210 | { | ||
211 | register int lcount; | ||
212 | register char *lptr; | ||
213 | |||
214 | /* serve 1st byte fast: */ | ||
215 | |||
216 | st=1; | ||
217 | for(lcount=virtual_dma_count, lptr=virtual_dma_addr; | ||
218 | lcount; lcount--, lptr++) { | ||
219 | st=inb(virtual_dma_port+4) & 0xa0 ; | ||
220 | if(st != 0xa0) | ||
221 | break; | ||
222 | if(virtual_dma_mode) | ||
223 | outb_p(*lptr, virtual_dma_port+5); | ||
224 | else | ||
225 | *lptr = inb_p(virtual_dma_port+5); | ||
226 | } | ||
227 | |||
228 | virtual_dma_count = lcount; | ||
229 | virtual_dma_addr = lptr; | ||
230 | st = inb(virtual_dma_port+4); | ||
231 | } | ||
232 | |||
233 | #ifdef TRACE_FLPY_INT | ||
234 | calls++; | ||
235 | #endif | ||
236 | if(st == 0x20) | ||
237 | return IRQ_HANDLED; | ||
238 | if(!(st & 0x20)) { | ||
239 | virtual_dma_residue += virtual_dma_count; | ||
240 | virtual_dma_count=0; | ||
241 | #ifdef TRACE_FLPY_INT | ||
242 | printk("count=%x, residue=%x calls=%d bytes=%d dma_wait=%d\n", | ||
243 | virtual_dma_count, virtual_dma_residue, calls, bytes, | ||
244 | dma_wait); | ||
245 | calls = 0; | ||
246 | dma_wait=0; | ||
247 | #endif | ||
248 | doing_pdma = 0; | ||
249 | floppy_interrupt(irq, dev_id, regs); | ||
250 | return IRQ_HANDLED; | ||
251 | } | ||
252 | #ifdef TRACE_FLPY_INT | ||
253 | if(!virtual_dma_count) | ||
254 | dma_wait++; | ||
255 | #endif | ||
256 | return IRQ_HANDLED; | ||
257 | } | ||
258 | |||
259 | #define EXTRA_FLOPPY_PARAMS | ||
diff --git a/include/asm-m68k/fpu.h b/include/asm-m68k/fpu.h new file mode 100644 index 000000000000..3bcf85065c19 --- /dev/null +++ b/include/asm-m68k/fpu.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef __M68K_FPU_H | ||
2 | #define __M68K_FPU_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | |||
6 | /* | ||
7 | * MAX floating point unit state size (FSAVE/FRESTORE) | ||
8 | */ | ||
9 | |||
10 | #if defined(CONFIG_M68020) || defined(CONFIG_M68030) | ||
11 | #define FPSTATESIZE (216/sizeof(unsigned char)) | ||
12 | #elif defined(CONFIG_M68040) | ||
13 | #define FPSTATESIZE (96/sizeof(unsigned char)) | ||
14 | #elif defined(CONFIG_M68KFPU_EMU) | ||
15 | #define FPSTATESIZE (28/sizeof(unsigned char)) | ||
16 | #elif defined(CONFIG_M68060) | ||
17 | #define FPSTATESIZE (12/sizeof(unsigned char)) | ||
18 | #else | ||
19 | #define FPSTATESIZE error no_cpu_type_configured | ||
20 | #endif | ||
21 | |||
22 | #endif /* __M68K_FPU_H */ | ||
diff --git a/include/asm-m68k/hardirq.h b/include/asm-m68k/hardirq.h new file mode 100644 index 000000000000..728318bf7f0e --- /dev/null +++ b/include/asm-m68k/hardirq.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef __M68K_HARDIRQ_H | ||
2 | #define __M68K_HARDIRQ_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | #include <linux/threads.h> | ||
6 | #include <linux/cache.h> | ||
7 | |||
8 | /* entry.S is sensitive to the offsets of these fields */ | ||
9 | typedef struct { | ||
10 | unsigned int __softirq_pending; | ||
11 | } ____cacheline_aligned irq_cpustat_t; | ||
12 | |||
13 | #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ | ||
14 | |||
15 | #define HARDIRQ_BITS 8 | ||
16 | |||
17 | /* | ||
18 | * The hardirq mask has to be large enough to have | ||
19 | * space for potentially all IRQ sources in the system | ||
20 | * nesting on a single CPU: | ||
21 | */ | ||
22 | #if (1 << HARDIRQ_BITS) < NR_IRQS | ||
23 | # error HARDIRQ_BITS is too low! | ||
24 | #endif | ||
25 | |||
26 | #endif | ||
diff --git a/include/asm-m68k/hdreg.h b/include/asm-m68k/hdreg.h new file mode 100644 index 000000000000..5989bbc97cbf --- /dev/null +++ b/include/asm-m68k/hdreg.h | |||
@@ -0,0 +1 @@ | |||
#warning this file is obsolete, please do not use it | |||
diff --git a/include/asm-m68k/hp300hw.h b/include/asm-m68k/hp300hw.h new file mode 100644 index 000000000000..d998ea67c19c --- /dev/null +++ b/include/asm-m68k/hp300hw.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _M68K_HP300HW_H | ||
2 | #define _M68K_HP300HW_H | ||
3 | |||
4 | extern unsigned long hp300_model; | ||
5 | |||
6 | /* This information was taken from NetBSD */ | ||
7 | #define HP_320 (0) /* 16MHz 68020+HP MMU+16K external cache */ | ||
8 | #define HP_330 (1) /* 16MHz 68020+68851 MMU */ | ||
9 | #define HP_340 (2) /* 16MHz 68030 */ | ||
10 | #define HP_345 (3) /* 50MHz 68030+32K external cache */ | ||
11 | #define HP_350 (4) /* 25MHz 68020+HP MMU+32K external cache */ | ||
12 | #define HP_360 (5) /* 25MHz 68030 */ | ||
13 | #define HP_370 (6) /* 33MHz 68030+64K external cache */ | ||
14 | #define HP_375 (7) /* 50MHz 68030+32K external cache */ | ||
15 | #define HP_380 (8) /* 25MHz 68040 */ | ||
16 | #define HP_385 (9) /* 33MHz 68040 */ | ||
17 | |||
18 | #define HP_400 (10) /* 50MHz 68030+32K external cache */ | ||
19 | #define HP_425T (11) /* 25MHz 68040 - model 425t */ | ||
20 | #define HP_425S (12) /* 25MHz 68040 - model 425s */ | ||
21 | #define HP_425E (13) /* 25MHz 68040 - model 425e */ | ||
22 | #define HP_433T (14) /* 33MHz 68040 - model 433t */ | ||
23 | #define HP_433S (15) /* 33MHz 68040 - model 433s */ | ||
24 | |||
25 | #endif /* _M68K_HP300HW_H */ | ||
diff --git a/include/asm-m68k/hw_irq.h b/include/asm-m68k/hw_irq.h new file mode 100644 index 000000000000..eacef0951fbf --- /dev/null +++ b/include/asm-m68k/hw_irq.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_M68K_HW_IRQ_H | ||
2 | #define __ASM_M68K_HW_IRQ_H | ||
3 | |||
4 | /* Dummy include. */ | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-m68k/hwtest.h b/include/asm-m68k/hwtest.h new file mode 100644 index 000000000000..402c8a4401fe --- /dev/null +++ b/include/asm-m68k/hwtest.h | |||
@@ -0,0 +1,15 @@ | |||
1 | /* Routines to test for presence/absence of hardware registers: | ||
2 | * see arch/m68k/mm/hwtest.c. | ||
3 | * -- PMM <pmaydell@chiark.greenend.org.uk> 05/1998 | ||
4 | * | ||
5 | * Removed __init from decls. We might want them in modules, and | ||
6 | * the code is tiny anyway. 16/5/98 pb | ||
7 | */ | ||
8 | |||
9 | #ifndef __ASM_HWTEST_H | ||
10 | #define __ASM_HWTEST_H | ||
11 | |||
12 | extern int hwreg_present(volatile void *regp); | ||
13 | extern int hwreg_write(volatile void *regp, unsigned short val); | ||
14 | |||
15 | #endif | ||
diff --git a/include/asm-m68k/ide.h b/include/asm-m68k/ide.h new file mode 100644 index 000000000000..36118fd01867 --- /dev/null +++ b/include/asm-m68k/ide.h | |||
@@ -0,0 +1,144 @@ | |||
1 | /* | ||
2 | * linux/include/asm-m68k/ide.h | ||
3 | * | ||
4 | * Copyright (C) 1994-1996 Linus Torvalds & authors | ||
5 | */ | ||
6 | |||
7 | /* Copyright(c) 1996 Kars de Jong */ | ||
8 | /* Based on the ide driver from 1.2.13pl8 */ | ||
9 | |||
10 | /* | ||
11 | * Credits (alphabetical): | ||
12 | * | ||
13 | * - Bjoern Brauel | ||
14 | * - Kars de Jong | ||
15 | * - Torsten Ebeling | ||
16 | * - Dwight Engen | ||
17 | * - Thorsten Floeck | ||
18 | * - Roman Hodek | ||
19 | * - Guenther Kelleter | ||
20 | * - Chris Lawrence | ||
21 | * - Michael Rausch | ||
22 | * - Christian Sauer | ||
23 | * - Michael Schmitz | ||
24 | * - Jes Soerensen | ||
25 | * - Michael Thurm | ||
26 | * - Geert Uytterhoeven | ||
27 | */ | ||
28 | |||
29 | #ifndef _M68K_IDE_H | ||
30 | #define _M68K_IDE_H | ||
31 | |||
32 | #ifdef __KERNEL__ | ||
33 | |||
34 | #include <linux/config.h> | ||
35 | |||
36 | #include <asm/setup.h> | ||
37 | #include <asm/io.h> | ||
38 | #include <asm/irq.h> | ||
39 | |||
40 | #ifdef CONFIG_ATARI | ||
41 | #include <linux/interrupt.h> | ||
42 | #include <asm/atari_stdma.h> | ||
43 | #endif | ||
44 | |||
45 | #ifdef CONFIG_MAC | ||
46 | #include <asm/macints.h> | ||
47 | #endif | ||
48 | |||
49 | #ifndef MAX_HWIFS | ||
50 | #define MAX_HWIFS 4 /* same as the other archs */ | ||
51 | #endif | ||
52 | |||
53 | /* | ||
54 | * Get rid of defs from io.h - ide has its private and conflicting versions | ||
55 | * Since so far no single m68k platform uses ISA/PCI I/O space for IDE, we | ||
56 | * always use the `raw' MMIO versions | ||
57 | */ | ||
58 | #undef inb | ||
59 | #undef inw | ||
60 | #undef insw | ||
61 | #undef inl | ||
62 | #undef insl | ||
63 | #undef outb | ||
64 | #undef outw | ||
65 | #undef outsw | ||
66 | #undef outl | ||
67 | #undef outsl | ||
68 | #undef readb | ||
69 | #undef readw | ||
70 | #undef readl | ||
71 | #undef writeb | ||
72 | #undef writew | ||
73 | #undef writel | ||
74 | |||
75 | #define inb in_8 | ||
76 | #define inw in_be16 | ||
77 | #define insw(port, addr, n) raw_insw((u16 *)port, addr, n) | ||
78 | #define inl in_be32 | ||
79 | #define insl(port, addr, n) raw_insl((u32 *)port, addr, n) | ||
80 | #define outb(val, port) out_8(port, val) | ||
81 | #define outw(val, port) out_be16(port, val) | ||
82 | #define outsw(port, addr, n) raw_outsw((u16 *)port, addr, n) | ||
83 | #define outl(val, port) out_be32(port, val) | ||
84 | #define outsl(port, addr, n) raw_outsl((u32 *)port, addr, n) | ||
85 | #define readb in_8 | ||
86 | #define readw in_be16 | ||
87 | #define __ide_mm_insw(port, addr, n) raw_insw((u16 *)port, addr, n) | ||
88 | #define readl in_be32 | ||
89 | #define __ide_mm_insl(port, addr, n) raw_insl((u32 *)port, addr, n) | ||
90 | #define writeb(val, port) out_8(port, val) | ||
91 | #define writew(val, port) out_be16(port, val) | ||
92 | #define __ide_mm_outsw(port, addr, n) raw_outsw((u16 *)port, addr, n) | ||
93 | #define writel(val, port) out_be32(port, val) | ||
94 | #define __ide_mm_outsl(port, addr, n) raw_outsl((u32 *)port, addr, n) | ||
95 | #if defined(CONFIG_ATARI) || defined(CONFIG_Q40) | ||
96 | #define insw_swapw(port, addr, n) raw_insw_swapw((u16 *)port, addr, n) | ||
97 | #define outsw_swapw(port, addr, n) raw_outsw_swapw((u16 *)port, addr, n) | ||
98 | #endif | ||
99 | |||
100 | |||
101 | /* Q40 and Atari have byteswapped IDE busses and since many interesting | ||
102 | * values in the identification string are text, chars and words they | ||
103 | * happened to be almost correct without swapping.. However *_capacity | ||
104 | * is needed for drives over 8 GB. RZ */ | ||
105 | #if defined(CONFIG_Q40) || defined(CONFIG_ATARI) | ||
106 | #define M68K_IDE_SWAPW (MACH_IS_Q40 || MACH_IS_ATARI) | ||
107 | #endif | ||
108 | |||
109 | #ifdef CONFIG_BLK_DEV_FALCON_IDE | ||
110 | #define IDE_ARCH_LOCK | ||
111 | |||
112 | extern int falconide_intr_lock; | ||
113 | |||
114 | static __inline__ void ide_release_lock (void) | ||
115 | { | ||
116 | if (MACH_IS_ATARI) { | ||
117 | if (falconide_intr_lock == 0) { | ||
118 | printk("ide_release_lock: bug\n"); | ||
119 | return; | ||
120 | } | ||
121 | falconide_intr_lock = 0; | ||
122 | stdma_release(); | ||
123 | } | ||
124 | } | ||
125 | |||
126 | static __inline__ void | ||
127 | ide_get_lock(irqreturn_t (*handler)(int, void *, struct pt_regs *), void *data) | ||
128 | { | ||
129 | if (MACH_IS_ATARI) { | ||
130 | if (falconide_intr_lock == 0) { | ||
131 | if (in_interrupt() > 0) | ||
132 | panic( "Falcon IDE hasn't ST-DMA lock in interrupt" ); | ||
133 | stdma_lock(handler, data); | ||
134 | falconide_intr_lock = 1; | ||
135 | } | ||
136 | } | ||
137 | } | ||
138 | #endif /* CONFIG_BLK_DEV_FALCON_IDE */ | ||
139 | |||
140 | #define IDE_ARCH_ACK_INTR | ||
141 | #define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1) | ||
142 | |||
143 | #endif /* __KERNEL__ */ | ||
144 | #endif /* _M68K_IDE_H */ | ||
diff --git a/include/asm-m68k/idprom.h b/include/asm-m68k/idprom.h new file mode 100644 index 000000000000..4349eaf3cfe4 --- /dev/null +++ b/include/asm-m68k/idprom.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef _M68K_IDPROM_H | ||
2 | #define _M68K_IDPROM_H | ||
3 | #include <asm-sparc/idprom.h> | ||
4 | |||
5 | /* Sun3: in control space */ | ||
6 | #define SUN3_IDPROM_BASE 0x00000000 | ||
7 | |||
8 | #endif /* !(_M68K_IDPROM_H) */ | ||
diff --git a/include/asm-m68k/intersil.h b/include/asm-m68k/intersil.h new file mode 100644 index 000000000000..f482902cac8a --- /dev/null +++ b/include/asm-m68k/intersil.h | |||
@@ -0,0 +1,48 @@ | |||
1 | #ifndef _SUN3_INTERSIL_H | ||
2 | #define _SUN3_INTERSIL_H | ||
3 | /* bits 0 and 1 */ | ||
4 | #define INTERSIL_FREQ_32K 0x00 | ||
5 | #define INTERSIL_FREQ_1M 0x01 | ||
6 | #define INTERSIL_FREQ_2M 0x02 | ||
7 | #define INTERSIL_FREQ_4M 0x03 | ||
8 | |||
9 | /* bit 2 */ | ||
10 | #define INTERSIL_12H_MODE 0x00 | ||
11 | #define INTERSIL_24H_MODE 0x04 | ||
12 | |||
13 | /* bit 3 */ | ||
14 | #define INTERSIL_STOP 0x00 | ||
15 | #define INTERSIL_RUN 0x08 | ||
16 | |||
17 | /* bit 4 */ | ||
18 | #define INTERSIL_INT_ENABLE 0x10 | ||
19 | #define INTERSIL_INT_DISABLE 0x00 | ||
20 | |||
21 | /* bit 5 */ | ||
22 | #define INTERSIL_MODE_NORMAL 0x00 | ||
23 | #define INTERSIL_MODE_TEST 0x20 | ||
24 | |||
25 | #define INTERSIL_HZ_100_MASK 0x02 | ||
26 | |||
27 | struct intersil_dt { | ||
28 | unsigned char csec; | ||
29 | unsigned char hour; | ||
30 | unsigned char minute; | ||
31 | unsigned char second; | ||
32 | unsigned char month; | ||
33 | unsigned char day; | ||
34 | unsigned char year; | ||
35 | unsigned char weekday; | ||
36 | }; | ||
37 | |||
38 | struct intersil_7170 { | ||
39 | struct intersil_dt counter; | ||
40 | struct intersil_dt alarm; | ||
41 | unsigned char int_reg; | ||
42 | unsigned char cmd_reg; | ||
43 | }; | ||
44 | |||
45 | extern volatile char* clock_va; | ||
46 | #define intersil_clock ((volatile struct intersil_7170 *) clock_va) | ||
47 | #define intersil_clear() (void)intersil_clock->int_reg | ||
48 | #endif | ||
diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h new file mode 100644 index 000000000000..6bb8b0d8f99d --- /dev/null +++ b/include/asm-m68k/io.h | |||
@@ -0,0 +1,376 @@ | |||
1 | /* | ||
2 | * linux/include/asm-m68k/io.h | ||
3 | * | ||
4 | * 4/1/00 RZ: - rewritten to avoid clashes between ISA/PCI and other | ||
5 | * IO access | ||
6 | * - added Q40 support | ||
7 | * - added skeleton for GG-II and Amiga PCMCIA | ||
8 | * 2/3/01 RZ: - moved a few more defs into raw_io.h | ||
9 | * | ||
10 | * inX/outX/readX/writeX should not be used by any driver unless it does | ||
11 | * ISA or PCI access. Other drivers should use function defined in raw_io.h | ||
12 | * or define its own macros on top of these. | ||
13 | * | ||
14 | * inX(),outX() are for PCI and ISA I/O | ||
15 | * readX(),writeX() are for PCI memory | ||
16 | * isa_readX(),isa_writeX() are for ISA memory | ||
17 | * | ||
18 | * moved mem{cpy,set}_*io inside CONFIG_PCI | ||
19 | */ | ||
20 | |||
21 | #ifndef _IO_H | ||
22 | #define _IO_H | ||
23 | |||
24 | #ifdef __KERNEL__ | ||
25 | |||
26 | #include <linux/config.h> | ||
27 | #include <asm/raw_io.h> | ||
28 | #include <asm/virtconvert.h> | ||
29 | |||
30 | |||
31 | #ifdef CONFIG_ATARI | ||
32 | #include <asm/atarihw.h> | ||
33 | #endif | ||
34 | |||
35 | |||
36 | /* | ||
37 | * IO/MEM definitions for various ISA bridges | ||
38 | */ | ||
39 | |||
40 | |||
41 | #ifdef CONFIG_Q40 | ||
42 | |||
43 | #define q40_isa_io_base 0xff400000 | ||
44 | #define q40_isa_mem_base 0xff800000 | ||
45 | |||
46 | #define Q40_ISA_IO_B(ioaddr) (q40_isa_io_base+1+4*((unsigned long)(ioaddr))) | ||
47 | #define Q40_ISA_IO_W(ioaddr) (q40_isa_io_base+ 4*((unsigned long)(ioaddr))) | ||
48 | #define Q40_ISA_MEM_B(madr) (q40_isa_mem_base+1+4*((unsigned long)(madr))) | ||
49 | #define Q40_ISA_MEM_W(madr) (q40_isa_mem_base+ 4*((unsigned long)(madr))) | ||
50 | |||
51 | #define MULTI_ISA 0 | ||
52 | #endif /* Q40 */ | ||
53 | |||
54 | /* GG-II Zorro to ISA bridge */ | ||
55 | #ifdef CONFIG_GG2 | ||
56 | |||
57 | extern unsigned long gg2_isa_base; | ||
58 | #define GG2_ISA_IO_B(ioaddr) (gg2_isa_base+1+((unsigned long)(ioaddr)*4)) | ||
59 | #define GG2_ISA_IO_W(ioaddr) (gg2_isa_base+ ((unsigned long)(ioaddr)*4)) | ||
60 | #define GG2_ISA_MEM_B(madr) (gg2_isa_base+1+(((unsigned long)(madr)*4) & 0xfffff)) | ||
61 | #define GG2_ISA_MEM_W(madr) (gg2_isa_base+ (((unsigned long)(madr)*4) & 0xfffff)) | ||
62 | |||
63 | #ifndef MULTI_ISA | ||
64 | #define MULTI_ISA 0 | ||
65 | #else | ||
66 | #undef MULTI_ISA | ||
67 | #define MULTI_ISA 1 | ||
68 | #endif | ||
69 | #endif /* GG2 */ | ||
70 | |||
71 | #ifdef CONFIG_AMIGA_PCMCIA | ||
72 | #include <asm/amigayle.h> | ||
73 | |||
74 | #define AG_ISA_IO_B(ioaddr) ( GAYLE_IO+(ioaddr)+(((ioaddr)&1)*GAYLE_ODD) ) | ||
75 | #define AG_ISA_IO_W(ioaddr) ( GAYLE_IO+(ioaddr) ) | ||
76 | |||
77 | #ifndef MULTI_ISA | ||
78 | #define MULTI_ISA 0 | ||
79 | #else | ||
80 | #undef MULTI_ISA | ||
81 | #define MULTI_ISA 1 | ||
82 | #endif | ||
83 | #endif /* AMIGA_PCMCIA */ | ||
84 | |||
85 | |||
86 | |||
87 | #ifdef CONFIG_ISA | ||
88 | |||
89 | #if MULTI_ISA == 0 | ||
90 | #undef MULTI_ISA | ||
91 | #endif | ||
92 | |||
93 | #define Q40_ISA (1) | ||
94 | #define GG2_ISA (2) | ||
95 | #define AG_ISA (3) | ||
96 | |||
97 | #if defined(CONFIG_Q40) && !defined(MULTI_ISA) | ||
98 | #define ISA_TYPE Q40_ISA | ||
99 | #define ISA_SEX 0 | ||
100 | #endif | ||
101 | #if defined(CONFIG_AMIGA_PCMCIA) && !defined(MULTI_ISA) | ||
102 | #define ISA_TYPE AG_ISA | ||
103 | #define ISA_SEX 1 | ||
104 | #endif | ||
105 | #if defined(CONFIG_GG2) && !defined(MULTI_ISA) | ||
106 | #define ISA_TYPE GG2_ISA | ||
107 | #define ISA_SEX 0 | ||
108 | #endif | ||
109 | |||
110 | #ifdef MULTI_ISA | ||
111 | extern int isa_type; | ||
112 | extern int isa_sex; | ||
113 | |||
114 | #define ISA_TYPE isa_type | ||
115 | #define ISA_SEX isa_sex | ||
116 | #endif | ||
117 | |||
118 | /* | ||
119 | * define inline addr translation functions. Normally only one variant will | ||
120 | * be compiled in so the case statement will be optimised away | ||
121 | */ | ||
122 | |||
123 | static inline u8 *isa_itb(unsigned long addr) | ||
124 | { | ||
125 | switch(ISA_TYPE) | ||
126 | { | ||
127 | #ifdef CONFIG_Q40 | ||
128 | case Q40_ISA: return (u8 *)Q40_ISA_IO_B(addr); | ||
129 | #endif | ||
130 | #ifdef CONFIG_GG2 | ||
131 | case GG2_ISA: return (u8 *)GG2_ISA_IO_B(addr); | ||
132 | #endif | ||
133 | #ifdef CONFIG_AMIGA_PCMCIA | ||
134 | case AG_ISA: return (u8 *)AG_ISA_IO_B(addr); | ||
135 | #endif | ||
136 | default: return 0; /* avoid warnings, just in case */ | ||
137 | } | ||
138 | } | ||
139 | static inline u16 *isa_itw(unsigned long addr) | ||
140 | { | ||
141 | switch(ISA_TYPE) | ||
142 | { | ||
143 | #ifdef CONFIG_Q40 | ||
144 | case Q40_ISA: return (u16 *)Q40_ISA_IO_W(addr); | ||
145 | #endif | ||
146 | #ifdef CONFIG_GG2 | ||
147 | case GG2_ISA: return (u16 *)GG2_ISA_IO_W(addr); | ||
148 | #endif | ||
149 | #ifdef CONFIG_AMIGA_PCMCIA | ||
150 | case AG_ISA: return (u16 *)AG_ISA_IO_W(addr); | ||
151 | #endif | ||
152 | default: return 0; /* avoid warnings, just in case */ | ||
153 | } | ||
154 | } | ||
155 | static inline u8 *isa_mtb(unsigned long addr) | ||
156 | { | ||
157 | switch(ISA_TYPE) | ||
158 | { | ||
159 | #ifdef CONFIG_Q40 | ||
160 | case Q40_ISA: return (u8 *)Q40_ISA_MEM_B(addr); | ||
161 | #endif | ||
162 | #ifdef CONFIG_GG2 | ||
163 | case GG2_ISA: return (u8 *)GG2_ISA_MEM_B(addr); | ||
164 | #endif | ||
165 | #ifdef CONFIG_AMIGA_PCMCIA | ||
166 | case AG_ISA: return (u8 *)addr; | ||
167 | #endif | ||
168 | default: return 0; /* avoid warnings, just in case */ | ||
169 | } | ||
170 | } | ||
171 | static inline u16 *isa_mtw(unsigned long addr) | ||
172 | { | ||
173 | switch(ISA_TYPE) | ||
174 | { | ||
175 | #ifdef CONFIG_Q40 | ||
176 | case Q40_ISA: return (u16 *)Q40_ISA_MEM_W(addr); | ||
177 | #endif | ||
178 | #ifdef CONFIG_GG2 | ||
179 | case GG2_ISA: return (u16 *)GG2_ISA_MEM_W(addr); | ||
180 | #endif | ||
181 | #ifdef CONFIG_AMIGA_PCMCIA | ||
182 | case AG_ISA: return (u16 *)addr; | ||
183 | #endif | ||
184 | default: return 0; /* avoid warnings, just in case */ | ||
185 | } | ||
186 | } | ||
187 | |||
188 | |||
189 | #define isa_inb(port) in_8(isa_itb(port)) | ||
190 | #define isa_inw(port) (ISA_SEX ? in_be16(isa_itw(port)) : in_le16(isa_itw(port))) | ||
191 | #define isa_outb(val,port) out_8(isa_itb(port),(val)) | ||
192 | #define isa_outw(val,port) (ISA_SEX ? out_be16(isa_itw(port),(val)) : out_le16(isa_itw(port),(val))) | ||
193 | |||
194 | #define isa_readb(p) in_8(isa_mtb((unsigned long)(p))) | ||
195 | #define isa_readw(p) \ | ||
196 | (ISA_SEX ? in_be16(isa_mtw((unsigned long)(p))) \ | ||
197 | : in_le16(isa_mtw((unsigned long)(p)))) | ||
198 | #define isa_writeb(val,p) out_8(isa_mtb((unsigned long)(p)),(val)) | ||
199 | #define isa_writew(val,p) \ | ||
200 | (ISA_SEX ? out_be16(isa_mtw((unsigned long)(p)),(val)) \ | ||
201 | : out_le16(isa_mtw((unsigned long)(p)),(val))) | ||
202 | |||
203 | static inline void isa_delay(void) | ||
204 | { | ||
205 | switch(ISA_TYPE) | ||
206 | { | ||
207 | #ifdef CONFIG_Q40 | ||
208 | case Q40_ISA: isa_outb(0,0x80); break; | ||
209 | #endif | ||
210 | #ifdef CONFIG_GG2 | ||
211 | case GG2_ISA: break; | ||
212 | #endif | ||
213 | #ifdef CONFIG_AMIGA_PCMCIA | ||
214 | case AG_ISA: break; | ||
215 | #endif | ||
216 | default: break; /* avoid warnings */ | ||
217 | } | ||
218 | } | ||
219 | |||
220 | #define isa_inb_p(p) ({u8 v=isa_inb(p);isa_delay();v;}) | ||
221 | #define isa_outb_p(v,p) ({isa_outb((v),(p));isa_delay();}) | ||
222 | #define isa_inw_p(p) ({u16 v=isa_inw(p);isa_delay();v;}) | ||
223 | #define isa_outw_p(v,p) ({isa_outw((v),(p));isa_delay();}) | ||
224 | #define isa_inl_p(p) ({u32 v=isa_inl(p);isa_delay();v;}) | ||
225 | #define isa_outl_p(v,p) ({isa_outl((v),(p));isa_delay();}) | ||
226 | |||
227 | #define isa_insb(port, buf, nr) raw_insb(isa_itb(port), (u8 *)(buf), (nr)) | ||
228 | #define isa_outsb(port, buf, nr) raw_outsb(isa_itb(port), (u8 *)(buf), (nr)) | ||
229 | |||
230 | #define isa_insw(port, buf, nr) \ | ||
231 | (ISA_SEX ? raw_insw(isa_itw(port), (u16 *)(buf), (nr)) : \ | ||
232 | raw_insw_swapw(isa_itw(port), (u16 *)(buf), (nr))) | ||
233 | |||
234 | #define isa_outsw(port, buf, nr) \ | ||
235 | (ISA_SEX ? raw_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \ | ||
236 | raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr))) | ||
237 | #endif /* CONFIG_ISA */ | ||
238 | |||
239 | |||
240 | #if defined(CONFIG_ISA) && !defined(CONFIG_PCI) | ||
241 | #define inb isa_inb | ||
242 | #define inb_p isa_inb_p | ||
243 | #define outb isa_outb | ||
244 | #define outb_p isa_outb_p | ||
245 | #define inw isa_inw | ||
246 | #define inw_p isa_inw_p | ||
247 | #define outw isa_outw | ||
248 | #define outw_p isa_outw_p | ||
249 | #define inl isa_inw | ||
250 | #define inl_p isa_inw_p | ||
251 | #define outl isa_outw | ||
252 | #define outl_p isa_outw_p | ||
253 | #define insb isa_insb | ||
254 | #define insw isa_insw | ||
255 | #define outsb isa_outsb | ||
256 | #define outsw isa_outsw | ||
257 | #define readb isa_readb | ||
258 | #define readw isa_readw | ||
259 | #define writeb isa_writeb | ||
260 | #define writew isa_writew | ||
261 | #endif /* CONFIG_ISA */ | ||
262 | |||
263 | #if defined(CONFIG_PCI) | ||
264 | |||
265 | #define inl(port) in_le32(port) | ||
266 | #define outl(val,port) out_le32((port),(val)) | ||
267 | #define readl(addr) in_le32(addr) | ||
268 | #define writel(val,addr) out_le32((addr),(val)) | ||
269 | |||
270 | /* those can be defined for both ISA and PCI - it won't work though */ | ||
271 | #define readb(addr) in_8(addr) | ||
272 | #define readw(addr) in_le16(addr) | ||
273 | #define writeb(val,addr) out_8((addr),(val)) | ||
274 | #define writew(val,addr) out_le16((addr),(val)) | ||
275 | |||
276 | #define readb_relaxed(addr) readb(addr) | ||
277 | #define readw_relaxed(addr) readw(addr) | ||
278 | #define readl_relaxed(addr) readl(addr) | ||
279 | |||
280 | #ifndef CONFIG_ISA | ||
281 | #define inb(port) in_8(port) | ||
282 | #define outb(val,port) out_8((port),(val)) | ||
283 | #define inw(port) in_le16(port) | ||
284 | #define outw(val,port) out_le16((port),(val)) | ||
285 | |||
286 | #else | ||
287 | /* | ||
288 | * kernel with both ISA and PCI compiled in, those have | ||
289 | * conflicting defs for in/out. Simply consider port < 1024 | ||
290 | * ISA and everything else PCI. read,write not defined | ||
291 | * in this case | ||
292 | */ | ||
293 | #define inb(port) ((port)<1024 ? isa_inb(port) : in_8(port)) | ||
294 | #define inb_p(port) ((port)<1024 ? isa_inb_p(port) : in_8(port)) | ||
295 | #define inw(port) ((port)<1024 ? isa_inw(port) : in_le16(port)) | ||
296 | #define inw_p(port) ((port)<1024 ? isa_inw_p(port) : in_le16(port)) | ||
297 | #define inl(port) ((port)<1024 ? isa_inl(port) : in_le32(port)) | ||
298 | #define inl_p(port) ((port)<1024 ? isa_inl_p(port) : in_le32(port)) | ||
299 | |||
300 | #define outb(val,port) ((port)<1024 ? isa_outb((val),(port)) : out_8((port),(val))) | ||
301 | #define outb_p(val,port) ((port)<1024 ? isa_outb_p((val),(port)) : out_8((port),(val))) | ||
302 | #define outw(val,port) ((port)<1024 ? isa_outw((val),(port)) : out_le16((port),(val))) | ||
303 | #define outw_p(val,port) ((port)<1024 ? isa_outw_p((val),(port)) : out_le16((port),(val))) | ||
304 | #define outl(val,port) ((port)<1024 ? isa_outl((val),(port)) : out_le32((port),(val))) | ||
305 | #define outl_p(val,port) ((port)<1024 ? isa_outl_p((val),(port)) : out_le32((port),(val))) | ||
306 | #endif | ||
307 | #endif /* CONFIG_PCI */ | ||
308 | |||
309 | #if !defined(CONFIG_ISA) && !defined(CONFIG_PCI) && defined(CONFIG_HP300) | ||
310 | /* | ||
311 | * We need to define dummy functions otherwise drivers/serial/8250.c doesn't link | ||
312 | */ | ||
313 | #define inb(port) 0xff | ||
314 | #define inb_p(port) 0xff | ||
315 | #define outb(val,port) do { } while (0) | ||
316 | #define outb_p(val,port) do { } while (0) | ||
317 | |||
318 | /* | ||
319 | * These should be valid on any ioremap()ed region | ||
320 | */ | ||
321 | #define readb(addr) in_8(addr) | ||
322 | #define writeb(val,addr) out_8((addr),(val)) | ||
323 | #define readl(addr) in_le32(addr) | ||
324 | #define writel(val,addr) out_le32((addr),(val)) | ||
325 | #endif | ||
326 | |||
327 | #define mmiowb() | ||
328 | |||
329 | static inline void *ioremap(unsigned long physaddr, unsigned long size) | ||
330 | { | ||
331 | return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); | ||
332 | } | ||
333 | static inline void *ioremap_nocache(unsigned long physaddr, unsigned long size) | ||
334 | { | ||
335 | return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); | ||
336 | } | ||
337 | static inline void *ioremap_writethrough(unsigned long physaddr, | ||
338 | unsigned long size) | ||
339 | { | ||
340 | return __ioremap(physaddr, size, IOMAP_WRITETHROUGH); | ||
341 | } | ||
342 | static inline void *ioremap_fullcache(unsigned long physaddr, | ||
343 | unsigned long size) | ||
344 | { | ||
345 | return __ioremap(physaddr, size, IOMAP_FULL_CACHING); | ||
346 | } | ||
347 | |||
348 | |||
349 | /* m68k caches aren't DMA coherent */ | ||
350 | extern void dma_cache_wback_inv(unsigned long start, unsigned long size); | ||
351 | extern void dma_cache_wback(unsigned long start, unsigned long size); | ||
352 | extern void dma_cache_inv(unsigned long start, unsigned long size); | ||
353 | |||
354 | |||
355 | #ifndef CONFIG_SUN3 | ||
356 | #define IO_SPACE_LIMIT 0xffff | ||
357 | #else | ||
358 | #define IO_SPACE_LIMIT 0x0fffffff | ||
359 | #endif | ||
360 | |||
361 | #endif /* __KERNEL__ */ | ||
362 | |||
363 | #define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1 | ||
364 | |||
365 | /* | ||
366 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | ||
367 | * access | ||
368 | */ | ||
369 | #define xlate_dev_mem_ptr(p) __va(p) | ||
370 | |||
371 | /* | ||
372 | * Convert a virtual cached pointer to an uncached pointer | ||
373 | */ | ||
374 | #define xlate_dev_kmem_ptr(p) p | ||
375 | |||
376 | #endif /* _IO_H */ | ||
diff --git a/include/asm-m68k/ioctl.h b/include/asm-m68k/ioctl.h new file mode 100644 index 000000000000..fd68914ab292 --- /dev/null +++ b/include/asm-m68k/ioctl.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* $Id: ioctl.h,v 1.3 1997/04/16 15:10:07 jes Exp $ | ||
2 | * | ||
3 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
4 | */ | ||
5 | |||
6 | #ifndef _M68K_IOCTL_H | ||
7 | #define _M68K_IOCTL_H | ||
8 | |||
9 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
10 | * size of the parameter structure in the lower 14 bits of the | ||
11 | * upper 16 bits. | ||
12 | * Encoding the size of the parameter structure in the ioctl request | ||
13 | * is useful for catching programs compiled with old versions | ||
14 | * and to avoid overwriting user space outside the user buffer area. | ||
15 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
16 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
17 | */ | ||
18 | |||
19 | /* | ||
20 | * I don't really have any idea about what this should look like, so | ||
21 | * for the time being, this is heavily based on the PC definitions. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * The following is for compatibility across the various Linux | ||
26 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
27 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
28 | * bits are indeed used as a type field, so we might just as well make | ||
29 | * this explicit here. Please be sure to use the decoding macros | ||
30 | * below from now on. | ||
31 | */ | ||
32 | #define _IOC_NRBITS 8 | ||
33 | #define _IOC_TYPEBITS 8 | ||
34 | #define _IOC_SIZEBITS 14 | ||
35 | #define _IOC_DIRBITS 2 | ||
36 | |||
37 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
38 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
39 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
40 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
41 | |||
42 | #define _IOC_NRSHIFT 0 | ||
43 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
44 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
45 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
46 | |||
47 | /* | ||
48 | * Direction bits. | ||
49 | */ | ||
50 | #define _IOC_NONE 0U | ||
51 | #define _IOC_WRITE 1U | ||
52 | #define _IOC_READ 2U | ||
53 | |||
54 | #define _IOC(dir,type,nr,size) \ | ||
55 | (((dir) << _IOC_DIRSHIFT) | \ | ||
56 | ((type) << _IOC_TYPESHIFT) | \ | ||
57 | ((nr) << _IOC_NRSHIFT) | \ | ||
58 | ((size) << _IOC_SIZESHIFT)) | ||
59 | |||
60 | /* used to create numbers */ | ||
61 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
62 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
63 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
64 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
65 | |||
66 | /* used to decode ioctl numbers.. */ | ||
67 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
68 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
69 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
70 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
71 | |||
72 | /* ...and for the drivers/sound files... */ | ||
73 | |||
74 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
75 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
76 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
77 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
78 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
79 | |||
80 | #endif /* _M68K_IOCTL_H */ | ||
diff --git a/include/asm-m68k/ioctls.h b/include/asm-m68k/ioctls.h new file mode 100644 index 000000000000..0c48929ab444 --- /dev/null +++ b/include/asm-m68k/ioctls.h | |||
@@ -0,0 +1,80 @@ | |||
1 | #ifndef __ARCH_M68K_IOCTLS_H__ | ||
2 | #define __ARCH_M68K_IOCTLS_H__ | ||
3 | |||
4 | #include <asm/ioctl.h> | ||
5 | |||
6 | /* 0x54 is just a magic number to make these relatively unique ('T') */ | ||
7 | |||
8 | #define TCGETS 0x5401 | ||
9 | #define TCSETS 0x5402 | ||
10 | #define TCSETSW 0x5403 | ||
11 | #define TCSETSF 0x5404 | ||
12 | #define TCGETA 0x5405 | ||
13 | #define TCSETA 0x5406 | ||
14 | #define TCSETAW 0x5407 | ||
15 | #define TCSETAF 0x5408 | ||
16 | #define TCSBRK 0x5409 | ||
17 | #define TCXONC 0x540A | ||
18 | #define TCFLSH 0x540B | ||
19 | #define TIOCEXCL 0x540C | ||
20 | #define TIOCNXCL 0x540D | ||
21 | #define TIOCSCTTY 0x540E | ||
22 | #define TIOCGPGRP 0x540F | ||
23 | #define TIOCSPGRP 0x5410 | ||
24 | #define TIOCOUTQ 0x5411 | ||
25 | #define TIOCSTI 0x5412 | ||
26 | #define TIOCGWINSZ 0x5413 | ||
27 | #define TIOCSWINSZ 0x5414 | ||
28 | #define TIOCMGET 0x5415 | ||
29 | #define TIOCMBIS 0x5416 | ||
30 | #define TIOCMBIC 0x5417 | ||
31 | #define TIOCMSET 0x5418 | ||
32 | #define TIOCGSOFTCAR 0x5419 | ||
33 | #define TIOCSSOFTCAR 0x541A | ||
34 | #define FIONREAD 0x541B | ||
35 | #define TIOCINQ FIONREAD | ||
36 | #define TIOCLINUX 0x541C | ||
37 | #define TIOCCONS 0x541D | ||
38 | #define TIOCGSERIAL 0x541E | ||
39 | #define TIOCSSERIAL 0x541F | ||
40 | #define TIOCPKT 0x5420 | ||
41 | #define FIONBIO 0x5421 | ||
42 | #define TIOCNOTTY 0x5422 | ||
43 | #define TIOCSETD 0x5423 | ||
44 | #define TIOCGETD 0x5424 | ||
45 | #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ | ||
46 | #define TIOCSBRK 0x5427 /* BSD compatibility */ | ||
47 | #define TIOCCBRK 0x5428 /* BSD compatibility */ | ||
48 | #define TIOCGSID 0x5429 /* Return the session ID of FD */ | ||
49 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | ||
50 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | ||
51 | |||
52 | #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ | ||
53 | #define FIOCLEX 0x5451 | ||
54 | #define FIOASYNC 0x5452 | ||
55 | #define TIOCSERCONFIG 0x5453 | ||
56 | #define TIOCSERGWILD 0x5454 | ||
57 | #define TIOCSERSWILD 0x5455 | ||
58 | #define TIOCGLCKTRMIOS 0x5456 | ||
59 | #define TIOCSLCKTRMIOS 0x5457 | ||
60 | #define TIOCSERGSTRUCT 0x5458 /* For debugging only */ | ||
61 | #define TIOCSERGETLSR 0x5459 /* Get line status register */ | ||
62 | #define TIOCSERGETMULTI 0x545A /* Get multiport config */ | ||
63 | #define TIOCSERSETMULTI 0x545B /* Set multiport config */ | ||
64 | |||
65 | #define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ | ||
66 | #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ | ||
67 | #define FIOQSIZE 0x545E | ||
68 | |||
69 | /* Used for packet mode */ | ||
70 | #define TIOCPKT_DATA 0 | ||
71 | #define TIOCPKT_FLUSHREAD 1 | ||
72 | #define TIOCPKT_FLUSHWRITE 2 | ||
73 | #define TIOCPKT_STOP 4 | ||
74 | #define TIOCPKT_START 8 | ||
75 | #define TIOCPKT_NOSTOP 16 | ||
76 | #define TIOCPKT_DOSTOP 32 | ||
77 | |||
78 | #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ | ||
79 | |||
80 | #endif /* __ARCH_M68K_IOCTLS_H__ */ | ||
diff --git a/include/asm-m68k/ipc.h b/include/asm-m68k/ipc.h new file mode 100644 index 000000000000..a46e3d9c2a3f --- /dev/null +++ b/include/asm-m68k/ipc.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/ipc.h> | |||
diff --git a/include/asm-m68k/ipcbuf.h b/include/asm-m68k/ipcbuf.h new file mode 100644 index 000000000000..a623ea3f0955 --- /dev/null +++ b/include/asm-m68k/ipcbuf.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef __m68k_IPCBUF_H__ | ||
2 | #define __m68k_IPCBUF_H__ | ||
3 | |||
4 | /* | ||
5 | * The user_ipc_perm structure for m68k architecture. | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 32-bit mode_t and seq | ||
11 | * - 2 miscellaneous 32-bit values | ||
12 | */ | ||
13 | |||
14 | struct ipc64_perm | ||
15 | { | ||
16 | __kernel_key_t key; | ||
17 | __kernel_uid32_t uid; | ||
18 | __kernel_gid32_t gid; | ||
19 | __kernel_uid32_t cuid; | ||
20 | __kernel_gid32_t cgid; | ||
21 | __kernel_mode_t mode; | ||
22 | unsigned short __pad1; | ||
23 | unsigned short seq; | ||
24 | unsigned short __pad2; | ||
25 | unsigned long __unused1; | ||
26 | unsigned long __unused2; | ||
27 | }; | ||
28 | |||
29 | #endif /* __m68k_IPCBUF_H__ */ | ||
diff --git a/include/asm-m68k/irq.h b/include/asm-m68k/irq.h new file mode 100644 index 000000000000..1f569905cb74 --- /dev/null +++ b/include/asm-m68k/irq.h | |||
@@ -0,0 +1,131 @@ | |||
1 | #ifndef _M68K_IRQ_H_ | ||
2 | #define _M68K_IRQ_H_ | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | #include <linux/interrupt.h> | ||
6 | |||
7 | /* | ||
8 | * # of m68k interrupts | ||
9 | */ | ||
10 | |||
11 | #define SYS_IRQS 8 | ||
12 | |||
13 | /* | ||
14 | * This should be the same as the max(NUM_X_SOURCES) for all the | ||
15 | * different m68k hosts compiled into the kernel. | ||
16 | * Currently the Atari has 72 and the Amiga 24, but if both are | ||
17 | * supported in the kernel it is better to make room for 72. | ||
18 | */ | ||
19 | #if defined(CONFIG_ATARI) || defined(CONFIG_MAC) | ||
20 | #define NR_IRQS (72+SYS_IRQS) | ||
21 | #else | ||
22 | #define NR_IRQS (24+SYS_IRQS) | ||
23 | #endif | ||
24 | |||
25 | /* | ||
26 | * Interrupt source definitions | ||
27 | * General interrupt sources are the level 1-7. | ||
28 | * Adding an interrupt service routine for one of these sources | ||
29 | * results in the addition of that routine to a chain of routines. | ||
30 | * Each one is called in succession. Each individual interrupt | ||
31 | * service routine should determine if the device associated with | ||
32 | * that routine requires service. | ||
33 | */ | ||
34 | |||
35 | #define IRQ1 (1) /* level 1 interrupt */ | ||
36 | #define IRQ2 (2) /* level 2 interrupt */ | ||
37 | #define IRQ3 (3) /* level 3 interrupt */ | ||
38 | #define IRQ4 (4) /* level 4 interrupt */ | ||
39 | #define IRQ5 (5) /* level 5 interrupt */ | ||
40 | #define IRQ6 (6) /* level 6 interrupt */ | ||
41 | #define IRQ7 (7) /* level 7 interrupt (non-maskable) */ | ||
42 | |||
43 | /* | ||
44 | * "Generic" interrupt sources | ||
45 | */ | ||
46 | |||
47 | #define IRQ_SCHED_TIMER (8) /* interrupt source for scheduling timer */ | ||
48 | |||
49 | static __inline__ int irq_canonicalize(int irq) | ||
50 | { | ||
51 | return irq; | ||
52 | } | ||
53 | |||
54 | /* | ||
55 | * Machine specific interrupt sources. | ||
56 | * | ||
57 | * Adding an interrupt service routine for a source with this bit | ||
58 | * set indicates a special machine specific interrupt source. | ||
59 | * The machine specific files define these sources. | ||
60 | * | ||
61 | * The IRQ_MACHSPEC bit is now gone - the only thing it did was to | ||
62 | * introduce unnecessary overhead. | ||
63 | * | ||
64 | * All interrupt handling is actually machine specific so it is better | ||
65 | * to use function pointers, as used by the Sparc port, and select the | ||
66 | * interrupt handling functions when initializing the kernel. This way | ||
67 | * we save some unnecessary overhead at run-time. | ||
68 | * 01/11/97 - Jes | ||
69 | */ | ||
70 | |||
71 | extern void (*enable_irq)(unsigned int); | ||
72 | extern void (*disable_irq)(unsigned int); | ||
73 | |||
74 | #define disable_irq_nosync disable_irq | ||
75 | #define enable_irq_nosync enable_irq | ||
76 | |||
77 | struct pt_regs; | ||
78 | |||
79 | extern int cpu_request_irq(unsigned int, | ||
80 | irqreturn_t (*)(int, void *, struct pt_regs *), | ||
81 | unsigned long, const char *, void *); | ||
82 | extern void cpu_free_irq(unsigned int, void *); | ||
83 | |||
84 | /* | ||
85 | * various flags for request_irq() - the Amiga now uses the standard | ||
86 | * mechanism like all other architectures - SA_INTERRUPT and SA_SHIRQ | ||
87 | * are your friends. | ||
88 | */ | ||
89 | #ifndef MACH_AMIGA_ONLY | ||
90 | #define IRQ_FLG_LOCK (0x0001) /* handler is not replaceable */ | ||
91 | #define IRQ_FLG_REPLACE (0x0002) /* replace existing handler */ | ||
92 | #define IRQ_FLG_FAST (0x0004) | ||
93 | #define IRQ_FLG_SLOW (0x0008) | ||
94 | #define IRQ_FLG_STD (0x8000) /* internally used */ | ||
95 | #endif | ||
96 | |||
97 | /* | ||
98 | * This structure is used to chain together the ISRs for a particular | ||
99 | * interrupt source (if it supports chaining). | ||
100 | */ | ||
101 | typedef struct irq_node { | ||
102 | irqreturn_t (*handler)(int, void *, struct pt_regs *); | ||
103 | unsigned long flags; | ||
104 | void *dev_id; | ||
105 | const char *devname; | ||
106 | struct irq_node *next; | ||
107 | } irq_node_t; | ||
108 | |||
109 | /* | ||
110 | * This structure has only 4 elements for speed reasons | ||
111 | */ | ||
112 | typedef struct irq_handler { | ||
113 | irqreturn_t (*handler)(int, void *, struct pt_regs *); | ||
114 | unsigned long flags; | ||
115 | void *dev_id; | ||
116 | const char *devname; | ||
117 | } irq_handler_t; | ||
118 | |||
119 | /* count of spurious interrupts */ | ||
120 | extern volatile unsigned int num_spurious; | ||
121 | |||
122 | /* | ||
123 | * This function returns a new irq_node_t | ||
124 | */ | ||
125 | extern irq_node_t *new_irq_node(void); | ||
126 | |||
127 | struct irqaction; | ||
128 | struct pt_regs; | ||
129 | int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); | ||
130 | |||
131 | #endif /* _M68K_IRQ_H_ */ | ||
diff --git a/include/asm-m68k/kbio.h b/include/asm-m68k/kbio.h new file mode 100644 index 000000000000..e1fbf8fba3e8 --- /dev/null +++ b/include/asm-m68k/kbio.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-sparc/kbio.h> | |||
diff --git a/include/asm-m68k/kmap_types.h b/include/asm-m68k/kmap_types.h new file mode 100644 index 000000000000..c843c63d3801 --- /dev/null +++ b/include/asm-m68k/kmap_types.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef __ASM_M68K_KMAP_TYPES_H | ||
2 | #define __ASM_M68K_KMAP_TYPES_H | ||
3 | |||
4 | enum km_type { | ||
5 | KM_BOUNCE_READ, | ||
6 | KM_SKB_SUNRPC_DATA, | ||
7 | KM_SKB_DATA_SOFTIRQ, | ||
8 | KM_USER0, | ||
9 | KM_USER1, | ||
10 | KM_BIO_SRC_IRQ, | ||
11 | KM_BIO_DST_IRQ, | ||
12 | KM_PTE0, | ||
13 | KM_PTE1, | ||
14 | KM_IRQ0, | ||
15 | KM_IRQ1, | ||
16 | KM_SOFTIRQ0, | ||
17 | KM_SOFTIRQ1, | ||
18 | KM_TYPE_NR | ||
19 | }; | ||
20 | |||
21 | #endif /* __ASM_M68K_KMAP_TYPES_H */ | ||
diff --git a/include/asm-m68k/linkage.h b/include/asm-m68k/linkage.h new file mode 100644 index 000000000000..5a822bb790f7 --- /dev/null +++ b/include/asm-m68k/linkage.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __ASM_LINKAGE_H | ||
2 | #define __ASM_LINKAGE_H | ||
3 | |||
4 | #define __ALIGN .align 4 | ||
5 | #define __ALIGN_STR ".align 4" | ||
6 | |||
7 | #endif | ||
diff --git a/include/asm-m68k/local.h b/include/asm-m68k/local.h new file mode 100644 index 000000000000..6c259263e1f0 --- /dev/null +++ b/include/asm-m68k/local.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_M68K_LOCAL_H | ||
2 | #define _ASM_M68K_LOCAL_H | ||
3 | |||
4 | #include <asm-generic/local.h> | ||
5 | |||
6 | #endif /* _ASM_M68K_LOCAL_H */ | ||
diff --git a/include/asm-m68k/mac_asc.h b/include/asm-m68k/mac_asc.h new file mode 100644 index 000000000000..fc2e5467b41e --- /dev/null +++ b/include/asm-m68k/mac_asc.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * Apple Sound Chip | ||
3 | */ | ||
4 | |||
5 | #ifndef __ASM_MAC_ASC_H | ||
6 | #define __ASM_MAC_ASC_H | ||
7 | |||
8 | /* | ||
9 | * ASC offsets and controls | ||
10 | */ | ||
11 | |||
12 | #define ASC_BUF_BASE 0x00 /* RAM buffer offset */ | ||
13 | #define ASC_BUF_SIZE 0x800 | ||
14 | |||
15 | #define ASC_CONTROL 0x800 | ||
16 | #define ASC_CONTROL_OFF 0x00 | ||
17 | #define ASC_FREQ(chan,byte) ((0x810)+((chan)<<3)+(byte)) | ||
18 | #define ASC_ENABLE 0x801 | ||
19 | #define ASC_ENABLE_SAMPLE 0x02 | ||
20 | #define ASC_MODE 0x802 | ||
21 | #define ASC_MODE_SAMPLE 0x02 | ||
22 | |||
23 | #define ASC_VOLUME 0x806 | ||
24 | #define ASC_CHAN 0x807 /* ??? */ | ||
25 | |||
26 | |||
27 | #endif | ||
diff --git a/include/asm-m68k/mac_baboon.h b/include/asm-m68k/mac_baboon.h new file mode 100644 index 000000000000..e87850830be8 --- /dev/null +++ b/include/asm-m68k/mac_baboon.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Definitions for the "Baboon" custom IC on the PowerBook 190. | ||
3 | */ | ||
4 | |||
5 | #define BABOON_BASE (0x50F1A000) /* same as IDE controller base */ | ||
6 | |||
7 | #ifndef __ASSEMBLY__ | ||
8 | |||
9 | struct baboon { | ||
10 | char pad1[208]; /* generic IDE registers, not used here */ | ||
11 | short mb_control; /* Control register: | ||
12 | * bit 5 : slot 2 power control | ||
13 | * bit 6 : slot 1 power control | ||
14 | */ | ||
15 | char pad2[2]; | ||
16 | short mb_status; /* (0xD4) media bay status register: | ||
17 | * | ||
18 | * bit 0: ???? | ||
19 | * bit 1: IDE interrupt active? | ||
20 | * bit 2: bay status, 0 = full, 1 = empty | ||
21 | * bit 3: ???? | ||
22 | */ | ||
23 | char pad3[2]; /* (0xD6) not used */ | ||
24 | short mb_ifr; /* (0xD8) media bay interrupt flags register: | ||
25 | * | ||
26 | * bit 0: ???? | ||
27 | * bit 1: IDE controller interrupt | ||
28 | * bit 2: media bay status change interrupt | ||
29 | */ | ||
30 | }; | ||
31 | |||
32 | extern volatile struct baboon *baboon; | ||
33 | |||
34 | #endif /* __ASSEMBLY **/ | ||
diff --git a/include/asm-m68k/mac_iop.h b/include/asm-m68k/mac_iop.h new file mode 100644 index 000000000000..b0d2e3473537 --- /dev/null +++ b/include/asm-m68k/mac_iop.h | |||
@@ -0,0 +1,162 @@ | |||
1 | /* | ||
2 | * I/O Processor (IOP) defines and structures, mostly snagged from A/UX | ||
3 | * header files. | ||
4 | * | ||
5 | * The original header from which this was taken is copyrighted. I've done some | ||
6 | * rewriting (in fact my changes make this a bit more readable, IMHO) but some | ||
7 | * more should be done. | ||
8 | */ | ||
9 | |||
10 | /* | ||
11 | * This is the base address of the IOPs. Use this as the address of | ||
12 | * a "struct iop" (see below) to see where the actual registers fall. | ||
13 | */ | ||
14 | |||
15 | #define SCC_IOP_BASE_IIFX (0x50F04000) | ||
16 | #define ISM_IOP_BASE_IIFX (0x50F12000) | ||
17 | |||
18 | #define SCC_IOP_BASE_QUADRA (0x50F0C000) | ||
19 | #define ISM_IOP_BASE_QUADRA (0x50F1E000) | ||
20 | |||
21 | /* IOP status/control register bits: */ | ||
22 | |||
23 | #define IOP_BYPASS 0x01 /* bypass-mode hardware access */ | ||
24 | #define IOP_AUTOINC 0x02 /* allow autoincrement of ramhi/lo */ | ||
25 | #define IOP_RUN 0x04 /* set to 0 to reset IOP chip */ | ||
26 | #define IOP_IRQ 0x08 /* generate IRQ to IOP if 1 */ | ||
27 | #define IOP_INT0 0x10 /* intr priority from IOP to host */ | ||
28 | #define IOP_INT1 0x20 /* intr priority from IOP to host */ | ||
29 | #define IOP_HWINT 0x40 /* IRQ from hardware; bypass mode only */ | ||
30 | #define IOP_DMAINACTIVE 0x80 /* no DMA request active; bypass mode only */ | ||
31 | |||
32 | #define NUM_IOPS 2 | ||
33 | #define NUM_IOP_CHAN 7 | ||
34 | #define NUM_IOP_MSGS NUM_IOP_CHAN*8 | ||
35 | #define IOP_MSG_LEN 32 | ||
36 | |||
37 | /* IOP reference numbers, used by the globally-visible iop_xxx functions */ | ||
38 | |||
39 | #define IOP_NUM_SCC 0 | ||
40 | #define IOP_NUM_ISM 1 | ||
41 | |||
42 | /* IOP channel states */ | ||
43 | |||
44 | #define IOP_MSG_IDLE 0 /* idle */ | ||
45 | #define IOP_MSG_NEW 1 /* new message sent */ | ||
46 | #define IOP_MSG_RCVD 2 /* message received; processing */ | ||
47 | #define IOP_MSG_COMPLETE 3 /* message processing complete */ | ||
48 | |||
49 | /* IOP message status codes */ | ||
50 | |||
51 | #define IOP_MSGSTATUS_UNUSED 0 /* Unusued message structure */ | ||
52 | #define IOP_MSGSTATUS_WAITING 1 /* waiting for channel */ | ||
53 | #define IOP_MSGSTATUS_SENT 2 /* message sent, awaiting reply */ | ||
54 | #define IOP_MSGSTATUS_COMPLETE 3 /* message complete and reply rcvd */ | ||
55 | #define IOP_MSGSTATUS_UNSOL 6 /* message is unsolicited */ | ||
56 | |||
57 | /* IOP memory addresses of the members of the mac_iop_kernel structure. */ | ||
58 | |||
59 | #define IOP_ADDR_MAX_SEND_CHAN 0x0200 | ||
60 | #define IOP_ADDR_SEND_STATE 0x0201 | ||
61 | #define IOP_ADDR_PATCH_CTRL 0x021F | ||
62 | #define IOP_ADDR_SEND_MSG 0x0220 | ||
63 | #define IOP_ADDR_MAX_RECV_CHAN 0x0300 | ||
64 | #define IOP_ADDR_RECV_STATE 0x0301 | ||
65 | #define IOP_ADDR_ALIVE 0x031F | ||
66 | #define IOP_ADDR_RECV_MSG 0x0320 | ||
67 | |||
68 | #ifndef __ASSEMBLY__ | ||
69 | |||
70 | /* | ||
71 | * IOP Control registers, staggered because in usual Apple style they were | ||
72 | * too lazy to decode the A0 bit. This structure is assumed to begin at | ||
73 | * one of the xxx_IOP_BASE addresses given above. | ||
74 | */ | ||
75 | |||
76 | struct mac_iop { | ||
77 | __u8 ram_addr_hi; /* shared RAM address hi byte */ | ||
78 | __u8 pad0; | ||
79 | __u8 ram_addr_lo; /* shared RAM address lo byte */ | ||
80 | __u8 pad1; | ||
81 | __u8 status_ctrl; /* status/control register */ | ||
82 | __u8 pad2[3]; | ||
83 | __u8 ram_data; /* RAM data byte at ramhi/lo */ | ||
84 | |||
85 | __u8 pad3[23]; | ||
86 | |||
87 | /* Bypass-mode hardware access registers */ | ||
88 | |||
89 | union { | ||
90 | struct { /* SCC registers */ | ||
91 | __u8 sccb_cmd; /* SCC B command reg */ | ||
92 | __u8 pad4; | ||
93 | __u8 scca_cmd; /* SCC A command reg */ | ||
94 | __u8 pad5; | ||
95 | __u8 sccb_data; /* SCC B data */ | ||
96 | __u8 pad6; | ||
97 | __u8 scca_data; /* SCC A data */ | ||
98 | } scc_regs; | ||
99 | |||
100 | struct { /* ISM registers */ | ||
101 | __u8 wdata; /* write a data byte */ | ||
102 | __u8 pad7; | ||
103 | __u8 wmark; /* write a mark byte */ | ||
104 | __u8 pad8; | ||
105 | __u8 wcrc; /* write 2-byte crc to disk */ | ||
106 | __u8 pad9; | ||
107 | __u8 wparams; /* write the param regs */ | ||
108 | __u8 pad10; | ||
109 | __u8 wphase; /* write the phase states & dirs */ | ||
110 | __u8 pad11; | ||
111 | __u8 wsetup; /* write the setup register */ | ||
112 | __u8 pad12; | ||
113 | __u8 wzeroes; /* mode reg: 1's clr bits, 0's are x */ | ||
114 | __u8 pad13; | ||
115 | __u8 wones; /* mode reg: 1's set bits, 0's are x */ | ||
116 | __u8 pad14; | ||
117 | __u8 rdata; /* read a data byte */ | ||
118 | __u8 pad15; | ||
119 | __u8 rmark; /* read a mark byte */ | ||
120 | __u8 pad16; | ||
121 | __u8 rerror; /* read the error register */ | ||
122 | __u8 pad17; | ||
123 | __u8 rparams; /* read the param regs */ | ||
124 | __u8 pad18; | ||
125 | __u8 rphase; /* read the phase states & dirs */ | ||
126 | __u8 pad19; | ||
127 | __u8 rsetup; /* read the setup register */ | ||
128 | __u8 pad20; | ||
129 | __u8 rmode; /* read the mode register */ | ||
130 | __u8 pad21; | ||
131 | __u8 rhandshake; /* read the handshake register */ | ||
132 | } ism_regs; | ||
133 | } b; | ||
134 | }; | ||
135 | |||
136 | /* This structure is used to track IOP messages in the Linux kernel */ | ||
137 | |||
138 | struct iop_msg { | ||
139 | struct iop_msg *next; /* next message in queue or NULL */ | ||
140 | uint iop_num; /* IOP number */ | ||
141 | uint channel; /* channel number */ | ||
142 | void *caller_priv; /* caller private data */ | ||
143 | int status; /* status of this message */ | ||
144 | __u8 message[IOP_MSG_LEN]; /* the message being sent/received */ | ||
145 | __u8 reply[IOP_MSG_LEN]; /* the reply to the message */ | ||
146 | void (*handler)(struct iop_msg *, struct pt_regs *); | ||
147 | /* function to call when reply recvd */ | ||
148 | }; | ||
149 | |||
150 | extern int iop_scc_present,iop_ism_present; | ||
151 | |||
152 | extern int iop_listen(uint, uint, | ||
153 | void (*handler)(struct iop_msg *, struct pt_regs *), | ||
154 | const char *); | ||
155 | extern int iop_send_message(uint, uint, void *, uint, __u8 *, | ||
156 | void (*)(struct iop_msg *, struct pt_regs *)); | ||
157 | extern void iop_complete_message(struct iop_msg *); | ||
158 | extern void iop_upload_code(uint, __u8 *, uint, __u16); | ||
159 | extern void iop_download_code(uint, __u8 *, uint, __u16); | ||
160 | extern __u8 *iop_compare_code(uint, __u8 *, uint, __u16); | ||
161 | |||
162 | #endif /* __ASSEMBLY__ */ | ||
diff --git a/include/asm-m68k/mac_mouse.h b/include/asm-m68k/mac_mouse.h new file mode 100644 index 000000000000..39a5c292eaee --- /dev/null +++ b/include/asm-m68k/mac_mouse.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef _ASM_MAC_MOUSE_H | ||
2 | #define _ASM_MAC_MOUSE_H | ||
3 | |||
4 | /* | ||
5 | * linux/include/asm-m68k/mac_mouse.h | ||
6 | * header file for Macintosh ADB mouse driver | ||
7 | * 27-10-97 Michael Schmitz | ||
8 | * copied from: | ||
9 | * header file for Atari Mouse driver | ||
10 | * by Robert de Vries (robert@and.nl) on 19Jul93 | ||
11 | */ | ||
12 | |||
13 | struct mouse_status { | ||
14 | char buttons; | ||
15 | short dx; | ||
16 | short dy; | ||
17 | int ready; | ||
18 | int active; | ||
19 | wait_queue_head_t wait; | ||
20 | struct fasync_struct *fasyncptr; | ||
21 | }; | ||
22 | |||
23 | #endif | ||
diff --git a/include/asm-m68k/mac_oss.h b/include/asm-m68k/mac_oss.h new file mode 100644 index 000000000000..7644a639cd6c --- /dev/null +++ b/include/asm-m68k/mac_oss.h | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | * OSS | ||
3 | * | ||
4 | * This is used in place of VIA2 on the IIfx. | ||
5 | */ | ||
6 | |||
7 | #define OSS_BASE (0x50f1a000) | ||
8 | |||
9 | /* | ||
10 | * Interrupt level offsets for mac_oss->irq_level | ||
11 | */ | ||
12 | |||
13 | #define OSS_NUBUS0 0 | ||
14 | #define OSS_NUBUS1 1 | ||
15 | #define OSS_NUBUS2 2 | ||
16 | #define OSS_NUBUS3 3 | ||
17 | #define OSS_NUBUS4 4 | ||
18 | #define OSS_NUBUS5 5 | ||
19 | #define OSS_IOPISM 6 | ||
20 | #define OSS_IOPSCC 7 | ||
21 | #define OSS_SOUND 8 | ||
22 | #define OSS_SCSI 9 | ||
23 | #define OSS_60HZ 10 | ||
24 | #define OSS_VIA1 11 | ||
25 | #define OSS_UNUSED1 12 | ||
26 | #define OSS_UNUSED2 13 | ||
27 | #define OSS_PARITY 14 | ||
28 | #define OSS_UNUSED3 15 | ||
29 | |||
30 | #define OSS_NUM_SOURCES 16 | ||
31 | |||
32 | /* | ||
33 | * Pending interrupt bits in mac_oss->irq_pending | ||
34 | */ | ||
35 | |||
36 | #define OSS_IP_NUBUS0 0x0001 | ||
37 | #define OSS_IP_NUBUS1 0x0002 | ||
38 | #define OSS_IP_NUBUS2 0x0004 | ||
39 | #define OSS_IP_NUBUS3 0x0008 | ||
40 | #define OSS_IP_NUBUS4 0x0010 | ||
41 | #define OSS_IP_NUBUS5 0x0020 | ||
42 | #define OSS_IP_IOPISM 0x0040 | ||
43 | #define OSS_IP_IOPSCC 0x0080 | ||
44 | #define OSS_IP_SOUND 0x0100 | ||
45 | #define OSS_IP_SCSI 0x0200 | ||
46 | #define OSS_IP_60HZ 0x0400 | ||
47 | #define OSS_IP_VIA1 0x0800 | ||
48 | #define OSS_IP_UNUSED1 0x1000 | ||
49 | #define OSS_IP_UNUSED2 0x2000 | ||
50 | #define OSS_IP_PARITY 0x4000 | ||
51 | #define OSS_IP_UNUSED3 0x8000 | ||
52 | |||
53 | #define OSS_IP_NUBUS (OSS_IP_NUBUS0|OSS_IP_NUBUS1|OSS_IP_NUBUS2|OSS_IP_NUBUS3|OSS_IP_NUBUS4|OSS_IP_NUBUS5) | ||
54 | |||
55 | /* | ||
56 | * Rom Control Register | ||
57 | */ | ||
58 | |||
59 | #define OSS_POWEROFF 0x80 | ||
60 | |||
61 | /* | ||
62 | * OSS Interrupt levels for various sub-systems | ||
63 | * | ||
64 | * This mapping is layed out with two things in mind: first, we try to keep | ||
65 | * things on their own levels to avoid having to do double-dispatches. Second, | ||
66 | * the levels match as closely as possible the alternate IRQ mapping mode (aka | ||
67 | * "A/UX mode") available on some VIA machines. | ||
68 | */ | ||
69 | |||
70 | #define OSS_IRQLEV_DISABLED 0 | ||
71 | #define OSS_IRQLEV_IOPISM 1 /* ADB? */ | ||
72 | #define OSS_IRQLEV_SCSI 2 | ||
73 | #define OSS_IRQLEV_NUBUS 3 /* keep this on its own level */ | ||
74 | #define OSS_IRQLEV_IOPSCC 4 /* matches VIA alternate mapping */ | ||
75 | #define OSS_IRQLEV_SOUND 5 /* matches VIA alternate mapping */ | ||
76 | #define OSS_IRQLEV_60HZ 6 /* matches VIA alternate mapping */ | ||
77 | #define OSS_IRQLEV_VIA1 6 /* matches VIA alternate mapping */ | ||
78 | #define OSS_IRQLEV_PARITY 7 /* matches VIA alternate mapping */ | ||
79 | |||
80 | #ifndef __ASSEMBLY__ | ||
81 | |||
82 | struct mac_oss { | ||
83 | __u8 irq_level[0x10]; /* [0x000-0x00f] Interrupt levels */ | ||
84 | __u8 padding0[0x1F2]; /* [0x010-0x201] IO space filler */ | ||
85 | __u16 irq_pending; /* [0x202-0x203] pending interrupts bits */ | ||
86 | __u8 rom_ctrl; /* [0x204-0x204] ROM cntl reg (for poweroff) */ | ||
87 | __u8 padding1[0x2]; /* [0x205-0x206] currently unused by A/UX */ | ||
88 | __u8 ack_60hz; /* [0x207-0x207] 60 Hz ack. */ | ||
89 | }; | ||
90 | |||
91 | extern volatile struct mac_oss *oss; | ||
92 | extern int oss_present; | ||
93 | |||
94 | #endif /* __ASSEMBLY__ */ | ||
diff --git a/include/asm-m68k/mac_psc.h b/include/asm-m68k/mac_psc.h new file mode 100644 index 000000000000..7808bb0b2323 --- /dev/null +++ b/include/asm-m68k/mac_psc.h | |||
@@ -0,0 +1,248 @@ | |||
1 | /* | ||
2 | * Apple Peripheral System Controller (PSC) | ||
3 | * | ||
4 | * The PSC is used on the AV Macs to control IO functions not handled | ||
5 | * by the VIAs (Ethernet, DSP, SCC, Sound). This includes nine DMA | ||
6 | * channels. | ||
7 | * | ||
8 | * The first seven DMA channels appear to be "one-shot" and are actually | ||
9 | * sets of two channels; one member is active while the other is being | ||
10 | * configured, and then you flip the active member and start all over again. | ||
11 | * The one-shot channels are grouped together and are: | ||
12 | * | ||
13 | * 1. SCSI | ||
14 | * 2. Ethernet Read | ||
15 | * 3. Ethernet Write | ||
16 | * 4. Floppy Disk Controller | ||
17 | * 5. SCC Channel A Receive | ||
18 | * 6. SCC Channel B Receive | ||
19 | * 7. SCC Channel A Transmit | ||
20 | * | ||
21 | * The remaining two channels are handled somewhat differently. They appear | ||
22 | * to be closely tied and share one set of registers. They also seem to run | ||
23 | * continuously, although how you keep the buffer filled in this scenario is | ||
24 | * not understood as there seems to be only one input and one output buffer | ||
25 | * pointer. | ||
26 | * | ||
27 | * Much of this was extrapolated from what was known about the Ethernet | ||
28 | * registers and subsequently confirmed using MacsBug (ie by pinging the | ||
29 | * machine with easy-to-find patterns and looking for them in the DMA | ||
30 | * buffers, or by sending a file over the serial ports and finding the | ||
31 | * file in the buffers.) | ||
32 | * | ||
33 | * 1999-05-25 (jmt) | ||
34 | */ | ||
35 | |||
36 | #define PSC_BASE (0x50F31000) | ||
37 | |||
38 | /* | ||
39 | * The IER/IFR registers work like the VIA, except that it has 4 | ||
40 | * of them each on different interrupt levels, and each register | ||
41 | * set only seems to handle four interrupts instead of seven. | ||
42 | * | ||
43 | * To access a particular set of registers, add 0xn0 to the base | ||
44 | * where n = 3,4,5 or 6. | ||
45 | */ | ||
46 | |||
47 | #define pIFRbase 0x100 | ||
48 | #define pIERbase 0x104 | ||
49 | |||
50 | /* | ||
51 | * One-shot DMA control registers | ||
52 | */ | ||
53 | |||
54 | #define PSC_MYSTERY 0x804 | ||
55 | |||
56 | #define PSC_CTL_BASE 0xC00 | ||
57 | |||
58 | #define PSC_SCSI_CTL 0xC00 | ||
59 | #define PSC_ENETRD_CTL 0xC10 | ||
60 | #define PSC_ENETWR_CTL 0xC20 | ||
61 | #define PSC_FDC_CTL 0xC30 | ||
62 | #define PSC_SCCA_CTL 0xC40 | ||
63 | #define PSC_SCCB_CTL 0xC50 | ||
64 | #define PSC_SCCATX_CTL 0xC60 | ||
65 | |||
66 | /* | ||
67 | * DMA channels. Add +0x10 for the second channel in the set. | ||
68 | * You're supposed to use one channel while the other runs and | ||
69 | * then flip channels and do the whole thing again. | ||
70 | */ | ||
71 | |||
72 | #define PSC_ADDR_BASE 0x1000 | ||
73 | #define PSC_LEN_BASE 0x1004 | ||
74 | #define PSC_CMD_BASE 0x1008 | ||
75 | |||
76 | #define PSC_SET0 0x00 | ||
77 | #define PSC_SET1 0x10 | ||
78 | |||
79 | #define PSC_SCSI_ADDR 0x1000 /* confirmed */ | ||
80 | #define PSC_SCSI_LEN 0x1004 /* confirmed */ | ||
81 | #define PSC_SCSI_CMD 0x1008 /* confirmed */ | ||
82 | #define PSC_ENETRD_ADDR 0x1020 /* confirmed */ | ||
83 | #define PSC_ENETRD_LEN 0x1024 /* confirmed */ | ||
84 | #define PSC_ENETRD_CMD 0x1028 /* confirmed */ | ||
85 | #define PSC_ENETWR_ADDR 0x1040 /* confirmed */ | ||
86 | #define PSC_ENETWR_LEN 0x1044 /* confirmed */ | ||
87 | #define PSC_ENETWR_CMD 0x1048 /* confirmed */ | ||
88 | #define PSC_FDC_ADDR 0x1060 /* strongly suspected */ | ||
89 | #define PSC_FDC_LEN 0x1064 /* strongly suspected */ | ||
90 | #define PSC_FDC_CMD 0x1068 /* strongly suspected */ | ||
91 | #define PSC_SCCA_ADDR 0x1080 /* confirmed */ | ||
92 | #define PSC_SCCA_LEN 0x1084 /* confirmed */ | ||
93 | #define PSC_SCCA_CMD 0x1088 /* confirmed */ | ||
94 | #define PSC_SCCB_ADDR 0x10A0 /* confirmed */ | ||
95 | #define PSC_SCCB_LEN 0x10A4 /* confirmed */ | ||
96 | #define PSC_SCCB_CMD 0x10A8 /* confirmed */ | ||
97 | #define PSC_SCCATX_ADDR 0x10C0 /* confirmed */ | ||
98 | #define PSC_SCCATX_LEN 0x10C4 /* confirmed */ | ||
99 | #define PSC_SCCATX_CMD 0x10C8 /* confirmed */ | ||
100 | |||
101 | /* | ||
102 | * Free-running DMA registers. The only part known for sure are the bits in | ||
103 | * the control register, the buffer addresses and the buffer length. Everything | ||
104 | * else is anybody's guess. | ||
105 | * | ||
106 | * These registers seem to be mirrored every thirty-two bytes up until offset | ||
107 | * 0x300. It's safe to assume then that a new set of registers starts there. | ||
108 | */ | ||
109 | |||
110 | #define PSC_SND_CTL 0x200 /* | ||
111 | * [ 16-bit ] | ||
112 | * Sound (Singer?) control register. | ||
113 | * | ||
114 | * bit 0 : ???? | ||
115 | * bit 1 : ???? | ||
116 | * bit 2 : Set to one to enable sound | ||
117 | * output. Possibly a mute flag. | ||
118 | * bit 3 : ???? | ||
119 | * bit 4 : ???? | ||
120 | * bit 5 : ???? | ||
121 | * bit 6 : Set to one to enable pass-thru | ||
122 | * audio. In this mode the audio data | ||
123 | * seems to appear in both the input | ||
124 | * buffer and the output buffer. | ||
125 | * bit 7 : Set to one to activate the | ||
126 | * sound input DMA or zero to | ||
127 | * disable it. | ||
128 | * bit 8 : Set to one to activate the | ||
129 | * sound output DMA or zero to | ||
130 | * disable it. | ||
131 | * bit 9 : \ | ||
132 | * bit 11 : | | ||
133 | * These two bits control the sample | ||
134 | * rate. Usually set to binary 10 and | ||
135 | * MacOS 8.0 says I'm at 48 KHz. Using | ||
136 | * a binary value of 01 makes things | ||
137 | * sound about 1/2 speed (24 KHz?) and | ||
138 | * binary 00 is slower still (22 KHz?) | ||
139 | * | ||
140 | * Setting this to 0x0000 is a good way to | ||
141 | * kill all DMA at boot time so that the | ||
142 | * PSC won't overwrite the kernel image | ||
143 | * with sound data. | ||
144 | */ | ||
145 | |||
146 | /* | ||
147 | * 0x0202 - 0x0203 is unused. Writing there | ||
148 | * seems to clobber the control register. | ||
149 | */ | ||
150 | |||
151 | #define PSC_SND_SOURCE 0x204 /* | ||
152 | * [ 32-bit ] | ||
153 | * Controls input source and volume: | ||
154 | * | ||
155 | * bits 12-15 : input source volume, 0 - F | ||
156 | * bits 16-19 : unknown, always 0x5 | ||
157 | * bits 20-23 : input source selection: | ||
158 | * 0x3 = CD Audio | ||
159 | * 0x4 = External Audio | ||
160 | * | ||
161 | * The volume is definitely not the general | ||
162 | * output volume as it doesn't affect the | ||
163 | * alert sound volume. | ||
164 | */ | ||
165 | #define PSC_SND_STATUS1 0x208 /* | ||
166 | * [ 32-bit ] | ||
167 | * Appears to be a read-only status register. | ||
168 | * The usual value is 0x00400002. | ||
169 | */ | ||
170 | #define PSC_SND_HUH3 0x20C /* | ||
171 | * [ 16-bit ] | ||
172 | * Unknown 16-bit value, always 0x0000. | ||
173 | */ | ||
174 | #define PSC_SND_BITS2GO 0x20E /* | ||
175 | * [ 16-bit ] | ||
176 | * Counts down to zero from some constant | ||
177 | * value. The value appears to be the | ||
178 | * number of _bits_ remaining before the | ||
179 | * buffer is full, which would make sense | ||
180 | * since Apple's docs say the sound DMA | ||
181 | * channels are 1 bit wide. | ||
182 | */ | ||
183 | #define PSC_SND_INADDR 0x210 /* | ||
184 | * [ 32-bit ] | ||
185 | * Address of the sound input DMA buffer | ||
186 | */ | ||
187 | #define PSC_SND_OUTADDR 0x214 /* | ||
188 | * [ 32-bit ] | ||
189 | * Address of the sound output DMA buffer | ||
190 | */ | ||
191 | #define PSC_SND_LEN 0x218 /* | ||
192 | * [ 16-bit ] | ||
193 | * Length of both buffers in eight-byte units. | ||
194 | */ | ||
195 | #define PSC_SND_HUH4 0x21A /* | ||
196 | * [ 16-bit ] | ||
197 | * Unknown, always 0x0000. | ||
198 | */ | ||
199 | #define PSC_SND_STATUS2 0x21C /* | ||
200 | * [ 16-bit ] | ||
201 | * Appears to e a read-only status register. | ||
202 | * The usual value is 0x0200. | ||
203 | */ | ||
204 | #define PSC_SND_HUH5 0x21E /* | ||
205 | * [ 16-bit ] | ||
206 | * Unknown, always 0x0000. | ||
207 | */ | ||
208 | |||
209 | #ifndef __ASSEMBLY__ | ||
210 | |||
211 | extern volatile __u8 *psc; | ||
212 | extern int psc_present; | ||
213 | |||
214 | /* | ||
215 | * Access functions | ||
216 | */ | ||
217 | |||
218 | static inline void psc_write_byte(int offset, __u8 data) | ||
219 | { | ||
220 | *((volatile __u8 *)(psc + offset)) = data; | ||
221 | } | ||
222 | |||
223 | static inline void psc_write_word(int offset, __u16 data) | ||
224 | { | ||
225 | *((volatile __u16 *)(psc + offset)) = data; | ||
226 | } | ||
227 | |||
228 | static inline void psc_write_long(int offset, __u32 data) | ||
229 | { | ||
230 | *((volatile __u32 *)(psc + offset)) = data; | ||
231 | } | ||
232 | |||
233 | static inline u8 psc_read_byte(int offset) | ||
234 | { | ||
235 | return *((volatile __u8 *)(psc + offset)); | ||
236 | } | ||
237 | |||
238 | static inline u16 psc_read_word(int offset) | ||
239 | { | ||
240 | return *((volatile __u16 *)(psc + offset)); | ||
241 | } | ||
242 | |||
243 | static inline u32 psc_read_long(int offset) | ||
244 | { | ||
245 | return *((volatile __u32 *)(psc + offset)); | ||
246 | } | ||
247 | |||
248 | #endif /* __ASSEMBLY__ */ | ||
diff --git a/include/asm-m68k/mac_via.h b/include/asm-m68k/mac_via.h new file mode 100644 index 000000000000..59b758cd16ad --- /dev/null +++ b/include/asm-m68k/mac_via.h | |||
@@ -0,0 +1,268 @@ | |||
1 | /* | ||
2 | * 6522 Versatile Interface Adapter (VIA) | ||
3 | * | ||
4 | * There are two of these on the Mac II. Some IRQ's are vectored | ||
5 | * via them as are assorted bits and bobs - eg rtc, adb. The picture | ||
6 | * is a bit incomplete as the Mac documentation doesn't cover this well | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MAC_VIA_H_ | ||
10 | #define _ASM_MAC_VIA_H_ | ||
11 | |||
12 | /* | ||
13 | * Base addresses for the VIAs. There are two in every machine, | ||
14 | * although on some machines the second is an RBV or an OSS. | ||
15 | * The OSS is different enough that it's handled separately. | ||
16 | * | ||
17 | * Do not use these values directly; use the via1 and via2 variables | ||
18 | * instead (and don't forget to check rbv_present when using via2!) | ||
19 | */ | ||
20 | |||
21 | #define VIA1_BASE (0x50F00000) | ||
22 | #define VIA2_BASE (0x50F02000) | ||
23 | #define RBV_BASE (0x50F26000) | ||
24 | |||
25 | /* | ||
26 | * Not all of these are true post MacII I think. | ||
27 | * CSA: probably the ones CHRP marks as 'unused' change purposes | ||
28 | * when the IWM becomes the SWIM. | ||
29 | * http://www.rs6000.ibm.com/resource/technology/chrpio/via5.mak.html | ||
30 | * ftp://ftp.austin.ibm.com/pub/technology/spec/chrp/inwork/CHRP_IORef_1.0.pdf | ||
31 | * | ||
32 | * also, http://developer.apple.com/technotes/hw/hw_09.html claims the | ||
33 | * following changes for IIfx: | ||
34 | * VIA1A_vSccWrReq not available and that VIA1A_vSync has moved to an IOP. | ||
35 | * Also, "All of the functionality of VIA2 has been moved to other chips". | ||
36 | */ | ||
37 | |||
38 | #define VIA1A_vSccWrReq 0x80 /* SCC write. (input) | ||
39 | * [CHRP] SCC WREQ: Reflects the state of the | ||
40 | * Wait/Request pins from the SCC. | ||
41 | * [Macintosh Family Hardware] | ||
42 | * as CHRP on SE/30,II,IIx,IIcx,IIci. | ||
43 | * on IIfx, "0 means an active request" | ||
44 | */ | ||
45 | #define VIA1A_vRev8 0x40 /* Revision 8 board ??? | ||
46 | * [CHRP] En WaitReqB: Lets the WaitReq_L | ||
47 | * signal from port B of the SCC appear on | ||
48 | * the PA7 input pin. Output. | ||
49 | * [Macintosh Family] On the SE/30, this | ||
50 | * is the bit to flip screen buffers. | ||
51 | * 0=alternate, 1=main. | ||
52 | * on II,IIx,IIcx,IIci,IIfx this is a bit | ||
53 | * for Rev ID. 0=II,IIx, 1=IIcx,IIci,IIfx | ||
54 | */ | ||
55 | #define VIA1A_vHeadSel 0x20 /* Head select for IWM. | ||
56 | * [CHRP] unused. | ||
57 | * [Macintosh Family] "Floppy disk | ||
58 | * state-control line SEL" on all but IIfx | ||
59 | */ | ||
60 | #define VIA1A_vOverlay 0x10 /* [Macintosh Family] On SE/30,II,IIx,IIcx | ||
61 | * this bit enables the "Overlay" address | ||
62 | * map in the address decoders as it is on | ||
63 | * reset for mapping the ROM over the reset | ||
64 | * vector. 1=use overlay map. | ||
65 | * On the IIci,IIfx it is another bit of the | ||
66 | * CPU ID: 0=normal IIci, 1=IIci with parity | ||
67 | * feature or IIfx. | ||
68 | * [CHRP] En WaitReqA: Lets the WaitReq_L | ||
69 | * signal from port A of the SCC appear | ||
70 | * on the PA7 input pin (CHRP). Output. | ||
71 | * [MkLinux] "Drive Select" | ||
72 | * (with 0x20 being 'disk head select') | ||
73 | */ | ||
74 | #define VIA1A_vSync 0x08 /* [CHRP] Sync Modem: modem clock select: | ||
75 | * 1: select the external serial clock to | ||
76 | * drive the SCC's /RTxCA pin. | ||
77 | * 0: Select the 3.6864MHz clock to drive | ||
78 | * the SCC cell. | ||
79 | * [Macintosh Family] Correct on all but IIfx | ||
80 | */ | ||
81 | |||
82 | /* Macintosh Family Hardware sez: bits 0-2 of VIA1A are volume control | ||
83 | * on Macs which had the PWM sound hardware. Reserved on newer models. | ||
84 | * On IIci,IIfx, bits 1-2 are the rest of the CPU ID: | ||
85 | * bit 2: 1=IIci, 0=IIfx | ||
86 | * bit 1: 1 on both IIci and IIfx. | ||
87 | * MkLinux sez bit 0 is 'burnin flag' in this case. | ||
88 | * CHRP sez: VIA1A bits 0-2 and 5 are 'unused': if programmed as | ||
89 | * inputs, these bits will read 0. | ||
90 | */ | ||
91 | #define VIA1A_vVolume 0x07 /* Audio volume mask for PWM */ | ||
92 | #define VIA1A_CPUID0 0x02 /* CPU id bit 0 on RBV, others */ | ||
93 | #define VIA1A_CPUID1 0x04 /* CPU id bit 0 on RBV, others */ | ||
94 | #define VIA1A_CPUID2 0x10 /* CPU id bit 0 on RBV, others */ | ||
95 | #define VIA1A_CPUID3 0x40 /* CPU id bit 0 on RBV, others */ | ||
96 | |||
97 | /* Info on VIA1B is from Macintosh Family Hardware & MkLinux. | ||
98 | * CHRP offers no info. */ | ||
99 | #define VIA1B_vSound 0x80 /* Sound enable (for compatibility with | ||
100 | * PWM hardware) 0=enabled. | ||
101 | * Also, on IIci w/parity, shows parity error | ||
102 | * 0=error, 1=OK. */ | ||
103 | #define VIA1B_vMystery 0x40 /* On IIci, parity enable. 0=enabled,1=disabled | ||
104 | * On SE/30, vertical sync interrupt enable. | ||
105 | * 0=enabled. This vSync interrupt shows up | ||
106 | * as a slot $E interrupt. */ | ||
107 | #define VIA1B_vADBS2 0x20 /* ADB state input bit 1 (unused on IIfx) */ | ||
108 | #define VIA1B_vADBS1 0x10 /* ADB state input bit 0 (unused on IIfx) */ | ||
109 | #define VIA1B_vADBInt 0x08 /* ADB interrupt 0=interrupt (unused on IIfx)*/ | ||
110 | #define VIA1B_vRTCEnb 0x04 /* Enable Real time clock. 0=enabled. */ | ||
111 | #define VIA1B_vRTCClk 0x02 /* Real time clock serial-clock line. */ | ||
112 | #define VIA1B_vRTCData 0x01 /* Real time clock serial-data line. */ | ||
113 | |||
114 | /* MkLinux defines the following "VIA1 Register B contents where they | ||
115 | * differ from standard VIA1". From the naming scheme, we assume they | ||
116 | * correspond to a VIA work-alike named 'EVR'. */ | ||
117 | #define EVRB_XCVR 0x08 /* XCVR_SESSION* */ | ||
118 | #define EVRB_FULL 0x10 /* VIA_FULL */ | ||
119 | #define EVRB_SYSES 0x20 /* SYS_SESSION */ | ||
120 | #define EVRB_AUXIE 0x00 /* Enable A/UX Interrupt Scheme */ | ||
121 | #define EVRB_AUXID 0x40 /* Disable A/UX Interrupt Scheme */ | ||
122 | #define EVRB_SFTWRIE 0x00 /* Software Interrupt ReQuest */ | ||
123 | #define EVRB_SFTWRID 0x80 /* Software Interrupt ReQuest */ | ||
124 | |||
125 | /* | ||
126 | * VIA2 A register is the interrupt lines raised off the nubus | ||
127 | * slots. | ||
128 | * The below info is from 'Macintosh Family Hardware.' | ||
129 | * MkLinux calls the 'IIci internal video IRQ' below the 'RBV slot 0 irq.' | ||
130 | * It also notes that the slot $9 IRQ is the 'Ethernet IRQ' and | ||
131 | * defines the 'Video IRQ' as 0x40 for the 'EVR' VIA work-alike. | ||
132 | * Perhaps OSS uses vRAM1 and vRAM2 for ADB. | ||
133 | */ | ||
134 | |||
135 | #define VIA2A_vRAM1 0x80 /* RAM size bit 1 (IIci: reserved) */ | ||
136 | #define VIA2A_vRAM0 0x40 /* RAM size bit 0 (IIci: internal video IRQ) */ | ||
137 | #define VIA2A_vIRQE 0x20 /* IRQ from slot $E */ | ||
138 | #define VIA2A_vIRQD 0x10 /* IRQ from slot $D */ | ||
139 | #define VIA2A_vIRQC 0x08 /* IRQ from slot $C */ | ||
140 | #define VIA2A_vIRQB 0x04 /* IRQ from slot $B */ | ||
141 | #define VIA2A_vIRQA 0x02 /* IRQ from slot $A */ | ||
142 | #define VIA2A_vIRQ9 0x01 /* IRQ from slot $9 */ | ||
143 | |||
144 | /* RAM size bits decoded as follows: | ||
145 | * bit1 bit0 size of ICs in bank A | ||
146 | * 0 0 256 kbit | ||
147 | * 0 1 1 Mbit | ||
148 | * 1 0 4 Mbit | ||
149 | * 1 1 16 Mbit | ||
150 | */ | ||
151 | |||
152 | /* | ||
153 | * Register B has the fun stuff in it | ||
154 | */ | ||
155 | |||
156 | #define VIA2B_vVBL 0x80 /* VBL output to VIA1 (60.15Hz) driven by | ||
157 | * timer T1. | ||
158 | * on IIci, parity test: 0=test mode. | ||
159 | * [MkLinux] RBV_PARODD: 1=odd,0=even. */ | ||
160 | #define VIA2B_vSndJck 0x40 /* External sound jack status. | ||
161 | * 0=plug is inserted. On SE/30, always 0 */ | ||
162 | #define VIA2B_vTfr0 0x20 /* Transfer mode bit 0 ack from NuBus */ | ||
163 | #define VIA2B_vTfr1 0x10 /* Transfer mode bit 1 ack from NuBus */ | ||
164 | #define VIA2B_vMode32 0x08 /* 24/32bit switch - doubles as cache flush | ||
165 | * on II, AMU/PMMU control. | ||
166 | * if AMU, 0=24bit to 32bit translation | ||
167 | * if PMMU, 1=PMMU is accessing page table. | ||
168 | * on SE/30 tied low. | ||
169 | * on IIx,IIcx,IIfx, unused. | ||
170 | * on IIci/RBV, cache control. 0=flush cache. | ||
171 | */ | ||
172 | #define VIA2B_vPower 0x04 /* Power off, 0=shut off power. | ||
173 | * on SE/30 this signal sent to PDS card. */ | ||
174 | #define VIA2B_vBusLk 0x02 /* Lock NuBus transactions, 0=locked. | ||
175 | * on SE/30 sent to PDS card. */ | ||
176 | #define VIA2B_vCDis 0x01 /* Cache control. On IIci, 1=disable cache card | ||
177 | * on others, 0=disable processor's instruction | ||
178 | * and data caches. */ | ||
179 | |||
180 | /* Apple sez: http://developer.apple.com/technotes/ov/ov_04.html | ||
181 | * Another example of a valid function that has no ROM support is the use | ||
182 | * of the alternate video page for page-flipping animation. Since there | ||
183 | * is no ROM call to flip pages, it is necessary to go play with the | ||
184 | * right bit in the VIA chip (6522 Versatile Interface Adapter). | ||
185 | * [CSA: don't know which one this is, but it's one of 'em!] | ||
186 | */ | ||
187 | |||
188 | /* | ||
189 | * 6522 registers - see databook. | ||
190 | * CSA: Assignments for VIA1 confirmed from CHRP spec. | ||
191 | */ | ||
192 | |||
193 | /* partial address decode. 0xYYXX : XX part for RBV, YY part for VIA */ | ||
194 | /* Note: 15 VIA regs, 8 RBV regs */ | ||
195 | |||
196 | #define vBufB 0x0000 /* [VIA/RBV] Register B */ | ||
197 | #define vBufAH 0x0200 /* [VIA only] Buffer A, with handshake. DON'T USE! */ | ||
198 | #define vDirB 0x0400 /* [VIA only] Data Direction Register B. */ | ||
199 | #define vDirA 0x0600 /* [VIA only] Data Direction Register A. */ | ||
200 | #define vT1CL 0x0800 /* [VIA only] Timer one counter low. */ | ||
201 | #define vT1CH 0x0a00 /* [VIA only] Timer one counter high. */ | ||
202 | #define vT1LL 0x0c00 /* [VIA only] Timer one latches low. */ | ||
203 | #define vT1LH 0x0e00 /* [VIA only] Timer one latches high. */ | ||
204 | #define vT2CL 0x1000 /* [VIA only] Timer two counter low. */ | ||
205 | #define vT2CH 0x1200 /* [VIA only] Timer two counter high. */ | ||
206 | #define vSR 0x1400 /* [VIA only] Shift register. */ | ||
207 | #define vACR 0x1600 /* [VIA only] Auxilary control register. */ | ||
208 | #define vPCR 0x1800 /* [VIA only] Peripheral control register. */ | ||
209 | /* CHRP sez never ever to *write* this. | ||
210 | * Mac family says never to *change* this. | ||
211 | * In fact we need to initialize it once at start. */ | ||
212 | #define vIFR 0x1a00 /* [VIA/RBV] Interrupt flag register. */ | ||
213 | #define vIER 0x1c00 /* [VIA/RBV] Interrupt enable register. */ | ||
214 | #define vBufA 0x1e00 /* [VIA/RBV] register A (no handshake) */ | ||
215 | |||
216 | /* The RBV only decodes the bottom eight address lines; the VIA doesn't | ||
217 | * decode the bottom eight -- so vBufB | rBufB will always get you BufB */ | ||
218 | /* CSA: in fact, only bits 0,1, and 4 seem to be decoded. | ||
219 | * BUT note the values for rIER and rIFR, where the top 8 bits *do* seem | ||
220 | * to matter. In fact *all* of the top 8 bits seem to matter; | ||
221 | * setting rIER=0x1813 and rIFR=0x1803 doesn't work, either. | ||
222 | * Perhaps some sort of 'compatibility mode' is built-in? [21-May-1999] | ||
223 | */ | ||
224 | |||
225 | #define rBufB 0x0000 /* [VIA/RBV] Register B */ | ||
226 | #define rExp 0x0001 /* [RBV only] RBV future expansion (always 0) */ | ||
227 | #define rSIFR 0x0002 /* [RBV only] RBV slot interrupts register. */ | ||
228 | #define rIFR 0x1a03 /* [VIA/RBV] RBV interrupt flag register. */ | ||
229 | #define rMonP 0x0010 /* [RBV only] RBV video monitor type. */ | ||
230 | #define rChpT 0x0011 /* [RBV only] RBV test mode register (reads as 0). */ | ||
231 | #define rSIER 0x0012 /* [RBV only] RBV slot interrupt enables. */ | ||
232 | #define rIER 0x1c13 /* [VIA/RBV] RBV interrupt flag enable register. */ | ||
233 | #define rBufA rSIFR /* the 'slot interrupts register' is BufA on a VIA */ | ||
234 | |||
235 | /* | ||
236 | * Video monitor parameters, for rMonP: | ||
237 | */ | ||
238 | #define RBV_DEPTH 0x07 /* bits per pixel: 000=1,001=2,010=4,011=8 */ | ||
239 | #define RBV_MONID 0x38 /* monitor type, as below. */ | ||
240 | #define RBV_VIDOFF 0x40 /* 1 turns off onboard video */ | ||
241 | /* Supported monitor types: */ | ||
242 | #define MON_15BW (1<<3) /* 15" BW portrait. */ | ||
243 | #define MON_IIGS (2<<3) /* 12" color (modified IIGS monitor). */ | ||
244 | #define MON_15RGB (5<<3) /* 15" RGB portrait. */ | ||
245 | #define MON_12OR13 (6<<3) /* 12" BW or 13" RGB. */ | ||
246 | #define MON_NONE (7<<3) /* No monitor attached. */ | ||
247 | |||
248 | /* To clarify IER manipulations */ | ||
249 | #define IER_SET_BIT(b) (0x80 | (1<<(b)) ) | ||
250 | #define IER_CLR_BIT(b) (0x7F & (1<<(b)) ) | ||
251 | |||
252 | #ifndef __ASSEMBLY__ | ||
253 | |||
254 | extern volatile __u8 *via1,*via2; | ||
255 | extern int rbv_present,via_alt_mapping; | ||
256 | extern __u8 rbv_clear; | ||
257 | |||
258 | static inline int rbv_set_video_bpp(int bpp) | ||
259 | { | ||
260 | char val = (bpp==1)?0:(bpp==2)?1:(bpp==4)?2:(bpp==8)?3:-1; | ||
261 | if (!rbv_present || val<0) return -1; | ||
262 | via2[rMonP] = (via2[rMonP] & ~RBV_DEPTH) | val; | ||
263 | return 0; | ||
264 | } | ||
265 | |||
266 | #endif /* __ASSEMBLY__ */ | ||
267 | |||
268 | #endif /* _ASM_MAC_VIA_H_ */ | ||
diff --git a/include/asm-m68k/machdep.h b/include/asm-m68k/machdep.h new file mode 100644 index 000000000000..a0dd5c47002c --- /dev/null +++ b/include/asm-m68k/machdep.h | |||
@@ -0,0 +1,42 @@ | |||
1 | #ifndef _M68K_MACHDEP_H | ||
2 | #define _M68K_MACHDEP_H | ||
3 | |||
4 | #include <linux/seq_file.h> | ||
5 | #include <linux/interrupt.h> | ||
6 | |||
7 | struct pt_regs; | ||
8 | struct mktime; | ||
9 | struct rtc_time; | ||
10 | struct rtc_pll_info; | ||
11 | struct buffer_head; | ||
12 | |||
13 | extern void (*mach_sched_init) (irqreturn_t (*handler)(int, void *, struct pt_regs *)); | ||
14 | /* machine dependent irq functions */ | ||
15 | extern void (*mach_init_IRQ) (void); | ||
16 | extern irqreturn_t (*(*mach_default_handler)[]) (int, void *, struct pt_regs *); | ||
17 | extern int (*mach_request_irq) (unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), | ||
18 | unsigned long flags, const char *devname, void *dev_id); | ||
19 | extern void (*mach_free_irq) (unsigned int irq, void *dev_id); | ||
20 | extern void (*mach_get_model) (char *model); | ||
21 | extern int (*mach_get_hardware_list) (char *buffer); | ||
22 | extern int (*mach_get_irq_list) (struct seq_file *p, void *v); | ||
23 | extern irqreturn_t (*mach_process_int) (int irq, struct pt_regs *fp); | ||
24 | /* machine dependent timer functions */ | ||
25 | extern unsigned long (*mach_gettimeoffset)(void); | ||
26 | extern int (*mach_hwclk)(int, struct rtc_time*); | ||
27 | extern unsigned int (*mach_get_ss)(void); | ||
28 | extern int (*mach_get_rtc_pll)(struct rtc_pll_info *); | ||
29 | extern int (*mach_set_rtc_pll)(struct rtc_pll_info *); | ||
30 | extern int (*mach_set_clock_mmss)(unsigned long); | ||
31 | extern void (*mach_reset)( void ); | ||
32 | extern void (*mach_halt)( void ); | ||
33 | extern void (*mach_power_off)( void ); | ||
34 | extern unsigned long (*mach_hd_init) (unsigned long, unsigned long); | ||
35 | extern void (*mach_hd_setup)(char *, int *); | ||
36 | extern long mach_max_dma_address; | ||
37 | extern void (*mach_floppy_setup)(char *, int *); | ||
38 | extern void (*mach_heartbeat) (int); | ||
39 | extern void (*mach_l2_flush) (int); | ||
40 | extern void (*mach_beep) (unsigned int, unsigned int); | ||
41 | |||
42 | #endif /* _M68K_MACHDEP_H */ | ||
diff --git a/include/asm-m68k/machines.h b/include/asm-m68k/machines.h new file mode 100644 index 000000000000..da6015a90f24 --- /dev/null +++ b/include/asm-m68k/machines.h | |||
@@ -0,0 +1,87 @@ | |||
1 | /* $Id: machines.h,v 1.4 1995/11/25 02:31:58 davem Exp $ | ||
2 | * machines.h: Defines for taking apart the machine type value in the | ||
3 | * idprom and determining the kind of machine we are on. | ||
4 | * | ||
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
6 | * Sun3/3x models added by David Monro (davidm@psrg.cs.usyd.edu.au) | ||
7 | */ | ||
8 | #ifndef _SPARC_MACHINES_H | ||
9 | #define _SPARC_MACHINES_H | ||
10 | |||
11 | struct Sun_Machine_Models { | ||
12 | char *name; | ||
13 | unsigned char id_machtype; | ||
14 | }; | ||
15 | |||
16 | /* Current number of machines we know about that has an IDPROM | ||
17 | * machtype entry including one entry for the 0x80 OBP machines. | ||
18 | */ | ||
19 | // reduced along with table in arch/m68k/sun3/idprom.c | ||
20 | // sun3 port doesn't need to know about sparc machines. | ||
21 | //#define NUM_SUN_MACHINES 23 | ||
22 | #define NUM_SUN_MACHINES 8 | ||
23 | |||
24 | extern struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES]; | ||
25 | |||
26 | /* The machine type in the idprom area looks like this: | ||
27 | * | ||
28 | * --------------- | ||
29 | * | ARCH | MACH | | ||
30 | * --------------- | ||
31 | * 7 4 3 0 | ||
32 | * | ||
33 | * The ARCH field determines the architecture line (sun4, sun4c, etc). | ||
34 | * The MACH field determines the machine make within that architecture. | ||
35 | */ | ||
36 | |||
37 | #define SM_ARCH_MASK 0xf0 | ||
38 | #define SM_SUN3 0x10 | ||
39 | #define SM_SUN4 0x20 | ||
40 | #define SM_SUN3X 0x40 | ||
41 | #define SM_SUN4C 0x50 | ||
42 | #define SM_SUN4M 0x70 | ||
43 | #define SM_SUN4M_OBP 0x80 | ||
44 | |||
45 | #define SM_TYP_MASK 0x0f | ||
46 | /* Sun3 machines */ | ||
47 | #define SM_3_160 0x01 /* Sun 3/160 series */ | ||
48 | #define SM_3_50 0x02 /* Sun 3/50 series */ | ||
49 | #define SM_3_260 0x03 /* Sun 3/260 series */ | ||
50 | #define SM_3_110 0x04 /* Sun 3/110 series */ | ||
51 | #define SM_3_60 0x07 /* Sun 3/60 series */ | ||
52 | #define SM_3_E 0x08 /* Sun 3/E series */ | ||
53 | |||
54 | /* Sun3x machines */ | ||
55 | #define SM_3_460 0x01 /* Sun 3/460 (460,470,480) series */ | ||
56 | #define SM_3_80 0x02 /* Sun 3/80 series */ | ||
57 | |||
58 | /* Sun4 machines */ | ||
59 | #define SM_4_260 0x01 /* Sun 4/200 series */ | ||
60 | #define SM_4_110 0x02 /* Sun 4/100 series */ | ||
61 | #define SM_4_330 0x03 /* Sun 4/300 series */ | ||
62 | #define SM_4_470 0x04 /* Sun 4/400 series */ | ||
63 | |||
64 | /* Sun4c machines Full Name - PROM NAME */ | ||
65 | #define SM_4C_SS1 0x01 /* Sun4c SparcStation 1 - Sun 4/60 */ | ||
66 | #define SM_4C_IPC 0x02 /* Sun4c SparcStation IPC - Sun 4/40 */ | ||
67 | #define SM_4C_SS1PLUS 0x03 /* Sun4c SparcStation 1+ - Sun 4/65 */ | ||
68 | #define SM_4C_SLC 0x04 /* Sun4c SparcStation SLC - Sun 4/20 */ | ||
69 | #define SM_4C_SS2 0x05 /* Sun4c SparcStation 2 - Sun 4/75 */ | ||
70 | #define SM_4C_ELC 0x06 /* Sun4c SparcStation ELC - Sun 4/25 */ | ||
71 | #define SM_4C_IPX 0x07 /* Sun4c SparcStation IPX - Sun 4/50 */ | ||
72 | |||
73 | /* Sun4m machines, these predate the OpenBoot. These values only mean | ||
74 | * something if the value in the ARCH field is SM_SUN4M, if it is | ||
75 | * SM_SUN4M_OBP then you have the following situation: | ||
76 | * 1) You either have a sun4d, a sun4e, or a recently made sun4m. | ||
77 | * 2) You have to consult OpenBoot to determine which machine this is. | ||
78 | */ | ||
79 | #define SM_4M_SS60 0x01 /* Sun4m SparcSystem 600 */ | ||
80 | #define SM_4M_SS50 0x02 /* Sun4m SparcStation 10 */ | ||
81 | #define SM_4M_SS40 0x03 /* Sun4m SparcStation 5 */ | ||
82 | |||
83 | /* Sun4d machines -- N/A */ | ||
84 | /* Sun4e machines -- N/A */ | ||
85 | /* Sun4u machines -- N/A */ | ||
86 | |||
87 | #endif /* !(_SPARC_MACHINES_H) */ | ||
diff --git a/include/asm-m68k/machw.h b/include/asm-m68k/machw.h new file mode 100644 index 000000000000..d2e0e25d5c90 --- /dev/null +++ b/include/asm-m68k/machw.h | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | ** linux/machw.h -- This header defines some macros and pointers for | ||
3 | ** the various Macintosh custom hardware registers. | ||
4 | ** | ||
5 | ** Copyright 1997 by Michael Schmitz | ||
6 | ** | ||
7 | ** This file is subject to the terms and conditions of the GNU General Public | ||
8 | ** License. See the file COPYING in the main directory of this archive | ||
9 | ** for more details. | ||
10 | ** | ||
11 | */ | ||
12 | |||
13 | #ifndef _ASM_MACHW_H_ | ||
14 | #define _ASM_MACHW_H_ | ||
15 | |||
16 | /* | ||
17 | * head.S maps the videomem to VIDEOMEMBASE | ||
18 | */ | ||
19 | |||
20 | #define VIDEOMEMBASE 0xf0000000 | ||
21 | #define VIDEOMEMSIZE (4096*1024) | ||
22 | #define VIDEOMEMMASK (-4096*1024) | ||
23 | |||
24 | #ifndef __ASSEMBLY__ | ||
25 | |||
26 | #include <linux/types.h> | ||
27 | |||
28 | #if 0 | ||
29 | /* Mac SCSI Controller 5380 */ | ||
30 | |||
31 | #define MAC_5380_BAS (0x50F10000) /* This is definitely wrong!! */ | ||
32 | struct MAC_5380 { | ||
33 | u_char scsi_data; | ||
34 | u_char char_dummy1; | ||
35 | u_char scsi_icr; | ||
36 | u_char char_dummy2; | ||
37 | u_char scsi_mode; | ||
38 | u_char char_dummy3; | ||
39 | u_char scsi_tcr; | ||
40 | u_char char_dummy4; | ||
41 | u_char scsi_idstat; | ||
42 | u_char char_dummy5; | ||
43 | u_char scsi_dmastat; | ||
44 | u_char char_dummy6; | ||
45 | u_char scsi_targrcv; | ||
46 | u_char char_dummy7; | ||
47 | u_char scsi_inircv; | ||
48 | }; | ||
49 | #define mac_scsi ((*(volatile struct MAC_5380 *)MAC_5380_BAS)) | ||
50 | |||
51 | /* | ||
52 | ** SCC Z8530 | ||
53 | */ | ||
54 | |||
55 | #define MAC_SCC_BAS (0x50F04000) | ||
56 | struct MAC_SCC | ||
57 | { | ||
58 | u_char cha_a_ctrl; | ||
59 | u_char char_dummy1; | ||
60 | u_char cha_a_data; | ||
61 | u_char char_dummy2; | ||
62 | u_char cha_b_ctrl; | ||
63 | u_char char_dummy3; | ||
64 | u_char cha_b_data; | ||
65 | }; | ||
66 | # define mac_scc ((*(volatile struct SCC*)MAC_SCC_BAS)) | ||
67 | #endif | ||
68 | |||
69 | /* hardware stuff */ | ||
70 | |||
71 | #define MACHW_DECLARE(name) unsigned name : 1 | ||
72 | #define MACHW_SET(name) (mac_hw_present.name = 1) | ||
73 | #define MACHW_PRESENT(name) (mac_hw_present.name) | ||
74 | |||
75 | struct mac_hw_present { | ||
76 | /* video hardware */ | ||
77 | /* sound hardware */ | ||
78 | /* disk storage interfaces */ | ||
79 | MACHW_DECLARE(MAC_SCSI_80); /* Directly mapped NCR5380 */ | ||
80 | MACHW_DECLARE(MAC_SCSI_96); /* 53c9[46] */ | ||
81 | MACHW_DECLARE(MAC_SCSI_96_2); /* 2nd 53c9[46] Q900 and Q950 */ | ||
82 | MACHW_DECLARE(IDE); /* IDE Interface */ | ||
83 | /* other I/O hardware */ | ||
84 | MACHW_DECLARE(SCC); /* Serial Communications Contr. */ | ||
85 | /* DMA */ | ||
86 | MACHW_DECLARE(SCSI_DMA); /* DMA for the NCR5380 */ | ||
87 | /* real time clocks */ | ||
88 | MACHW_DECLARE(RTC_CLK); /* clock chip */ | ||
89 | /* supporting hardware */ | ||
90 | MACHW_DECLARE(VIA1); /* Versatile Interface Ad. 1 */ | ||
91 | MACHW_DECLARE(VIA2); /* Versatile Interface Ad. 2 */ | ||
92 | MACHW_DECLARE(RBV); /* Versatile Interface Ad. 2+ */ | ||
93 | /* NUBUS */ | ||
94 | MACHW_DECLARE(NUBUS); /* NUBUS */ | ||
95 | }; | ||
96 | |||
97 | extern struct mac_hw_present mac_hw_present; | ||
98 | |||
99 | #endif /* __ASSEMBLY__ */ | ||
100 | |||
101 | #endif /* linux/machw.h */ | ||
diff --git a/include/asm-m68k/macintosh.h b/include/asm-m68k/macintosh.h new file mode 100644 index 000000000000..6fc3d19512d1 --- /dev/null +++ b/include/asm-m68k/macintosh.h | |||
@@ -0,0 +1,152 @@ | |||
1 | #ifndef __ASM_MACINTOSH_H | ||
2 | #define __ASM_MACINTOSH_H | ||
3 | |||
4 | #include <linux/seq_file.h> | ||
5 | #include <linux/interrupt.h> | ||
6 | |||
7 | /* | ||
8 | * Apple Macintoshisms | ||
9 | */ | ||
10 | |||
11 | extern void mac_reset(void); | ||
12 | extern void mac_poweroff(void); | ||
13 | extern void mac_init_IRQ(void); | ||
14 | extern int mac_request_irq (unsigned int, irqreturn_t (*)(int, void *, | ||
15 | struct pt_regs *), | ||
16 | unsigned long, const char *, void *); | ||
17 | extern void mac_free_irq(unsigned int, void *); | ||
18 | extern void mac_enable_irq(unsigned int); | ||
19 | extern void mac_disable_irq(unsigned int); | ||
20 | extern int mac_irq_pending(unsigned int); | ||
21 | extern int show_mac_interrupts(struct seq_file *, void *); | ||
22 | #if 0 | ||
23 | extern void mac_default_handler(int irq); | ||
24 | #endif | ||
25 | extern void mac_identify(void); | ||
26 | extern void mac_report_hardware(void); | ||
27 | extern void mac_debugging_penguin(int); | ||
28 | extern void mac_boom(int); | ||
29 | |||
30 | /* | ||
31 | * Floppy driver magic hook - probably shouldnt be here | ||
32 | */ | ||
33 | |||
34 | extern void via1_set_head(int); | ||
35 | |||
36 | extern void parse_booter(char *ptr); | ||
37 | extern void print_booter(char *ptr); | ||
38 | |||
39 | /* | ||
40 | * Macintosh Table | ||
41 | */ | ||
42 | |||
43 | struct mac_model | ||
44 | { | ||
45 | short ident; | ||
46 | char *name; | ||
47 | char adb_type; | ||
48 | char via_type; | ||
49 | char scsi_type; | ||
50 | char ide_type; | ||
51 | char scc_type; | ||
52 | char ether_type; | ||
53 | char nubus_type; | ||
54 | }; | ||
55 | |||
56 | #define MAC_ADB_NONE 0 | ||
57 | #define MAC_ADB_II 1 | ||
58 | #define MAC_ADB_IISI 2 | ||
59 | #define MAC_ADB_CUDA 3 | ||
60 | #define MAC_ADB_PB1 4 | ||
61 | #define MAC_ADB_PB2 5 | ||
62 | #define MAC_ADB_IOP 6 | ||
63 | |||
64 | #define MAC_VIA_II 1 | ||
65 | #define MAC_VIA_IIci 2 | ||
66 | #define MAC_VIA_QUADRA 3 | ||
67 | |||
68 | #define MAC_SCSI_NONE 0 | ||
69 | #define MAC_SCSI_OLD 1 | ||
70 | #define MAC_SCSI_QUADRA 2 | ||
71 | #define MAC_SCSI_QUADRA2 3 | ||
72 | #define MAC_SCSI_QUADRA3 4 | ||
73 | |||
74 | #define MAC_IDE_NONE 0 | ||
75 | #define MAC_IDE_QUADRA 1 | ||
76 | #define MAC_IDE_PB 2 | ||
77 | #define MAC_IDE_BABOON 3 | ||
78 | |||
79 | #define MAC_SCC_II 1 | ||
80 | #define MAC_SCC_IOP 2 | ||
81 | #define MAC_SCC_QUADRA 3 | ||
82 | #define MAC_SCC_PSC 4 | ||
83 | |||
84 | #define MAC_ETHER_NONE 0 | ||
85 | #define MAC_ETHER_SONIC 1 | ||
86 | #define MAC_ETHER_MACE 2 | ||
87 | |||
88 | #define MAC_NO_NUBUS 0 | ||
89 | #define MAC_NUBUS 1 | ||
90 | |||
91 | /* | ||
92 | * Gestalt numbers | ||
93 | */ | ||
94 | |||
95 | #define MAC_MODEL_II 6 | ||
96 | #define MAC_MODEL_IIX 7 | ||
97 | #define MAC_MODEL_IICX 8 | ||
98 | #define MAC_MODEL_SE30 9 | ||
99 | #define MAC_MODEL_IICI 11 | ||
100 | #define MAC_MODEL_IIFX 13 /* And well numbered it is too */ | ||
101 | #define MAC_MODEL_IISI 18 | ||
102 | #define MAC_MODEL_LC 19 | ||
103 | #define MAC_MODEL_Q900 20 | ||
104 | #define MAC_MODEL_PB170 21 | ||
105 | #define MAC_MODEL_Q700 22 | ||
106 | #define MAC_MODEL_CLII 23 /* aka: P200 */ | ||
107 | #define MAC_MODEL_PB140 25 | ||
108 | #define MAC_MODEL_Q950 26 /* aka: WGS95 */ | ||
109 | #define MAC_MODEL_LCIII 27 /* aka: P450 */ | ||
110 | #define MAC_MODEL_PB210 29 | ||
111 | #define MAC_MODEL_C650 30 | ||
112 | #define MAC_MODEL_PB230 32 | ||
113 | #define MAC_MODEL_PB180 33 | ||
114 | #define MAC_MODEL_PB160 34 | ||
115 | #define MAC_MODEL_Q800 35 /* aka: WGS80 */ | ||
116 | #define MAC_MODEL_Q650 36 | ||
117 | #define MAC_MODEL_LCII 37 /* aka: P400/405/410/430 */ | ||
118 | #define MAC_MODEL_PB250 38 | ||
119 | #define MAC_MODEL_IIVI 44 | ||
120 | #define MAC_MODEL_P600 45 /* aka: P600CD */ | ||
121 | #define MAC_MODEL_IIVX 48 | ||
122 | #define MAC_MODEL_CCL 49 /* aka: P250 */ | ||
123 | #define MAC_MODEL_PB165C 50 | ||
124 | #define MAC_MODEL_C610 52 /* aka: WGS60 */ | ||
125 | #define MAC_MODEL_Q610 53 | ||
126 | #define MAC_MODEL_PB145 54 /* aka: PB145B */ | ||
127 | #define MAC_MODEL_P520 56 /* aka: LC520 */ | ||
128 | #define MAC_MODEL_C660 60 | ||
129 | #define MAC_MODEL_P460 62 /* aka: LCIII+, P466/P467 */ | ||
130 | #define MAC_MODEL_PB180C 71 | ||
131 | #define MAC_MODEL_PB520 72 /* aka: PB520C, PB540, PB540C, PB550C */ | ||
132 | #define MAC_MODEL_PB270C 77 | ||
133 | #define MAC_MODEL_Q840 78 | ||
134 | #define MAC_MODEL_P550 80 /* aka: LC550, P560 */ | ||
135 | #define MAC_MODEL_CCLII 83 /* aka: P275 */ | ||
136 | #define MAC_MODEL_PB165 84 | ||
137 | #define MAC_MODEL_PB190 85 /* aka: PB190CS */ | ||
138 | #define MAC_MODEL_TV 88 | ||
139 | #define MAC_MODEL_P475 89 /* aka: LC475, P476 */ | ||
140 | #define MAC_MODEL_P475F 90 /* aka: P475 w/ FPU (no LC040) */ | ||
141 | #define MAC_MODEL_P575 92 /* aka: LC575, P577/P578 */ | ||
142 | #define MAC_MODEL_Q605 94 | ||
143 | #define MAC_MODEL_Q605_ACC 95 /* Q605 accelerated to 33 MHz */ | ||
144 | #define MAC_MODEL_Q630 98 /* aka: LC630, P630/631/635/636/637/638/640 */ | ||
145 | #define MAC_MODEL_P588 99 /* aka: LC580, P580 */ | ||
146 | #define MAC_MODEL_PB280 102 | ||
147 | #define MAC_MODEL_PB280C 103 | ||
148 | #define MAC_MODEL_PB150 115 | ||
149 | |||
150 | extern struct mac_model *macintosh_config; | ||
151 | |||
152 | #endif | ||
diff --git a/include/asm-m68k/macints.h b/include/asm-m68k/macints.h new file mode 100644 index 000000000000..fd8c3a9fea4d --- /dev/null +++ b/include/asm-m68k/macints.h | |||
@@ -0,0 +1,169 @@ | |||
1 | /* | ||
2 | ** macints.h -- Macintosh Linux interrupt handling structs and prototypes | ||
3 | ** | ||
4 | ** Copyright 1997 by Michael Schmitz | ||
5 | ** | ||
6 | ** This file is subject to the terms and conditions of the GNU General Public | ||
7 | ** License. See the file COPYING in the main directory of this archive | ||
8 | ** for more details. | ||
9 | ** | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_MACINTS_H_ | ||
13 | #define _ASM_MACINTS_H_ | ||
14 | |||
15 | #include <asm/irq.h> | ||
16 | |||
17 | /* Setting this prints debugging info for unclaimed interrupts */ | ||
18 | |||
19 | #define DEBUG_SPURIOUS | ||
20 | |||
21 | /* Setting this prints debugging info on each autovector interrupt */ | ||
22 | |||
23 | /* #define DEBUG_IRQS */ | ||
24 | |||
25 | /* Setting this prints debugging info on each Nubus interrupt */ | ||
26 | |||
27 | /* #define DEBUG_NUBUS_INT */ | ||
28 | |||
29 | /* Setting this prints debugging info on irqs as they enabled and disabled. */ | ||
30 | |||
31 | /* #define DEBUG_IRQUSE */ | ||
32 | |||
33 | /* | ||
34 | * Base IRQ number for all Mac68K interrupt sources. Each source | ||
35 | * has eight indexes (base -> base+7). | ||
36 | */ | ||
37 | |||
38 | #define VIA1_SOURCE_BASE 8 | ||
39 | #define VIA2_SOURCE_BASE 16 | ||
40 | #define MAC_SCC_SOURCE_BASE 24 | ||
41 | #define PSC3_SOURCE_BASE 24 | ||
42 | #define PSC4_SOURCE_BASE 32 | ||
43 | #define PSC5_SOURCE_BASE 40 | ||
44 | #define PSC6_SOURCE_BASE 48 | ||
45 | #define NUBUS_SOURCE_BASE 56 | ||
46 | #define BABOON_SOURCE_BASE 64 | ||
47 | |||
48 | /* | ||
49 | * Maximum IRQ number is BABOON_SOURCE_BASE + 7, | ||
50 | * giving us IRQs up through 71 | ||
51 | */ | ||
52 | |||
53 | #define NUM_MAC_SOURCES 72 | ||
54 | |||
55 | /* | ||
56 | * clean way to separate IRQ into its source and index | ||
57 | */ | ||
58 | |||
59 | #define IRQ_SRC(irq) (irq >> 3) | ||
60 | #define IRQ_IDX(irq) (irq & 7) | ||
61 | |||
62 | #define IRQ_SPURIOUS (0) | ||
63 | |||
64 | /* auto-vector interrupts */ | ||
65 | #define IRQ_AUTO_1 (1) | ||
66 | #define IRQ_AUTO_2 (2) | ||
67 | #define IRQ_AUTO_3 (3) | ||
68 | #define IRQ_AUTO_4 (4) | ||
69 | #define IRQ_AUTO_5 (5) | ||
70 | #define IRQ_AUTO_6 (6) | ||
71 | #define IRQ_AUTO_7 (7) | ||
72 | |||
73 | /* VIA1 interrupts */ | ||
74 | #define IRQ_VIA1_0 (8) /* one second int. */ | ||
75 | #define IRQ_VIA1_1 (9) /* VBlank int. */ | ||
76 | #define IRQ_MAC_VBL IRQ_VIA1_1 | ||
77 | #define IRQ_VIA1_2 (10) /* ADB SR shifts complete */ | ||
78 | #define IRQ_MAC_ADB IRQ_VIA1_2 | ||
79 | #define IRQ_MAC_ADB_SR IRQ_VIA1_2 | ||
80 | #define IRQ_VIA1_3 (11) /* ADB SR CB2 ?? */ | ||
81 | #define IRQ_MAC_ADB_SD IRQ_VIA1_3 | ||
82 | #define IRQ_VIA1_4 (12) /* ADB SR ext. clock pulse */ | ||
83 | #define IRQ_MAC_ADB_CL IRQ_VIA1_4 | ||
84 | #define IRQ_VIA1_5 (13) | ||
85 | #define IRQ_MAC_TIMER_2 IRQ_VIA1_5 | ||
86 | #define IRQ_VIA1_6 (14) | ||
87 | #define IRQ_MAC_TIMER_1 IRQ_VIA1_6 | ||
88 | #define IRQ_VIA1_7 (15) | ||
89 | |||
90 | /* VIA2/RBV interrupts */ | ||
91 | #define IRQ_VIA2_0 (16) | ||
92 | #define IRQ_MAC_SCSIDRQ IRQ_VIA2_0 | ||
93 | #define IRQ_VIA2_1 (17) | ||
94 | #define IRQ_MAC_NUBUS IRQ_VIA2_1 | ||
95 | #define IRQ_VIA2_2 (18) | ||
96 | #define IRQ_VIA2_3 (19) | ||
97 | #define IRQ_MAC_SCSI IRQ_VIA2_3 | ||
98 | #define IRQ_VIA2_4 (20) | ||
99 | #define IRQ_VIA2_5 (21) | ||
100 | #define IRQ_VIA2_6 (22) | ||
101 | #define IRQ_VIA2_7 (23) | ||
102 | |||
103 | /* Level 3 (PSC, AV Macs only) interrupts */ | ||
104 | #define IRQ_PSC3_0 (24) | ||
105 | #define IRQ_MAC_MACE IRQ_PSC3_0 | ||
106 | #define IRQ_PSC3_1 (25) | ||
107 | #define IRQ_PSC3_2 (26) | ||
108 | #define IRQ_PSC3_3 (27) | ||
109 | |||
110 | /* Level 4 (SCC) interrupts */ | ||
111 | #define IRQ_SCC (32) | ||
112 | #define IRQ_SCCA (33) | ||
113 | #define IRQ_SCCB (34) | ||
114 | #if 0 /* FIXME: are there multiple interrupt conditions on the SCC ?? */ | ||
115 | /* SCC interrupts */ | ||
116 | #define IRQ_SCCB_TX (32) | ||
117 | #define IRQ_SCCB_STAT (33) | ||
118 | #define IRQ_SCCB_RX (34) | ||
119 | #define IRQ_SCCB_SPCOND (35) | ||
120 | #define IRQ_SCCA_TX (36) | ||
121 | #define IRQ_SCCA_STAT (37) | ||
122 | #define IRQ_SCCA_RX (38) | ||
123 | #define IRQ_SCCA_SPCOND (39) | ||
124 | #endif | ||
125 | |||
126 | /* Level 4 (PSC, AV Macs only) interrupts */ | ||
127 | #define IRQ_PSC4_0 (32) | ||
128 | #define IRQ_PSC4_1 (33) | ||
129 | #define IRQ_PSC4_2 (34) | ||
130 | #define IRQ_PSC4_3 (35) | ||
131 | #define IRQ_MAC_MACE_DMA IRQ_PSC4_3 | ||
132 | |||
133 | /* Level 5 (PSC, AV Macs only) interrupts */ | ||
134 | #define IRQ_PSC5_0 (40) | ||
135 | #define IRQ_PSC5_1 (41) | ||
136 | #define IRQ_PSC5_2 (42) | ||
137 | #define IRQ_PSC5_3 (43) | ||
138 | |||
139 | /* Level 6 (PSC, AV Macs only) interrupts */ | ||
140 | #define IRQ_PSC6_0 (48) | ||
141 | #define IRQ_PSC6_1 (49) | ||
142 | #define IRQ_PSC6_2 (50) | ||
143 | #define IRQ_PSC6_3 (51) | ||
144 | |||
145 | /* Nubus interrupts (cascaded to VIA2) */ | ||
146 | #define IRQ_NUBUS_9 (56) | ||
147 | #define IRQ_NUBUS_A (57) | ||
148 | #define IRQ_NUBUS_B (58) | ||
149 | #define IRQ_NUBUS_C (59) | ||
150 | #define IRQ_NUBUS_D (60) | ||
151 | #define IRQ_NUBUS_E (61) | ||
152 | #define IRQ_NUBUS_F (62) | ||
153 | |||
154 | /* Baboon interrupts (cascaded to nubus slot $C) */ | ||
155 | #define IRQ_BABOON_0 (64) | ||
156 | #define IRQ_BABOON_1 (65) | ||
157 | #define IRQ_BABOON_2 (66) | ||
158 | #define IRQ_BABOON_3 (67) | ||
159 | |||
160 | #define SLOT2IRQ(x) (x + 47) | ||
161 | #define IRQ2SLOT(x) (x - 47) | ||
162 | |||
163 | #define INT_CLK 24576 /* CLK while int_clk =2.456MHz and divide = 100 */ | ||
164 | #define INT_TICKS 246 /* to make sched_time = 99.902... HZ */ | ||
165 | |||
166 | extern irq_node_t *mac_irq_list[NUM_MAC_SOURCES]; | ||
167 | extern void mac_do_irq_list(int irq, struct pt_regs *); | ||
168 | |||
169 | #endif /* asm/macints.h */ | ||
diff --git a/include/asm-m68k/math-emu.h b/include/asm-m68k/math-emu.h new file mode 100644 index 000000000000..7ac6259b68df --- /dev/null +++ b/include/asm-m68k/math-emu.h | |||
@@ -0,0 +1,300 @@ | |||
1 | #ifndef _ASM_M68K_SETUP_H | ||
2 | #define _ASM_M68K_SETUP_H | ||
3 | |||
4 | #include <asm/setup.h> | ||
5 | #include <linux/linkage.h> | ||
6 | |||
7 | /* Status Register bits */ | ||
8 | |||
9 | /* accrued exception bits */ | ||
10 | #define FPSR_AEXC_INEX 3 | ||
11 | #define FPSR_AEXC_DZ 4 | ||
12 | #define FPSR_AEXC_UNFL 5 | ||
13 | #define FPSR_AEXC_OVFL 6 | ||
14 | #define FPSR_AEXC_IOP 7 | ||
15 | |||
16 | /* exception status bits */ | ||
17 | #define FPSR_EXC_INEX1 8 | ||
18 | #define FPSR_EXC_INEX2 9 | ||
19 | #define FPSR_EXC_DZ 10 | ||
20 | #define FPSR_EXC_UNFL 11 | ||
21 | #define FPSR_EXC_OVFL 12 | ||
22 | #define FPSR_EXC_OPERR 13 | ||
23 | #define FPSR_EXC_SNAN 14 | ||
24 | #define FPSR_EXC_BSUN 15 | ||
25 | |||
26 | /* quotient byte, assumes big-endian, of course */ | ||
27 | #define FPSR_QUOTIENT(fpsr) (*((signed char *) &(fpsr) + 1)) | ||
28 | |||
29 | /* condition code bits */ | ||
30 | #define FPSR_CC_NAN 24 | ||
31 | #define FPSR_CC_INF 25 | ||
32 | #define FPSR_CC_Z 26 | ||
33 | #define FPSR_CC_NEG 27 | ||
34 | |||
35 | |||
36 | /* Control register bits */ | ||
37 | |||
38 | /* rounding mode */ | ||
39 | #define FPCR_ROUND_RN 0 /* round to nearest/even */ | ||
40 | #define FPCR_ROUND_RZ 1 /* round to zero */ | ||
41 | #define FPCR_ROUND_RM 2 /* minus infinity */ | ||
42 | #define FPCR_ROUND_RP 3 /* plus infinity */ | ||
43 | |||
44 | /* rounding precision */ | ||
45 | #define FPCR_PRECISION_X 0 /* long double */ | ||
46 | #define FPCR_PRECISION_S 1 /* double */ | ||
47 | #define FPCR_PRECISION_D 2 /* float */ | ||
48 | |||
49 | |||
50 | /* Flags to select the debugging output */ | ||
51 | #define PDECODE 0 | ||
52 | #define PEXECUTE 1 | ||
53 | #define PCONV 2 | ||
54 | #define PNORM 3 | ||
55 | #define PREGISTER 4 | ||
56 | #define PINSTR 5 | ||
57 | #define PUNIMPL 6 | ||
58 | #define PMOVEM 7 | ||
59 | |||
60 | #define PMDECODE (1<<PDECODE) | ||
61 | #define PMEXECUTE (1<<PEXECUTE) | ||
62 | #define PMCONV (1<<PCONV) | ||
63 | #define PMNORM (1<<PNORM) | ||
64 | #define PMREGISTER (1<<PREGISTER) | ||
65 | #define PMINSTR (1<<PINSTR) | ||
66 | #define PMUNIMPL (1<<PUNIMPL) | ||
67 | #define PMMOVEM (1<<PMOVEM) | ||
68 | |||
69 | #ifndef __ASSEMBLY__ | ||
70 | |||
71 | #include <linux/kernel.h> | ||
72 | #include <linux/sched.h> | ||
73 | |||
74 | union fp_mant64 { | ||
75 | unsigned long long m64; | ||
76 | unsigned long m32[2]; | ||
77 | }; | ||
78 | |||
79 | union fp_mant128 { | ||
80 | unsigned long long m64[2]; | ||
81 | unsigned long m32[4]; | ||
82 | }; | ||
83 | |||
84 | /* internal representation of extended fp numbers */ | ||
85 | struct fp_ext { | ||
86 | unsigned char lowmant; | ||
87 | unsigned char sign; | ||
88 | unsigned short exp; | ||
89 | union fp_mant64 mant; | ||
90 | }; | ||
91 | |||
92 | /* C representation of FPU registers */ | ||
93 | /* NOTE: if you change this, you have to change the assembler offsets | ||
94 | below and the size in <asm/fpu.h>, too */ | ||
95 | struct fp_data { | ||
96 | struct fp_ext fpreg[8]; | ||
97 | unsigned int fpcr; | ||
98 | unsigned int fpsr; | ||
99 | unsigned int fpiar; | ||
100 | unsigned short prec; | ||
101 | unsigned short rnd; | ||
102 | struct fp_ext temp[2]; | ||
103 | }; | ||
104 | |||
105 | #ifdef FPU_EMU_DEBUG | ||
106 | extern unsigned int fp_debugprint; | ||
107 | |||
108 | #define dprint(bit, fmt, args...) ({ \ | ||
109 | if (fp_debugprint & (1 << (bit))) \ | ||
110 | printk(fmt, ## args); \ | ||
111 | }) | ||
112 | #else | ||
113 | #define dprint(bit, fmt, args...) | ||
114 | #endif | ||
115 | |||
116 | #define uprint(str) ({ \ | ||
117 | static int __count = 3; \ | ||
118 | \ | ||
119 | if (__count > 0) { \ | ||
120 | printk("You just hit an unimplemented " \ | ||
121 | "fpu instruction (%s)\n", str); \ | ||
122 | printk("Please report this to ....\n"); \ | ||
123 | __count--; \ | ||
124 | } \ | ||
125 | }) | ||
126 | |||
127 | #define FPDATA ((struct fp_data *)current->thread.fp) | ||
128 | |||
129 | #else /* __ASSEMBLY__ */ | ||
130 | |||
131 | #define FPDATA %a2 | ||
132 | |||
133 | /* offsets from the base register to the floating point data in the task struct */ | ||
134 | #define FPD_FPREG (TASK_THREAD+THREAD_FPREG+0) | ||
135 | #define FPD_FPCR (TASK_THREAD+THREAD_FPREG+96) | ||
136 | #define FPD_FPSR (TASK_THREAD+THREAD_FPREG+100) | ||
137 | #define FPD_FPIAR (TASK_THREAD+THREAD_FPREG+104) | ||
138 | #define FPD_PREC (TASK_THREAD+THREAD_FPREG+108) | ||
139 | #define FPD_RND (TASK_THREAD+THREAD_FPREG+110) | ||
140 | #define FPD_TEMPFP1 (TASK_THREAD+THREAD_FPREG+112) | ||
141 | #define FPD_TEMPFP2 (TASK_THREAD+THREAD_FPREG+124) | ||
142 | #define FPD_SIZEOF (TASK_THREAD+THREAD_FPREG+136) | ||
143 | |||
144 | /* offsets on the stack to access saved registers, | ||
145 | * these are only used during instruction decoding | ||
146 | * where we always know how deep we're on the stack. | ||
147 | */ | ||
148 | #define FPS_DO (PT_D0) | ||
149 | #define FPS_D1 (PT_D1) | ||
150 | #define FPS_D2 (PT_D2) | ||
151 | #define FPS_A0 (PT_A0) | ||
152 | #define FPS_A1 (PT_A1) | ||
153 | #define FPS_A2 (PT_A2) | ||
154 | #define FPS_SR (PT_SR) | ||
155 | #define FPS_PC (PT_PC) | ||
156 | #define FPS_EA (PT_PC+6) | ||
157 | #define FPS_PC2 (PT_PC+10) | ||
158 | |||
159 | .macro fp_get_fp_reg | ||
160 | lea (FPD_FPREG,FPDATA,%d0.w*4),%a0 | ||
161 | lea (%a0,%d0.w*8),%a0 | ||
162 | .endm | ||
163 | |||
164 | /* Macros used to get/put the current program counter. | ||
165 | * 020/030 use a different stack frame then 040/060, for the | ||
166 | * 040/060 the return pc points already to the next location, | ||
167 | * so this only needs to be modified for jump instructions. | ||
168 | */ | ||
169 | .macro fp_get_pc dest | ||
170 | move.l (FPS_PC+4,%sp),\dest | ||
171 | .endm | ||
172 | |||
173 | .macro fp_put_pc src,jump=0 | ||
174 | move.l \src,(FPS_PC+4,%sp) | ||
175 | .endm | ||
176 | |||
177 | .macro fp_get_instr_data f,s,dest,label | ||
178 | getuser \f,%sp@(FPS_PC+4)@(0),\dest,\label,%sp@(FPS_PC+4) | ||
179 | addq.l #\s,%sp@(FPS_PC+4) | ||
180 | .endm | ||
181 | |||
182 | .macro fp_get_instr_word dest,label,addr | ||
183 | fp_get_instr_data w,2,\dest,\label,\addr | ||
184 | .endm | ||
185 | |||
186 | .macro fp_get_instr_long dest,label,addr | ||
187 | fp_get_instr_data l,4,\dest,\label,\addr | ||
188 | .endm | ||
189 | |||
190 | /* These macros are used to read from/write to user space | ||
191 | * on error we jump to the fixup section, load the fault | ||
192 | * address into %a0 and jump to the exit. | ||
193 | * (derived from <asm/uaccess.h>) | ||
194 | */ | ||
195 | .macro getuser size,src,dest,label,addr | ||
196 | | printf ,"[\size<%08x]",1,\addr | ||
197 | .Lu1\@: moves\size \src,\dest | ||
198 | |||
199 | .section .fixup,"ax" | ||
200 | .even | ||
201 | .Lu2\@: move.l \addr,%a0 | ||
202 | jra \label | ||
203 | .previous | ||
204 | |||
205 | .section __ex_table,"a" | ||
206 | .align 4 | ||
207 | .long .Lu1\@,.Lu2\@ | ||
208 | .previous | ||
209 | .endm | ||
210 | |||
211 | .macro putuser size,src,dest,label,addr | ||
212 | | printf ,"[\size>%08x]",1,\addr | ||
213 | .Lu1\@: moves\size \src,\dest | ||
214 | .Lu2\@: | ||
215 | |||
216 | .section .fixup,"ax" | ||
217 | .even | ||
218 | .Lu3\@: move.l \addr,%a0 | ||
219 | jra \label | ||
220 | .previous | ||
221 | |||
222 | .section __ex_table,"a" | ||
223 | .align 4 | ||
224 | .long .Lu1\@,.Lu3\@ | ||
225 | .long .Lu2\@,.Lu3\@ | ||
226 | .previous | ||
227 | .endm | ||
228 | |||
229 | |||
230 | .macro movestack nr,arg1,arg2,arg3,arg4,arg5 | ||
231 | .if \nr | ||
232 | movestack (\nr-1),\arg2,\arg3,\arg4,\arg5 | ||
233 | move.l \arg1,-(%sp) | ||
234 | .endif | ||
235 | .endm | ||
236 | |||
237 | .macro printf bit=-1,string,nr=0,arg1,arg2,arg3,arg4,arg5 | ||
238 | #ifdef FPU_EMU_DEBUG | ||
239 | .data | ||
240 | .Lpdata\@: | ||
241 | .string "\string" | ||
242 | .previous | ||
243 | |||
244 | movem.l %d0/%d1/%a0/%a1,-(%sp) | ||
245 | .if \bit+1 | ||
246 | #if 0 | ||
247 | moveq #\bit,%d0 | ||
248 | andw #7,%d0 | ||
249 | btst %d0,fp_debugprint+((31-\bit)/8) | ||
250 | #else | ||
251 | btst #\bit,fp_debugprint+((31-\bit)/8) | ||
252 | #endif | ||
253 | jeq .Lpskip\@ | ||
254 | .endif | ||
255 | movestack \nr,\arg1,\arg2,\arg3,\arg4,\arg5 | ||
256 | pea .Lpdata\@ | ||
257 | jsr printk | ||
258 | lea ((\nr+1)*4,%sp),%sp | ||
259 | .Lpskip\@: | ||
260 | movem.l (%sp)+,%d0/%d1/%a0/%a1 | ||
261 | #endif | ||
262 | .endm | ||
263 | |||
264 | .macro printx bit,fp | ||
265 | #ifdef FPU_EMU_DEBUG | ||
266 | movem.l %d0/%a0,-(%sp) | ||
267 | lea \fp,%a0 | ||
268 | #if 0 | ||
269 | moveq #'+',%d0 | ||
270 | tst.w (%a0) | ||
271 | jeq .Lx1\@ | ||
272 | moveq #'-',%d0 | ||
273 | .Lx1\@: printf \bit," %c",1,%d0 | ||
274 | move.l (4,%a0),%d0 | ||
275 | bclr #31,%d0 | ||
276 | jne .Lx2\@ | ||
277 | printf \bit,"0." | ||
278 | jra .Lx3\@ | ||
279 | .Lx2\@: printf \bit,"1." | ||
280 | .Lx3\@: printf \bit,"%08x%08x",2,%d0,%a0@(8) | ||
281 | move.w (2,%a0),%d0 | ||
282 | ext.l %d0 | ||
283 | printf \bit,"E%04x",1,%d0 | ||
284 | #else | ||
285 | printf \bit," %08x%08x%08x",3,%a0@,%a0@(4),%a0@(8) | ||
286 | #endif | ||
287 | movem.l (%sp)+,%d0/%a0 | ||
288 | #endif | ||
289 | .endm | ||
290 | |||
291 | .macro debug instr,args | ||
292 | #ifdef FPU_EMU_DEBUG | ||
293 | \instr \args | ||
294 | #endif | ||
295 | .endm | ||
296 | |||
297 | |||
298 | #endif /* __ASSEMBLY__ */ | ||
299 | |||
300 | #endif /* _ASM_M68K_SETUP_H */ | ||
diff --git a/include/asm-m68k/mc146818rtc.h b/include/asm-m68k/mc146818rtc.h new file mode 100644 index 000000000000..11442095a8cf --- /dev/null +++ b/include/asm-m68k/mc146818rtc.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * Machine dependent access functions for RTC registers. | ||
3 | */ | ||
4 | #ifndef _ASM_MC146818RTC_H | ||
5 | #define _ASM_MC146818RTC_H | ||
6 | |||
7 | #include <linux/config.h> | ||
8 | |||
9 | #ifdef CONFIG_ATARI | ||
10 | /* RTC in Atari machines */ | ||
11 | |||
12 | #include <asm/atarihw.h> | ||
13 | |||
14 | #define RTC_PORT(x) (TT_RTC_BAS + 2*(x)) | ||
15 | |||
16 | #define CMOS_READ(addr) ({ \ | ||
17 | atari_outb_p((addr),RTC_PORT(0)); \ | ||
18 | atari_inb_p(RTC_PORT(1)); \ | ||
19 | }) | ||
20 | #define CMOS_WRITE(val, addr) ({ \ | ||
21 | atari_outb_p((addr),RTC_PORT(0)); \ | ||
22 | atari_outb_p((val),RTC_PORT(1)); \ | ||
23 | }) | ||
24 | #endif /* CONFIG_ATARI */ | ||
25 | |||
26 | #endif /* _ASM_MC146818RTC_H */ | ||
diff --git a/include/asm-m68k/md.h b/include/asm-m68k/md.h new file mode 100644 index 000000000000..467ea08383e4 --- /dev/null +++ b/include/asm-m68k/md.h | |||
@@ -0,0 +1,13 @@ | |||
1 | /* $Id: md.h,v 1.1 1997/12/15 15:12:04 jj Exp $ | ||
2 | * md.h: High speed xor_block operation for RAID4/5 | ||
3 | * | ||
4 | */ | ||
5 | |||
6 | #ifndef __ASM_MD_H | ||
7 | #define __ASM_MD_H | ||
8 | |||
9 | /* #define HAVE_ARCH_XORBLOCK */ | ||
10 | |||
11 | #define MD_XORBLOCK_ALIGNMENT sizeof(long) | ||
12 | |||
13 | #endif /* __ASM_MD_H */ | ||
diff --git a/include/asm-m68k/mman.h b/include/asm-m68k/mman.h new file mode 100644 index 000000000000..f831c4eeae6e --- /dev/null +++ b/include/asm-m68k/mman.h | |||
@@ -0,0 +1,43 @@ | |||
1 | #ifndef __M68K_MMAN_H__ | ||
2 | #define __M68K_MMAN_H__ | ||
3 | |||
4 | #define PROT_READ 0x1 /* page can be read */ | ||
5 | #define PROT_WRITE 0x2 /* page can be written */ | ||
6 | #define PROT_EXEC 0x4 /* page can be executed */ | ||
7 | #define PROT_SEM 0x8 /* page may be used for atomic ops */ | ||
8 | #define PROT_NONE 0x0 /* page can not be accessed */ | ||
9 | #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ | ||
10 | #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ | ||
11 | |||
12 | #define MAP_SHARED 0x01 /* Share changes */ | ||
13 | #define MAP_PRIVATE 0x02 /* Changes are private */ | ||
14 | #define MAP_TYPE 0x0f /* Mask for type of mapping */ | ||
15 | #define MAP_FIXED 0x10 /* Interpret addr exactly */ | ||
16 | #define MAP_ANONYMOUS 0x20 /* don't use a file */ | ||
17 | |||
18 | #define MAP_GROWSDOWN 0x0100 /* stack-like segment */ | ||
19 | #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ | ||
20 | #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ | ||
21 | #define MAP_LOCKED 0x2000 /* pages are locked */ | ||
22 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ | ||
23 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | ||
24 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | ||
25 | |||
26 | #define MS_ASYNC 1 /* sync memory asynchronously */ | ||
27 | #define MS_INVALIDATE 2 /* invalidate the caches */ | ||
28 | #define MS_SYNC 4 /* synchronous memory sync */ | ||
29 | |||
30 | #define MCL_CURRENT 1 /* lock all current mappings */ | ||
31 | #define MCL_FUTURE 2 /* lock all future mappings */ | ||
32 | |||
33 | #define MADV_NORMAL 0x0 /* default page-in behavior */ | ||
34 | #define MADV_RANDOM 0x1 /* page-in minimum required */ | ||
35 | #define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ | ||
36 | #define MADV_WILLNEED 0x3 /* pre-fault pages */ | ||
37 | #define MADV_DONTNEED 0x4 /* discard these pages */ | ||
38 | |||
39 | /* compatibility flags */ | ||
40 | #define MAP_ANON MAP_ANONYMOUS | ||
41 | #define MAP_FILE 0 | ||
42 | |||
43 | #endif /* __M68K_MMAN_H__ */ | ||
diff --git a/include/asm-m68k/mmu.h b/include/asm-m68k/mmu.h new file mode 100644 index 000000000000..ccd36d26615a --- /dev/null +++ b/include/asm-m68k/mmu.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __MMU_H | ||
2 | #define __MMU_H | ||
3 | |||
4 | /* Default "unsigned long" context */ | ||
5 | typedef unsigned long mm_context_t; | ||
6 | |||
7 | #endif | ||
diff --git a/include/asm-m68k/mmu_context.h b/include/asm-m68k/mmu_context.h new file mode 100644 index 000000000000..661191d15c81 --- /dev/null +++ b/include/asm-m68k/mmu_context.h | |||
@@ -0,0 +1,154 @@ | |||
1 | #ifndef __M68K_MMU_CONTEXT_H | ||
2 | #define __M68K_MMU_CONTEXT_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | |||
6 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | ||
7 | { | ||
8 | } | ||
9 | |||
10 | #ifndef CONFIG_SUN3 | ||
11 | |||
12 | #include <asm/setup.h> | ||
13 | #include <asm/page.h> | ||
14 | #include <asm/pgalloc.h> | ||
15 | |||
16 | static inline int init_new_context(struct task_struct *tsk, | ||
17 | struct mm_struct *mm) | ||
18 | { | ||
19 | mm->context = virt_to_phys(mm->pgd); | ||
20 | return 0; | ||
21 | } | ||
22 | |||
23 | #define destroy_context(mm) do { } while(0) | ||
24 | |||
25 | static inline void switch_mm_0230(struct mm_struct *mm) | ||
26 | { | ||
27 | unsigned long crp[2] = { | ||
28 | 0x80000000 | _PAGE_TABLE, mm->context | ||
29 | }; | ||
30 | unsigned long tmp; | ||
31 | |||
32 | asm volatile (".chip 68030"); | ||
33 | |||
34 | /* flush MC68030/MC68020 caches (they are virtually addressed) */ | ||
35 | asm volatile ( | ||
36 | "movec %%cacr,%0;" | ||
37 | "orw %1,%0; " | ||
38 | "movec %0,%%cacr" | ||
39 | : "=d" (tmp) : "di" (FLUSH_I_AND_D)); | ||
40 | |||
41 | /* Switch the root pointer. For a 030-only kernel, | ||
42 | * avoid flushing the whole ATC, we only need to | ||
43 | * flush the user entries. The 68851 does this by | ||
44 | * itself. Avoid a runtime check here. | ||
45 | */ | ||
46 | asm volatile ( | ||
47 | #ifdef CPU_M68030_ONLY | ||
48 | "pmovefd %0,%%crp; " | ||
49 | "pflush #0,#4" | ||
50 | #else | ||
51 | "pmove %0,%%crp" | ||
52 | #endif | ||
53 | : : "m" (crp[0])); | ||
54 | |||
55 | asm volatile (".chip 68k"); | ||
56 | } | ||
57 | |||
58 | static inline void switch_mm_0460(struct mm_struct *mm) | ||
59 | { | ||
60 | asm volatile (".chip 68040"); | ||
61 | |||
62 | /* flush address translation cache (user entries) */ | ||
63 | asm volatile ("pflushan"); | ||
64 | |||
65 | /* switch the root pointer */ | ||
66 | asm volatile ("movec %0,%%urp" : : "r" (mm->context)); | ||
67 | |||
68 | if (CPU_IS_060) { | ||
69 | unsigned long tmp; | ||
70 | |||
71 | /* clear user entries in the branch cache */ | ||
72 | asm volatile ( | ||
73 | "movec %%cacr,%0; " | ||
74 | "orl %1,%0; " | ||
75 | "movec %0,%%cacr" | ||
76 | : "=d" (tmp): "di" (0x00200000)); | ||
77 | } | ||
78 | |||
79 | asm volatile (".chip 68k"); | ||
80 | } | ||
81 | |||
82 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk) | ||
83 | { | ||
84 | if (prev != next) { | ||
85 | if (CPU_IS_020_OR_030) | ||
86 | switch_mm_0230(next); | ||
87 | else | ||
88 | switch_mm_0460(next); | ||
89 | } | ||
90 | } | ||
91 | |||
92 | #define deactivate_mm(tsk,mm) do { } while (0) | ||
93 | |||
94 | static inline void activate_mm(struct mm_struct *prev_mm, | ||
95 | struct mm_struct *next_mm) | ||
96 | { | ||
97 | next_mm->context = virt_to_phys(next_mm->pgd); | ||
98 | |||
99 | if (CPU_IS_020_OR_030) | ||
100 | switch_mm_0230(next_mm); | ||
101 | else | ||
102 | switch_mm_0460(next_mm); | ||
103 | } | ||
104 | |||
105 | #else /* CONFIG_SUN3 */ | ||
106 | #include <asm/sun3mmu.h> | ||
107 | #include <linux/sched.h> | ||
108 | |||
109 | extern unsigned long get_free_context(struct mm_struct *mm); | ||
110 | extern void clear_context(unsigned long context); | ||
111 | |||
112 | /* set the context for a new task to unmapped */ | ||
113 | static inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm) | ||
114 | { | ||
115 | mm->context = SUN3_INVALID_CONTEXT; | ||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | /* find the context given to this process, and if it hasn't already | ||
120 | got one, go get one for it. */ | ||
121 | static inline void get_mmu_context(struct mm_struct *mm) | ||
122 | { | ||
123 | if(mm->context == SUN3_INVALID_CONTEXT) | ||
124 | mm->context = get_free_context(mm); | ||
125 | } | ||
126 | |||
127 | /* flush context if allocated... */ | ||
128 | static inline void destroy_context(struct mm_struct *mm) | ||
129 | { | ||
130 | if(mm->context != SUN3_INVALID_CONTEXT) | ||
131 | clear_context(mm->context); | ||
132 | } | ||
133 | |||
134 | static inline void activate_context(struct mm_struct *mm) | ||
135 | { | ||
136 | get_mmu_context(mm); | ||
137 | sun3_put_context(mm->context); | ||
138 | } | ||
139 | |||
140 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk) | ||
141 | { | ||
142 | activate_context(tsk->mm); | ||
143 | } | ||
144 | |||
145 | #define deactivate_mm(tsk,mm) do { } while (0) | ||
146 | |||
147 | static inline void activate_mm(struct mm_struct *prev_mm, | ||
148 | struct mm_struct *next_mm) | ||
149 | { | ||
150 | activate_context(next_mm); | ||
151 | } | ||
152 | |||
153 | #endif | ||
154 | #endif | ||
diff --git a/include/asm-m68k/module.h b/include/asm-m68k/module.h new file mode 100644 index 000000000000..c6d75af2d8d3 --- /dev/null +++ b/include/asm-m68k/module.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef _ASM_M68K_MODULE_H | ||
2 | #define _ASM_M68K_MODULE_H | ||
3 | struct mod_arch_specific { }; | ||
4 | #define Elf_Shdr Elf32_Shdr | ||
5 | #define Elf_Sym Elf32_Sym | ||
6 | #define Elf_Ehdr Elf32_Ehdr | ||
7 | #endif /* _ASM_M68K_MODULE_H */ | ||
diff --git a/include/asm-m68k/motorola_pgalloc.h b/include/asm-m68k/motorola_pgalloc.h new file mode 100644 index 000000000000..5158412cd54d --- /dev/null +++ b/include/asm-m68k/motorola_pgalloc.h | |||
@@ -0,0 +1,107 @@ | |||
1 | #ifndef _MOTOROLA_PGALLOC_H | ||
2 | #define _MOTOROLA_PGALLOC_H | ||
3 | |||
4 | #include <asm/tlb.h> | ||
5 | #include <asm/tlbflush.h> | ||
6 | |||
7 | extern pmd_t *get_pointer_table(void); | ||
8 | extern int free_pointer_table(pmd_t *); | ||
9 | |||
10 | |||
11 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) | ||
12 | { | ||
13 | pte_t *pte; | ||
14 | |||
15 | pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); | ||
16 | if (pte) { | ||
17 | __flush_page_to_ram(pte); | ||
18 | flush_tlb_kernel_page(pte); | ||
19 | nocache_page(pte); | ||
20 | } | ||
21 | |||
22 | return pte; | ||
23 | } | ||
24 | |||
25 | static inline void pte_free_kernel(pte_t *pte) | ||
26 | { | ||
27 | cache_page(pte); | ||
28 | free_page((unsigned long) pte); | ||
29 | } | ||
30 | |||
31 | static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) | ||
32 | { | ||
33 | struct page *page = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); | ||
34 | pte_t *pte; | ||
35 | |||
36 | if(!page) | ||
37 | return NULL; | ||
38 | |||
39 | pte = kmap(page); | ||
40 | if (pte) { | ||
41 | __flush_page_to_ram(pte); | ||
42 | flush_tlb_kernel_page(pte); | ||
43 | nocache_page(pte); | ||
44 | } | ||
45 | kunmap(pte); | ||
46 | |||
47 | return page; | ||
48 | } | ||
49 | |||
50 | static inline void pte_free(struct page *page) | ||
51 | { | ||
52 | cache_page(kmap(page)); | ||
53 | kunmap(page); | ||
54 | __free_page(page); | ||
55 | } | ||
56 | |||
57 | static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *page) | ||
58 | { | ||
59 | cache_page(kmap(page)); | ||
60 | kunmap(page); | ||
61 | __free_page(page); | ||
62 | } | ||
63 | |||
64 | |||
65 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) | ||
66 | { | ||
67 | return get_pointer_table(); | ||
68 | } | ||
69 | |||
70 | static inline int pmd_free(pmd_t *pmd) | ||
71 | { | ||
72 | return free_pointer_table(pmd); | ||
73 | } | ||
74 | |||
75 | static inline int __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) | ||
76 | { | ||
77 | return free_pointer_table(pmd); | ||
78 | } | ||
79 | |||
80 | |||
81 | static inline void pgd_free(pgd_t *pgd) | ||
82 | { | ||
83 | pmd_free((pmd_t *)pgd); | ||
84 | } | ||
85 | |||
86 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) | ||
87 | { | ||
88 | return (pgd_t *)get_pointer_table(); | ||
89 | } | ||
90 | |||
91 | |||
92 | static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) | ||
93 | { | ||
94 | pmd_set(pmd, pte); | ||
95 | } | ||
96 | |||
97 | static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page) | ||
98 | { | ||
99 | pmd_set(pmd, page_address(page)); | ||
100 | } | ||
101 | |||
102 | static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd) | ||
103 | { | ||
104 | pgd_set(pgd, pmd); | ||
105 | } | ||
106 | |||
107 | #endif /* _MOTOROLA_PGALLOC_H */ | ||
diff --git a/include/asm-m68k/motorola_pgtable.h b/include/asm-m68k/motorola_pgtable.h new file mode 100644 index 000000000000..1628723458f5 --- /dev/null +++ b/include/asm-m68k/motorola_pgtable.h | |||
@@ -0,0 +1,294 @@ | |||
1 | #ifndef _MOTOROLA_PGTABLE_H | ||
2 | #define _MOTOROLA_PGTABLE_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | |||
6 | /* | ||
7 | * Definitions for MMU descriptors | ||
8 | */ | ||
9 | #define _PAGE_PRESENT 0x001 | ||
10 | #define _PAGE_SHORT 0x002 | ||
11 | #define _PAGE_RONLY 0x004 | ||
12 | #define _PAGE_ACCESSED 0x008 | ||
13 | #define _PAGE_DIRTY 0x010 | ||
14 | #define _PAGE_SUPER 0x080 /* 68040 supervisor only */ | ||
15 | #define _PAGE_GLOBAL040 0x400 /* 68040 global bit, used for kva descs */ | ||
16 | #define _PAGE_NOCACHE030 0x040 /* 68030 no-cache mode */ | ||
17 | #define _PAGE_NOCACHE 0x060 /* 68040 cache mode, non-serialized */ | ||
18 | #define _PAGE_NOCACHE_S 0x040 /* 68040 no-cache mode, serialized */ | ||
19 | #define _PAGE_CACHE040 0x020 /* 68040 cache mode, cachable, copyback */ | ||
20 | #define _PAGE_CACHE040W 0x000 /* 68040 cache mode, cachable, write-through */ | ||
21 | |||
22 | #define _DESCTYPE_MASK 0x003 | ||
23 | |||
24 | #define _CACHEMASK040 (~0x060) | ||
25 | #define _TABLE_MASK (0xfffffe00) | ||
26 | |||
27 | #define _PAGE_TABLE (_PAGE_SHORT) | ||
28 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_NOCACHE) | ||
29 | |||
30 | #define _PAGE_PROTNONE 0x004 | ||
31 | #define _PAGE_FILE 0x008 /* pagecache or swap? */ | ||
32 | |||
33 | #ifndef __ASSEMBLY__ | ||
34 | |||
35 | /* This is the cache mode to be used for pages containing page descriptors for | ||
36 | * processors >= '040. It is in pte_mknocache(), and the variable is defined | ||
37 | * and initialized in head.S */ | ||
38 | extern int m68k_pgtable_cachemode; | ||
39 | |||
40 | /* This is the cache mode for normal pages, for supervisor access on | ||
41 | * processors >= '040. It is used in pte_mkcache(), and the variable is | ||
42 | * defined and initialized in head.S */ | ||
43 | |||
44 | #if defined(CPU_M68060_ONLY) && defined(CONFIG_060_WRITETHROUGH) | ||
45 | #define m68k_supervisor_cachemode _PAGE_CACHE040W | ||
46 | #elif defined(CPU_M68040_OR_M68060_ONLY) | ||
47 | #define m68k_supervisor_cachemode _PAGE_CACHE040 | ||
48 | #elif defined(CPU_M68020_OR_M68030_ONLY) | ||
49 | #define m68k_supervisor_cachemode 0 | ||
50 | #else | ||
51 | extern int m68k_supervisor_cachemode; | ||
52 | #endif | ||
53 | |||
54 | #if defined(CPU_M68040_OR_M68060_ONLY) | ||
55 | #define mm_cachebits _PAGE_CACHE040 | ||
56 | #elif defined(CPU_M68020_OR_M68030_ONLY) | ||
57 | #define mm_cachebits 0 | ||
58 | #else | ||
59 | extern unsigned long mm_cachebits; | ||
60 | #endif | ||
61 | |||
62 | #define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED | mm_cachebits) | ||
63 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | mm_cachebits) | ||
64 | #define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED | mm_cachebits) | ||
65 | #define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED | mm_cachebits) | ||
66 | #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_DIRTY | _PAGE_ACCESSED | mm_cachebits) | ||
67 | |||
68 | /* Alternate definitions that are compile time constants, for | ||
69 | initializing protection_map. The cachebits are fixed later. */ | ||
70 | #define PAGE_NONE_C __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED) | ||
71 | #define PAGE_SHARED_C __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED) | ||
72 | #define PAGE_COPY_C __pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED) | ||
73 | #define PAGE_READONLY_C __pgprot(_PAGE_PRESENT | _PAGE_RONLY | _PAGE_ACCESSED) | ||
74 | |||
75 | /* | ||
76 | * The m68k can't do page protection for execute, and considers that the same are read. | ||
77 | * Also, write permissions imply read permissions. This is the closest we can get.. | ||
78 | */ | ||
79 | #define __P000 PAGE_NONE_C | ||
80 | #define __P001 PAGE_READONLY_C | ||
81 | #define __P010 PAGE_COPY_C | ||
82 | #define __P011 PAGE_COPY_C | ||
83 | #define __P100 PAGE_READONLY_C | ||
84 | #define __P101 PAGE_READONLY_C | ||
85 | #define __P110 PAGE_COPY_C | ||
86 | #define __P111 PAGE_COPY_C | ||
87 | |||
88 | #define __S000 PAGE_NONE_C | ||
89 | #define __S001 PAGE_READONLY_C | ||
90 | #define __S010 PAGE_SHARED_C | ||
91 | #define __S011 PAGE_SHARED_C | ||
92 | #define __S100 PAGE_READONLY_C | ||
93 | #define __S101 PAGE_READONLY_C | ||
94 | #define __S110 PAGE_SHARED_C | ||
95 | #define __S111 PAGE_SHARED_C | ||
96 | |||
97 | /* | ||
98 | * Conversion functions: convert a page and protection to a page entry, | ||
99 | * and a page entry and page directory to the page they refer to. | ||
100 | */ | ||
101 | #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) | ||
102 | |||
103 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | ||
104 | { | ||
105 | pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); | ||
106 | return pte; | ||
107 | } | ||
108 | |||
109 | static inline void pmd_set(pmd_t *pmdp, pte_t *ptep) | ||
110 | { | ||
111 | unsigned long ptbl = virt_to_phys(ptep) | _PAGE_TABLE | _PAGE_ACCESSED; | ||
112 | unsigned long *ptr = pmdp->pmd; | ||
113 | short i = 16; | ||
114 | while (--i >= 0) { | ||
115 | *ptr++ = ptbl; | ||
116 | ptbl += (sizeof(pte_t)*PTRS_PER_PTE/16); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp) | ||
121 | { | ||
122 | pgd_val(*pgdp) = _PAGE_TABLE | _PAGE_ACCESSED | __pa(pmdp); | ||
123 | } | ||
124 | |||
125 | #define __pte_page(pte) ((unsigned long)__va(pte_val(pte) & PAGE_MASK)) | ||
126 | #define __pmd_page(pmd) ((unsigned long)__va(pmd_val(pmd) & _TABLE_MASK)) | ||
127 | #define __pgd_page(pgd) ((unsigned long)__va(pgd_val(pgd) & _TABLE_MASK)) | ||
128 | |||
129 | |||
130 | #define pte_none(pte) (!pte_val(pte)) | ||
131 | #define pte_present(pte) (pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROTNONE)) | ||
132 | #define pte_clear(mm,addr,ptep) ({ pte_val(*(ptep)) = 0; }) | ||
133 | |||
134 | #define pte_page(pte) (mem_map + ((unsigned long)(__va(pte_val(pte)) - PAGE_OFFSET) >> PAGE_SHIFT)) | ||
135 | #define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) | ||
136 | #define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) | ||
137 | |||
138 | #define pmd_none(pmd) (!pmd_val(pmd)) | ||
139 | #define pmd_bad(pmd) ((pmd_val(pmd) & _DESCTYPE_MASK) != _PAGE_TABLE) | ||
140 | #define pmd_present(pmd) (pmd_val(pmd) & _PAGE_TABLE) | ||
141 | #define pmd_clear(pmdp) ({ \ | ||
142 | unsigned long *__ptr = pmdp->pmd; \ | ||
143 | short __i = 16; \ | ||
144 | while (--__i >= 0) \ | ||
145 | *__ptr++ = 0; \ | ||
146 | }) | ||
147 | #define pmd_page(pmd) (mem_map + ((unsigned long)(__va(pmd_val(pmd)) - PAGE_OFFSET) >> PAGE_SHIFT)) | ||
148 | |||
149 | |||
150 | #define pgd_none(pgd) (!pgd_val(pgd)) | ||
151 | #define pgd_bad(pgd) ((pgd_val(pgd) & _DESCTYPE_MASK) != _PAGE_TABLE) | ||
152 | #define pgd_present(pgd) (pgd_val(pgd) & _PAGE_TABLE) | ||
153 | #define pgd_clear(pgdp) ({ pgd_val(*pgdp) = 0; }) | ||
154 | |||
155 | #define pte_ERROR(e) \ | ||
156 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) | ||
157 | #define pmd_ERROR(e) \ | ||
158 | printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) | ||
159 | #define pgd_ERROR(e) \ | ||
160 | printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) | ||
161 | |||
162 | |||
163 | /* | ||
164 | * The following only work if pte_present() is true. | ||
165 | * Undefined behaviour if not.. | ||
166 | */ | ||
167 | static inline int pte_read(pte_t pte) { return 1; } | ||
168 | static inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_RONLY); } | ||
169 | static inline int pte_exec(pte_t pte) { return 1; } | ||
170 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } | ||
171 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | ||
172 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | ||
173 | |||
174 | static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_RONLY; return pte; } | ||
175 | static inline pte_t pte_rdprotect(pte_t pte) { return pte; } | ||
176 | static inline pte_t pte_exprotect(pte_t pte) { return pte; } | ||
177 | static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } | ||
178 | static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } | ||
179 | static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_RONLY; return pte; } | ||
180 | static inline pte_t pte_mkread(pte_t pte) { return pte; } | ||
181 | static inline pte_t pte_mkexec(pte_t pte) { return pte; } | ||
182 | static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } | ||
183 | static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } | ||
184 | static inline pte_t pte_mknocache(pte_t pte) | ||
185 | { | ||
186 | pte_val(pte) = (pte_val(pte) & _CACHEMASK040) | m68k_pgtable_cachemode; | ||
187 | return pte; | ||
188 | } | ||
189 | static inline pte_t pte_mkcache(pte_t pte) | ||
190 | { | ||
191 | pte_val(pte) = (pte_val(pte) & _CACHEMASK040) | m68k_supervisor_cachemode; | ||
192 | return pte; | ||
193 | } | ||
194 | |||
195 | #define PAGE_DIR_OFFSET(tsk,address) pgd_offset((tsk),(address)) | ||
196 | |||
197 | #define pgd_index(address) ((address) >> PGDIR_SHIFT) | ||
198 | |||
199 | /* to find an entry in a page-table-directory */ | ||
200 | static inline pgd_t *pgd_offset(struct mm_struct *mm, unsigned long address) | ||
201 | { | ||
202 | return mm->pgd + pgd_index(address); | ||
203 | } | ||
204 | |||
205 | #define swapper_pg_dir kernel_pg_dir | ||
206 | extern pgd_t kernel_pg_dir[128]; | ||
207 | |||
208 | static inline pgd_t *pgd_offset_k(unsigned long address) | ||
209 | { | ||
210 | return kernel_pg_dir + (address >> PGDIR_SHIFT); | ||
211 | } | ||
212 | |||
213 | |||
214 | /* Find an entry in the second-level page table.. */ | ||
215 | static inline pmd_t *pmd_offset(pgd_t *dir, unsigned long address) | ||
216 | { | ||
217 | return (pmd_t *)__pgd_page(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PMD-1)); | ||
218 | } | ||
219 | |||
220 | /* Find an entry in the third-level page table.. */ | ||
221 | static inline pte_t *pte_offset_kernel(pmd_t *pmdp, unsigned long address) | ||
222 | { | ||
223 | return (pte_t *)__pmd_page(*pmdp) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); | ||
224 | } | ||
225 | |||
226 | #define pte_offset_map(pmdp,address) ((pte_t *)kmap(pmd_page(*pmdp)) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) | ||
227 | #define pte_offset_map_nested(pmdp, address) pte_offset_map(pmdp, address) | ||
228 | #define pte_unmap(pte) kunmap(pte) | ||
229 | #define pte_unmap_nested(pte) kunmap(pte) | ||
230 | |||
231 | /* | ||
232 | * Allocate and free page tables. The xxx_kernel() versions are | ||
233 | * used to allocate a kernel page table - this turns on ASN bits | ||
234 | * if any. | ||
235 | */ | ||
236 | |||
237 | /* Prior to calling these routines, the page should have been flushed | ||
238 | * from both the cache and ATC, or the CPU might not notice that the | ||
239 | * cache setting for the page has been changed. -jskov | ||
240 | */ | ||
241 | static inline void nocache_page(void *vaddr) | ||
242 | { | ||
243 | unsigned long addr = (unsigned long)vaddr; | ||
244 | |||
245 | if (CPU_IS_040_OR_060) { | ||
246 | pgd_t *dir; | ||
247 | pmd_t *pmdp; | ||
248 | pte_t *ptep; | ||
249 | |||
250 | dir = pgd_offset_k(addr); | ||
251 | pmdp = pmd_offset(dir, addr); | ||
252 | ptep = pte_offset_kernel(pmdp, addr); | ||
253 | *ptep = pte_mknocache(*ptep); | ||
254 | } | ||
255 | } | ||
256 | |||
257 | static inline void cache_page(void *vaddr) | ||
258 | { | ||
259 | unsigned long addr = (unsigned long)vaddr; | ||
260 | |||
261 | if (CPU_IS_040_OR_060) { | ||
262 | pgd_t *dir; | ||
263 | pmd_t *pmdp; | ||
264 | pte_t *ptep; | ||
265 | |||
266 | dir = pgd_offset_k(addr); | ||
267 | pmdp = pmd_offset(dir, addr); | ||
268 | ptep = pte_offset_kernel(pmdp, addr); | ||
269 | *ptep = pte_mkcache(*ptep); | ||
270 | } | ||
271 | } | ||
272 | |||
273 | #define PTE_FILE_MAX_BITS 28 | ||
274 | |||
275 | static inline unsigned long pte_to_pgoff(pte_t pte) | ||
276 | { | ||
277 | return pte.pte >> 4; | ||
278 | } | ||
279 | |||
280 | static inline pte_t pgoff_to_pte(unsigned off) | ||
281 | { | ||
282 | pte_t pte = { (off << 4) + _PAGE_FILE }; | ||
283 | return pte; | ||
284 | } | ||
285 | |||
286 | /* Encode and de-code a swap entry (must be !pte_none(e) && !pte_present(e)) */ | ||
287 | #define __swp_type(x) (((x).val >> 4) & 0xff) | ||
288 | #define __swp_offset(x) ((x).val >> 12) | ||
289 | #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 4) | ((offset) << 12) }) | ||
290 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) | ||
291 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | ||
292 | |||
293 | #endif /* !__ASSEMBLY__ */ | ||
294 | #endif /* _MOTOROLA_PGTABLE_H */ | ||
diff --git a/include/asm-m68k/movs.h b/include/asm-m68k/movs.h new file mode 100644 index 000000000000..67dbea36960f --- /dev/null +++ b/include/asm-m68k/movs.h | |||
@@ -0,0 +1,55 @@ | |||
1 | #ifndef __MOVS_H__ | ||
2 | #define __MOVS_H__ | ||
3 | |||
4 | /* | ||
5 | ** movs.h | ||
6 | ** | ||
7 | ** Inline assembly macros to generate movs & related instructions | ||
8 | */ | ||
9 | |||
10 | /* Set DFC register value */ | ||
11 | |||
12 | #define SET_DFC(x) \ | ||
13 | __asm__ __volatile__ (" movec %0,%/dfc" : : "d" (x)); | ||
14 | |||
15 | /* Get DFC register value */ | ||
16 | |||
17 | #define GET_DFC(x) \ | ||
18 | __asm__ __volatile__ (" movec %/dfc, %0" : "=d" (x) : ); | ||
19 | |||
20 | /* Set SFC register value */ | ||
21 | |||
22 | #define SET_SFC(x) \ | ||
23 | __asm__ __volatile__ (" movec %0,%/sfc" : : "d" (x)); | ||
24 | |||
25 | /* Get SFC register value */ | ||
26 | |||
27 | #define GET_SFC(x) \ | ||
28 | __asm__ __volatile__ (" movec %/sfc, %0" : "=d" (x) : ); | ||
29 | |||
30 | #define SET_VBR(x) \ | ||
31 | __asm__ __volatile__ (" movec %0,%/vbr" : : "r" (x)); | ||
32 | |||
33 | #define GET_VBR(x) \ | ||
34 | __asm__ __volatile__ (" movec %/vbr, %0" : "=g" (x) : ); | ||
35 | |||
36 | /* Set a byte using the "movs" instruction */ | ||
37 | |||
38 | #define SET_CONTROL_BYTE(addr,value) \ | ||
39 | __asm__ __volatile__ (" movsb %0, %1@" : : "d" (value), "a" (addr)); | ||
40 | |||
41 | /* Get a byte using the "movs" instruction */ | ||
42 | |||
43 | #define GET_CONTROL_BYTE(addr,value) \ | ||
44 | __asm__ __volatile__ (" movsb %1@, %0" : "=d" (value) : "a" (addr)); | ||
45 | |||
46 | /* Set a (long)word using the "movs" instruction */ | ||
47 | |||
48 | #define SET_CONTROL_WORD(addr,value) \ | ||
49 | __asm__ __volatile__ (" movsl %0, %1@" : : "d" (value), "a" (addr)); | ||
50 | |||
51 | /* Get a (long)word using the "movs" instruction */ | ||
52 | |||
53 | #define GET_CONTROL_WORD(addr,value) \ | ||
54 | __asm__ __volatile__ (" movsl %1@, %0" : "=d" (value) : "a" (addr)); | ||
55 | #endif | ||
diff --git a/include/asm-m68k/msgbuf.h b/include/asm-m68k/msgbuf.h new file mode 100644 index 000000000000..243cb798de8f --- /dev/null +++ b/include/asm-m68k/msgbuf.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef _M68K_MSGBUF_H | ||
2 | #define _M68K_MSGBUF_H | ||
3 | |||
4 | /* | ||
5 | * The msqid64_ds structure for m68k architecture. | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 64-bit time_t to solve y2038 problem | ||
11 | * - 2 miscellaneous 32-bit values | ||
12 | */ | ||
13 | |||
14 | struct msqid64_ds { | ||
15 | struct ipc64_perm msg_perm; | ||
16 | __kernel_time_t msg_stime; /* last msgsnd time */ | ||
17 | unsigned long __unused1; | ||
18 | __kernel_time_t msg_rtime; /* last msgrcv time */ | ||
19 | unsigned long __unused2; | ||
20 | __kernel_time_t msg_ctime; /* last change time */ | ||
21 | unsigned long __unused3; | ||
22 | unsigned long msg_cbytes; /* current number of bytes on queue */ | ||
23 | unsigned long msg_qnum; /* number of messages in queue */ | ||
24 | unsigned long msg_qbytes; /* max number of bytes on queue */ | ||
25 | __kernel_pid_t msg_lspid; /* pid of last msgsnd */ | ||
26 | __kernel_pid_t msg_lrpid; /* last receive pid */ | ||
27 | unsigned long __unused4; | ||
28 | unsigned long __unused5; | ||
29 | }; | ||
30 | |||
31 | #endif /* _M68K_MSGBUF_H */ | ||
diff --git a/include/asm-m68k/mvme147hw.h b/include/asm-m68k/mvme147hw.h new file mode 100644 index 000000000000..f245139f3671 --- /dev/null +++ b/include/asm-m68k/mvme147hw.h | |||
@@ -0,0 +1,111 @@ | |||
1 | #ifndef _MVME147HW_H_ | ||
2 | #define _MVME147HW_H_ | ||
3 | |||
4 | typedef struct { | ||
5 | unsigned char | ||
6 | ctrl, | ||
7 | bcd_sec, | ||
8 | bcd_min, | ||
9 | bcd_hr, | ||
10 | bcd_dow, | ||
11 | bcd_dom, | ||
12 | bcd_mth, | ||
13 | bcd_year; | ||
14 | } MK48T02; | ||
15 | |||
16 | #define RTC_WRITE 0x80 | ||
17 | #define RTC_READ 0x40 | ||
18 | #define RTC_STOP 0x20 | ||
19 | |||
20 | #define m147_rtc ((MK48T02 * volatile)0xfffe07f8) | ||
21 | |||
22 | |||
23 | struct pcc_regs { | ||
24 | volatile u_long dma_tadr; | ||
25 | volatile u_long dma_dadr; | ||
26 | volatile u_long dma_bcr; | ||
27 | volatile u_long dma_hr; | ||
28 | volatile u_short t1_preload; | ||
29 | volatile u_short t1_count; | ||
30 | volatile u_short t2_preload; | ||
31 | volatile u_short t2_count; | ||
32 | volatile u_char t1_int_cntrl; | ||
33 | volatile u_char t1_cntrl; | ||
34 | volatile u_char t2_int_cntrl; | ||
35 | volatile u_char t2_cntrl; | ||
36 | volatile u_char ac_fail; | ||
37 | volatile u_char watchdog; | ||
38 | volatile u_char lpt_intr; | ||
39 | volatile u_char lpt_cntrl; | ||
40 | volatile u_char dma_intr; | ||
41 | volatile u_char dma_cntrl; | ||
42 | volatile u_char bus_error; | ||
43 | volatile u_char dma_status; | ||
44 | volatile u_char abort; | ||
45 | volatile u_char ta_fnctl; | ||
46 | volatile u_char serial_cntrl; | ||
47 | volatile u_char general_cntrl; | ||
48 | volatile u_char lan_cntrl; | ||
49 | volatile u_char general_status; | ||
50 | volatile u_char scsi_interrupt; | ||
51 | volatile u_char slave; | ||
52 | volatile u_char soft1_cntrl; | ||
53 | volatile u_char int_base; | ||
54 | volatile u_char soft2_cntrl; | ||
55 | volatile u_char revision_level; | ||
56 | volatile u_char lpt_data; | ||
57 | volatile u_char lpt_status; | ||
58 | }; | ||
59 | |||
60 | #define m147_pcc ((struct pcc_regs * volatile)0xfffe1000) | ||
61 | |||
62 | |||
63 | #define PCC_INT_ENAB 0x08 | ||
64 | |||
65 | #define PCC_TIMER_INT_CLR 0x80 | ||
66 | #define PCC_TIMER_PRELOAD 63936l | ||
67 | |||
68 | #define PCC_LEVEL_ABORT 0x07 | ||
69 | #define PCC_LEVEL_SERIAL 0x04 | ||
70 | #define PCC_LEVEL_ETH 0x04 | ||
71 | #define PCC_LEVEL_TIMER1 0x04 | ||
72 | #define PCC_LEVEL_SCSI_PORT 0x04 | ||
73 | #define PCC_LEVEL_SCSI_DMA 0x04 | ||
74 | |||
75 | #define PCC_IRQ_AC_FAIL 0x40 | ||
76 | #define PCC_IRQ_BERR 0x41 | ||
77 | #define PCC_IRQ_ABORT 0x42 | ||
78 | /* #define PCC_IRQ_SERIAL 0x43 */ | ||
79 | #define PCC_IRQ_PRINTER 0x47 | ||
80 | #define PCC_IRQ_TIMER1 0x48 | ||
81 | #define PCC_IRQ_TIMER2 0x49 | ||
82 | #define PCC_IRQ_SOFTWARE1 0x4a | ||
83 | #define PCC_IRQ_SOFTWARE2 0x4b | ||
84 | |||
85 | |||
86 | #define M147_SCC_A_ADDR 0xfffe3002 | ||
87 | #define M147_SCC_B_ADDR 0xfffe3000 | ||
88 | #define M147_SCC_PCLK 5000000 | ||
89 | |||
90 | #define MVME147_IRQ_SCSI_PORT 0x45 | ||
91 | #define MVME147_IRQ_SCSI_DMA 0x46 | ||
92 | |||
93 | /* SCC interrupts, for MVME147 */ | ||
94 | |||
95 | #define MVME147_IRQ_TYPE_PRIO 0 | ||
96 | #define MVME147_IRQ_SCC_BASE 0x60 | ||
97 | #define MVME147_IRQ_SCCB_TX 0x60 | ||
98 | #define MVME147_IRQ_SCCB_STAT 0x62 | ||
99 | #define MVME147_IRQ_SCCB_RX 0x64 | ||
100 | #define MVME147_IRQ_SCCB_SPCOND 0x66 | ||
101 | #define MVME147_IRQ_SCCA_TX 0x68 | ||
102 | #define MVME147_IRQ_SCCA_STAT 0x6a | ||
103 | #define MVME147_IRQ_SCCA_RX 0x6c | ||
104 | #define MVME147_IRQ_SCCA_SPCOND 0x6e | ||
105 | |||
106 | #define MVME147_LANCE_BASE 0xfffe1800 | ||
107 | #define MVME147_LANCE_IRQ 0x44 | ||
108 | |||
109 | #define ETHERNET_ADDRESS 0xfffe0778 | ||
110 | |||
111 | #endif | ||
diff --git a/include/asm-m68k/mvme16xhw.h b/include/asm-m68k/mvme16xhw.h new file mode 100644 index 000000000000..5d07231d2426 --- /dev/null +++ b/include/asm-m68k/mvme16xhw.h | |||
@@ -0,0 +1,111 @@ | |||
1 | #ifndef _M68K_MVME16xHW_H_ | ||
2 | #define _M68K_MVME16xHW_H_ | ||
3 | |||
4 | #include <asm/irq.h> | ||
5 | |||
6 | /* Board ID data structure - pointer to this retrieved from Bug by head.S */ | ||
7 | |||
8 | /* Note, bytes 12 and 13 are board no in BCD (0162,0166,0167,0177,etc) */ | ||
9 | |||
10 | extern long mvme_bdid_ptr; | ||
11 | |||
12 | typedef struct { | ||
13 | char bdid[4]; | ||
14 | u_char rev, mth, day, yr; | ||
15 | u_short size, reserved; | ||
16 | u_short brdno; | ||
17 | char brdsuffix[2]; | ||
18 | u_long options; | ||
19 | u_short clun, dlun, ctype, dnum; | ||
20 | u_long option2; | ||
21 | } t_bdid, *p_bdid; | ||
22 | |||
23 | |||
24 | typedef struct { | ||
25 | u_char ack_icr, | ||
26 | flt_icr, | ||
27 | sel_icr, | ||
28 | pe_icr, | ||
29 | bsy_icr, | ||
30 | spare1, | ||
31 | isr, | ||
32 | cr, | ||
33 | spare2, | ||
34 | spare3, | ||
35 | spare4, | ||
36 | data; | ||
37 | } MVMElp, *MVMElpPtr; | ||
38 | |||
39 | #define MVME_LPR_BASE 0xfff42030 | ||
40 | |||
41 | #define mvmelp ((*(volatile MVMElpPtr)(MVME_LPR_BASE))) | ||
42 | |||
43 | typedef struct { | ||
44 | unsigned char | ||
45 | ctrl, | ||
46 | bcd_sec, | ||
47 | bcd_min, | ||
48 | bcd_hr, | ||
49 | bcd_dow, | ||
50 | bcd_dom, | ||
51 | bcd_mth, | ||
52 | bcd_year; | ||
53 | } MK48T08_t, *MK48T08ptr_t; | ||
54 | |||
55 | #define RTC_WRITE 0x80 | ||
56 | #define RTC_READ 0x40 | ||
57 | #define RTC_STOP 0x20 | ||
58 | |||
59 | #define MVME_RTC_BASE 0xfffc1ff8 | ||
60 | |||
61 | #define MVME_I596_BASE 0xfff46000 | ||
62 | |||
63 | #define MVME_SCC_A_ADDR 0xfff45005 | ||
64 | #define MVME_SCC_B_ADDR 0xfff45001 | ||
65 | #define MVME_SCC_PCLK 10000000 | ||
66 | |||
67 | #define MVME162_IRQ_TYPE_PRIO 0 | ||
68 | |||
69 | #define MVME167_IRQ_PRN 0x54 | ||
70 | #define MVME16x_IRQ_I596 0x57 | ||
71 | #define MVME16x_IRQ_SCSI 0x55 | ||
72 | #define MVME16x_IRQ_FLY 0x7f | ||
73 | #define MVME167_IRQ_SER_ERR 0x5c | ||
74 | #define MVME167_IRQ_SER_MODEM 0x5d | ||
75 | #define MVME167_IRQ_SER_TX 0x5e | ||
76 | #define MVME167_IRQ_SER_RX 0x5f | ||
77 | #define MVME16x_IRQ_TIMER 0x59 | ||
78 | #define MVME167_IRQ_ABORT 0x6e | ||
79 | #define MVME162_IRQ_ABORT 0x5e | ||
80 | |||
81 | /* SCC interrupts, for MVME162 */ | ||
82 | #define MVME162_IRQ_SCC_BASE 0x40 | ||
83 | #define MVME162_IRQ_SCCB_TX 0x40 | ||
84 | #define MVME162_IRQ_SCCB_STAT 0x42 | ||
85 | #define MVME162_IRQ_SCCB_RX 0x44 | ||
86 | #define MVME162_IRQ_SCCB_SPCOND 0x46 | ||
87 | #define MVME162_IRQ_SCCA_TX 0x48 | ||
88 | #define MVME162_IRQ_SCCA_STAT 0x4a | ||
89 | #define MVME162_IRQ_SCCA_RX 0x4c | ||
90 | #define MVME162_IRQ_SCCA_SPCOND 0x4e | ||
91 | |||
92 | /* MVME162 version register */ | ||
93 | |||
94 | #define MVME162_VERSION_REG 0xfff4202e | ||
95 | |||
96 | extern unsigned short mvme16x_config; | ||
97 | |||
98 | /* Lower 8 bits must match the revision register in the MC2 chip */ | ||
99 | |||
100 | #define MVME16x_CONFIG_SPEED_32 0x0001 | ||
101 | #define MVME16x_CONFIG_NO_VMECHIP2 0x0002 | ||
102 | #define MVME16x_CONFIG_NO_SCSICHIP 0x0004 | ||
103 | #define MVME16x_CONFIG_NO_ETHERNET 0x0008 | ||
104 | #define MVME16x_CONFIG_GOT_FPU 0x0010 | ||
105 | |||
106 | #define MVME16x_CONFIG_GOT_LP 0x0100 | ||
107 | #define MVME16x_CONFIG_GOT_CD2401 0x0200 | ||
108 | #define MVME16x_CONFIG_GOT_SCCA 0x0400 | ||
109 | #define MVME16x_CONFIG_GOT_SCCB 0x0800 | ||
110 | |||
111 | #endif | ||
diff --git a/include/asm-m68k/namei.h b/include/asm-m68k/namei.h new file mode 100644 index 000000000000..f33f243b644a --- /dev/null +++ b/include/asm-m68k/namei.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * linux/include/asm-m68k/namei.h | ||
3 | * | ||
4 | * Included from linux/fs/namei.c | ||
5 | */ | ||
6 | |||
7 | #ifndef __M68K_NAMEI_H | ||
8 | #define __M68K_NAMEI_H | ||
9 | |||
10 | /* This dummy routine maybe changed to something useful | ||
11 | * for /usr/gnemul/ emulation stuff. | ||
12 | * Look at asm-sparc/namei.h for details. | ||
13 | */ | ||
14 | |||
15 | #define __emul_prefix() NULL | ||
16 | |||
17 | #endif | ||
diff --git a/include/asm-m68k/nubus.h b/include/asm-m68k/nubus.h new file mode 100644 index 000000000000..d6be9976f1ae --- /dev/null +++ b/include/asm-m68k/nubus.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef _ASM_M68K_NUBUS_H | ||
2 | #define _ASM_M68K_NUBUS_H | ||
3 | |||
4 | #include <asm/raw_io.h> | ||
5 | |||
6 | #define nubus_readb raw_inb | ||
7 | #define nubus_readw raw_inw | ||
8 | #define nubus_readl raw_inl | ||
9 | |||
10 | #define nubus_writeb raw_outb | ||
11 | #define nubus_writew raw_outw | ||
12 | #define nubus_writel raw_outl | ||
13 | |||
14 | #define nubus_memset_io(a,b,c) memset((void *)(a),(b),(c)) | ||
15 | #define nubus_memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) | ||
16 | #define nubus_memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) | ||
17 | |||
18 | static inline void *nubus_remap_nocache_ser(unsigned long physaddr, | ||
19 | unsigned long size) | ||
20 | { | ||
21 | return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); | ||
22 | } | ||
23 | |||
24 | static inline void *nubus_remap_nocache_nonser(unsigned long physaddr, | ||
25 | unsigned long size) | ||
26 | { | ||
27 | return __ioremap(physaddr, size, IOMAP_NOCACHE_NONSER); | ||
28 | } | ||
29 | |||
30 | static inline void *nbus_remap_writethrough(unsigned long physaddr, | ||
31 | unsigned long size) | ||
32 | { | ||
33 | return __ioremap(physaddr, size, IOMAP_WRITETHROUGH); | ||
34 | } | ||
35 | |||
36 | static inline void *nubus_remap_fullcache(unsigned long physaddr, | ||
37 | unsigned long size) | ||
38 | { | ||
39 | return __ioremap(physaddr, size, IOMAP_FULL_CACHING); | ||
40 | } | ||
41 | |||
42 | #define nubus_unmap iounmap | ||
43 | #define nubus_iounmap iounmap | ||
44 | #define nubus_ioremap nubus_remap_nocache_ser | ||
45 | |||
46 | #endif /* _ASM_NUBUS_H */ | ||
diff --git a/include/asm-m68k/openprom.h b/include/asm-m68k/openprom.h new file mode 100644 index 000000000000..efbfb0bec6e2 --- /dev/null +++ b/include/asm-m68k/openprom.h | |||
@@ -0,0 +1,314 @@ | |||
1 | /* $Id: openprom.h,v 1.19 1996/09/25 03:51:08 davem Exp $ */ | ||
2 | #ifndef __SPARC_OPENPROM_H | ||
3 | #define __SPARC_OPENPROM_H | ||
4 | |||
5 | /* openprom.h: Prom structures and defines for access to the OPENBOOT | ||
6 | * prom routines and data areas. | ||
7 | * | ||
8 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
9 | */ | ||
10 | |||
11 | #include <linux/config.h> | ||
12 | |||
13 | /* Empirical constants... */ | ||
14 | #ifdef CONFIG_SUN3 | ||
15 | #define KADB_DEBUGGER_BEGVM 0x0fee0000 /* There is no kadb yet but...*/ | ||
16 | #define LINUX_OPPROM_BEGVM 0x0fef0000 | ||
17 | #define LINUX_OPPROM_ENDVM 0x0ff10000 /* I think this is right - tm */ | ||
18 | #else | ||
19 | #define KADB_DEBUGGER_BEGVM 0xffc00000 /* Where kern debugger is in virt-mem */ | ||
20 | #define LINUX_OPPROM_BEGVM 0xffd00000 | ||
21 | #define LINUX_OPPROM_ENDVM 0xfff00000 | ||
22 | #define LINUX_OPPROM_MAGIC 0x10010407 | ||
23 | #endif | ||
24 | |||
25 | #ifndef __ASSEMBLY__ | ||
26 | /* V0 prom device operations. */ | ||
27 | struct linux_dev_v0_funcs { | ||
28 | int (*v0_devopen)(char *device_str); | ||
29 | int (*v0_devclose)(int dev_desc); | ||
30 | int (*v0_rdblkdev)(int dev_desc, int num_blks, int blk_st, char *buf); | ||
31 | int (*v0_wrblkdev)(int dev_desc, int num_blks, int blk_st, char *buf); | ||
32 | int (*v0_wrnetdev)(int dev_desc, int num_bytes, char *buf); | ||
33 | int (*v0_rdnetdev)(int dev_desc, int num_bytes, char *buf); | ||
34 | int (*v0_rdchardev)(int dev_desc, int num_bytes, int dummy, char *buf); | ||
35 | int (*v0_wrchardev)(int dev_desc, int num_bytes, int dummy, char *buf); | ||
36 | int (*v0_seekdev)(int dev_desc, long logical_offst, int from); | ||
37 | }; | ||
38 | |||
39 | /* V2 and later prom device operations. */ | ||
40 | struct linux_dev_v2_funcs { | ||
41 | int (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */ | ||
42 | char * (*v2_dumb_mem_alloc)(char *va, unsigned sz); | ||
43 | void (*v2_dumb_mem_free)(char *va, unsigned sz); | ||
44 | |||
45 | /* To map devices into virtual I/O space. */ | ||
46 | char * (*v2_dumb_mmap)(char *virta, int which_io, unsigned paddr, unsigned sz); | ||
47 | void (*v2_dumb_munmap)(char *virta, unsigned size); | ||
48 | |||
49 | int (*v2_dev_open)(char *devpath); | ||
50 | void (*v2_dev_close)(int d); | ||
51 | int (*v2_dev_read)(int d, char *buf, int nbytes); | ||
52 | int (*v2_dev_write)(int d, char *buf, int nbytes); | ||
53 | int (*v2_dev_seek)(int d, int hi, int lo); | ||
54 | |||
55 | /* Never issued (multistage load support) */ | ||
56 | void (*v2_wheee2)(void); | ||
57 | void (*v2_wheee3)(void); | ||
58 | }; | ||
59 | |||
60 | struct linux_mlist_v0 { | ||
61 | struct linux_mlist_v0 *theres_more; | ||
62 | char *start_adr; | ||
63 | unsigned num_bytes; | ||
64 | }; | ||
65 | |||
66 | struct linux_mem_v0 { | ||
67 | struct linux_mlist_v0 **v0_totphys; | ||
68 | struct linux_mlist_v0 **v0_prommap; | ||
69 | struct linux_mlist_v0 **v0_available; /* What we can use */ | ||
70 | }; | ||
71 | |||
72 | /* Arguments sent to the kernel from the boot prompt. */ | ||
73 | struct linux_arguments_v0 { | ||
74 | char *argv[8]; | ||
75 | char args[100]; | ||
76 | char boot_dev[2]; | ||
77 | int boot_dev_ctrl; | ||
78 | int boot_dev_unit; | ||
79 | int dev_partition; | ||
80 | char *kernel_file_name; | ||
81 | void *aieee1; /* XXX */ | ||
82 | }; | ||
83 | |||
84 | /* V2 and up boot things. */ | ||
85 | struct linux_bootargs_v2 { | ||
86 | char **bootpath; | ||
87 | char **bootargs; | ||
88 | int *fd_stdin; | ||
89 | int *fd_stdout; | ||
90 | }; | ||
91 | |||
92 | #if defined(CONFIG_SUN3) || defined(CONFIG_SUN3X) | ||
93 | struct linux_romvec { | ||
94 | char *pv_initsp; | ||
95 | int (*pv_startmon)(void); | ||
96 | |||
97 | int *diagberr; | ||
98 | |||
99 | struct linux_arguments_v0 **pv_v0bootargs; | ||
100 | unsigned *pv_sun3mem; | ||
101 | |||
102 | unsigned char (*pv_getchar)(void); | ||
103 | int (*pv_putchar)(int ch); | ||
104 | int (*pv_nbgetchar)(void); | ||
105 | int (*pv_nbputchar)(int ch); | ||
106 | unsigned char *pv_echo; | ||
107 | unsigned char *pv_insource; | ||
108 | unsigned char *pv_outsink; | ||
109 | |||
110 | int (*pv_getkey)(void); | ||
111 | int (*pv_initgetkey)(void); | ||
112 | unsigned int *pv_translation; | ||
113 | unsigned char *pv_keybid; | ||
114 | int *pv_screen_x; | ||
115 | int *pv_screen_y; | ||
116 | struct keybuf *pv_keybuf; | ||
117 | |||
118 | char *pv_monid; | ||
119 | |||
120 | /* | ||
121 | * Frame buffer output and terminal emulation | ||
122 | */ | ||
123 | |||
124 | int (*pv_fbwritechar)(char); | ||
125 | int *pv_fbaddr; | ||
126 | char **pv_font; | ||
127 | int (*pv_fbwritestr)(char); | ||
128 | |||
129 | void (*pv_reboot)(char *bootstr); | ||
130 | |||
131 | /* | ||
132 | * Line input and parsing | ||
133 | */ | ||
134 | |||
135 | unsigned char *pv_linebuf; | ||
136 | unsigned char **pv_lineptr; | ||
137 | int *pv_linesize; | ||
138 | int (*pv_getline)(void); | ||
139 | unsigned char (*pv_getnextchar)(void); | ||
140 | unsigned char (*pv_peeknextchar)(void); | ||
141 | int *pv_fbthere; | ||
142 | int (*pv_getnum)(void); | ||
143 | |||
144 | void (*pv_printf)(const char *fmt, ...); | ||
145 | int (*pv_printhex)(void); | ||
146 | |||
147 | unsigned char *pv_leds; | ||
148 | int (*pv_setleds)(void); | ||
149 | |||
150 | /* | ||
151 | * Non-maskable interrupt (nmi) information | ||
152 | */ | ||
153 | |||
154 | int (*pv_nmiaddr)(void); | ||
155 | int (*pv_abortentry)(void); | ||
156 | int *pv_nmiclock; | ||
157 | |||
158 | int *pv_fbtype; | ||
159 | |||
160 | /* | ||
161 | * Assorted other things | ||
162 | */ | ||
163 | |||
164 | unsigned pv_romvers; | ||
165 | struct globram *pv_globram; | ||
166 | char *pv_kbdzscc; | ||
167 | |||
168 | int *pv_keyrinit; | ||
169 | unsigned char *pv_keyrtick; | ||
170 | unsigned *pv_memoryavail; | ||
171 | long *pv_resetaddr; | ||
172 | long *pv_resetmap; | ||
173 | |||
174 | void (*pv_halt)(void); | ||
175 | unsigned char *pv_memorybitmap; | ||
176 | |||
177 | #ifdef CONFIG_SUN3 | ||
178 | void (*pv_setctxt)(int ctxt, char *va, int pmeg); | ||
179 | void (*pv_vector_cmd)(void); | ||
180 | int dummy1z; | ||
181 | int dummy2z; | ||
182 | int dummy3z; | ||
183 | int dummy4z; | ||
184 | #endif | ||
185 | }; | ||
186 | #else | ||
187 | /* The top level PROM vector. */ | ||
188 | struct linux_romvec { | ||
189 | /* Version numbers. */ | ||
190 | unsigned int pv_magic_cookie; | ||
191 | unsigned int pv_romvers; | ||
192 | unsigned int pv_plugin_revision; | ||
193 | unsigned int pv_printrev; | ||
194 | |||
195 | /* Version 0 memory descriptors. */ | ||
196 | struct linux_mem_v0 pv_v0mem; | ||
197 | |||
198 | /* Node operations. */ | ||
199 | struct linux_nodeops *pv_nodeops; | ||
200 | |||
201 | char **pv_bootstr; | ||
202 | struct linux_dev_v0_funcs pv_v0devops; | ||
203 | |||
204 | char *pv_stdin; | ||
205 | char *pv_stdout; | ||
206 | #define PROMDEV_KBD 0 /* input from keyboard */ | ||
207 | #define PROMDEV_SCREEN 0 /* output to screen */ | ||
208 | #define PROMDEV_TTYA 1 /* in/out to ttya */ | ||
209 | #define PROMDEV_TTYB 2 /* in/out to ttyb */ | ||
210 | |||
211 | /* Blocking getchar/putchar. NOT REENTRANT! (grr) */ | ||
212 | int (*pv_getchar)(void); | ||
213 | void (*pv_putchar)(int ch); | ||
214 | |||
215 | /* Non-blocking variants. */ | ||
216 | int (*pv_nbgetchar)(void); | ||
217 | int (*pv_nbputchar)(int ch); | ||
218 | |||
219 | void (*pv_putstr)(char *str, int len); | ||
220 | |||
221 | /* Miscellany. */ | ||
222 | void (*pv_reboot)(char *bootstr); | ||
223 | void (*pv_printf)(__const__ char *fmt, ...); | ||
224 | void (*pv_abort)(void); | ||
225 | __volatile__ int *pv_ticks; | ||
226 | void (*pv_halt)(void); | ||
227 | void (**pv_synchook)(void); | ||
228 | |||
229 | /* Evaluate a forth string, not different proto for V0 and V2->up. */ | ||
230 | union { | ||
231 | void (*v0_eval)(int len, char *str); | ||
232 | void (*v2_eval)(char *str); | ||
233 | } pv_fortheval; | ||
234 | |||
235 | struct linux_arguments_v0 **pv_v0bootargs; | ||
236 | |||
237 | /* Get ether address. */ | ||
238 | unsigned int (*pv_enaddr)(int d, char *enaddr); | ||
239 | |||
240 | struct linux_bootargs_v2 pv_v2bootargs; | ||
241 | struct linux_dev_v2_funcs pv_v2devops; | ||
242 | |||
243 | int filler[15]; | ||
244 | |||
245 | /* This one is sun4c/sun4 only. */ | ||
246 | void (*pv_setctxt)(int ctxt, char *va, int pmeg); | ||
247 | |||
248 | /* Prom version 3 Multiprocessor routines. This stuff is crazy. | ||
249 | * No joke. Calling these when there is only one cpu probably | ||
250 | * crashes the machine, have to test this. :-) | ||
251 | */ | ||
252 | |||
253 | /* v3_cpustart() will start the cpu 'whichcpu' in mmu-context | ||
254 | * 'thiscontext' executing at address 'prog_counter' | ||
255 | */ | ||
256 | int (*v3_cpustart)(unsigned int whichcpu, int ctxtbl_ptr, | ||
257 | int thiscontext, char *prog_counter); | ||
258 | |||
259 | /* v3_cpustop() will cause cpu 'whichcpu' to stop executing | ||
260 | * until a resume cpu call is made. | ||
261 | */ | ||
262 | int (*v3_cpustop)(unsigned int whichcpu); | ||
263 | |||
264 | /* v3_cpuidle() will idle cpu 'whichcpu' until a stop or | ||
265 | * resume cpu call is made. | ||
266 | */ | ||
267 | int (*v3_cpuidle)(unsigned int whichcpu); | ||
268 | |||
269 | /* v3_cpuresume() will resume processor 'whichcpu' executing | ||
270 | * starting with whatever 'pc' and 'npc' were left at the | ||
271 | * last 'idle' or 'stop' call. | ||
272 | */ | ||
273 | int (*v3_cpuresume)(unsigned int whichcpu); | ||
274 | }; | ||
275 | #endif | ||
276 | |||
277 | /* Routines for traversing the prom device tree. */ | ||
278 | struct linux_nodeops { | ||
279 | int (*no_nextnode)(int node); | ||
280 | int (*no_child)(int node); | ||
281 | int (*no_proplen)(int node, char *name); | ||
282 | int (*no_getprop)(int node, char *name, char *val); | ||
283 | int (*no_setprop)(int node, char *name, char *val, int len); | ||
284 | char * (*no_nextprop)(int node, char *name); | ||
285 | }; | ||
286 | |||
287 | /* More fun PROM structures for device probing. */ | ||
288 | #define PROMREG_MAX 16 | ||
289 | #define PROMVADDR_MAX 16 | ||
290 | #define PROMINTR_MAX 15 | ||
291 | |||
292 | struct linux_prom_registers { | ||
293 | int which_io; /* is this in OBIO space? */ | ||
294 | char *phys_addr; /* The physical address of this register */ | ||
295 | int reg_size; /* How many bytes does this register take up? */ | ||
296 | }; | ||
297 | |||
298 | struct linux_prom_irqs { | ||
299 | int pri; /* IRQ priority */ | ||
300 | int vector; /* This is foobar, what does it do? */ | ||
301 | }; | ||
302 | |||
303 | /* Element of the "ranges" vector */ | ||
304 | struct linux_prom_ranges { | ||
305 | unsigned int ot_child_space; | ||
306 | unsigned int ot_child_base; /* Bus feels this */ | ||
307 | unsigned int ot_parent_space; | ||
308 | unsigned int ot_parent_base; /* CPU looks from here */ | ||
309 | unsigned int or_size; | ||
310 | }; | ||
311 | |||
312 | #endif /* !(__ASSEMBLY__) */ | ||
313 | |||
314 | #endif /* !(__SPARC_OPENPROM_H) */ | ||
diff --git a/include/asm-m68k/oplib.h b/include/asm-m68k/oplib.h new file mode 100644 index 000000000000..c3594f473ef7 --- /dev/null +++ b/include/asm-m68k/oplib.h | |||
@@ -0,0 +1,297 @@ | |||
1 | /* $Id: oplib.h,v 1.12 1996/10/31 06:29:13 davem Exp $ | ||
2 | * oplib.h: Describes the interface and available routines in the | ||
3 | * Linux Prom library. | ||
4 | * | ||
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
6 | */ | ||
7 | |||
8 | #ifndef __SPARC_OPLIB_H | ||
9 | #define __SPARC_OPLIB_H | ||
10 | |||
11 | #include <asm/openprom.h> | ||
12 | |||
13 | /* The master romvec pointer... */ | ||
14 | extern struct linux_romvec *romvec; | ||
15 | |||
16 | /* Enumeration to describe the prom major version we have detected. */ | ||
17 | enum prom_major_version { | ||
18 | PROM_V0, /* Original sun4c V0 prom */ | ||
19 | PROM_V2, /* sun4c and early sun4m V2 prom */ | ||
20 | PROM_V3, /* sun4m and later, up to sun4d/sun4e machines V3 */ | ||
21 | PROM_P1275, /* IEEE compliant ISA based Sun PROM, only sun4u */ | ||
22 | PROM_AP1000, /* actually no prom at all */ | ||
23 | }; | ||
24 | |||
25 | extern enum prom_major_version prom_vers; | ||
26 | /* Revision, and firmware revision. */ | ||
27 | extern unsigned int prom_rev, prom_prev; | ||
28 | |||
29 | /* Root node of the prom device tree, this stays constant after | ||
30 | * initialization is complete. | ||
31 | */ | ||
32 | extern int prom_root_node; | ||
33 | |||
34 | /* Pointer to prom structure containing the device tree traversal | ||
35 | * and usage utility functions. Only prom-lib should use these, | ||
36 | * users use the interface defined by the library only! | ||
37 | */ | ||
38 | extern struct linux_nodeops *prom_nodeops; | ||
39 | |||
40 | /* The functions... */ | ||
41 | |||
42 | /* You must call prom_init() before using any of the library services, | ||
43 | * preferably as early as possible. Pass it the romvec pointer. | ||
44 | */ | ||
45 | extern void prom_init(struct linux_romvec *rom_ptr); | ||
46 | |||
47 | /* Boot argument acquisition, returns the boot command line string. */ | ||
48 | extern char *prom_getbootargs(void); | ||
49 | |||
50 | /* Device utilities. */ | ||
51 | |||
52 | /* Map and unmap devices in IO space at virtual addresses. Note that the | ||
53 | * virtual address you pass is a request and the prom may put your mappings | ||
54 | * somewhere else, so check your return value as that is where your new | ||
55 | * mappings really are! | ||
56 | * | ||
57 | * Another note, these are only available on V2 or higher proms! | ||
58 | */ | ||
59 | extern char *prom_mapio(char *virt_hint, int io_space, unsigned int phys_addr, unsigned int num_bytes); | ||
60 | extern void prom_unmapio(char *virt_addr, unsigned int num_bytes); | ||
61 | |||
62 | /* Device operations. */ | ||
63 | |||
64 | /* Open the device described by the passed string. Note, that the format | ||
65 | * of the string is different on V0 vs. V2->higher proms. The caller must | ||
66 | * know what he/she is doing! Returns the device descriptor, an int. | ||
67 | */ | ||
68 | extern int prom_devopen(char *device_string); | ||
69 | |||
70 | /* Close a previously opened device described by the passed integer | ||
71 | * descriptor. | ||
72 | */ | ||
73 | extern int prom_devclose(int device_handle); | ||
74 | |||
75 | /* Do a seek operation on the device described by the passed integer | ||
76 | * descriptor. | ||
77 | */ | ||
78 | extern void prom_seek(int device_handle, unsigned int seek_hival, | ||
79 | unsigned int seek_lowval); | ||
80 | |||
81 | /* Machine memory configuration routine. */ | ||
82 | |||
83 | /* This function returns a V0 format memory descriptor table, it has three | ||
84 | * entries. One for the total amount of physical ram on the machine, one | ||
85 | * for the amount of physical ram available, and one describing the virtual | ||
86 | * areas which are allocated by the prom. So, in a sense the physical | ||
87 | * available is a calculation of the total physical minus the physical mapped | ||
88 | * by the prom with virtual mappings. | ||
89 | * | ||
90 | * These lists are returned pre-sorted, this should make your life easier | ||
91 | * since the prom itself is way too lazy to do such nice things. | ||
92 | */ | ||
93 | extern struct linux_mem_v0 *prom_meminfo(void); | ||
94 | |||
95 | /* Miscellaneous routines, don't really fit in any category per se. */ | ||
96 | |||
97 | /* Reboot the machine with the command line passed. */ | ||
98 | extern void prom_reboot(char *boot_command); | ||
99 | |||
100 | /* Evaluate the forth string passed. */ | ||
101 | extern void prom_feval(char *forth_string); | ||
102 | |||
103 | /* Enter the prom, with possibility of continuation with the 'go' | ||
104 | * command in newer proms. | ||
105 | */ | ||
106 | extern void prom_cmdline(void); | ||
107 | |||
108 | /* Enter the prom, with no chance of continuation for the stand-alone | ||
109 | * which calls this. | ||
110 | */ | ||
111 | extern void prom_halt(void); | ||
112 | |||
113 | /* Set the PROM 'sync' callback function to the passed function pointer. | ||
114 | * When the user gives the 'sync' command at the prom prompt while the | ||
115 | * kernel is still active, the prom will call this routine. | ||
116 | * | ||
117 | * XXX The arguments are different on V0 vs. V2->higher proms, grrr! XXX | ||
118 | */ | ||
119 | typedef void (*sync_func_t)(void); | ||
120 | extern void prom_setsync(sync_func_t func_ptr); | ||
121 | |||
122 | /* Acquire the IDPROM of the root node in the prom device tree. This | ||
123 | * gets passed a buffer where you would like it stuffed. The return value | ||
124 | * is the format type of this idprom or 0xff on error. | ||
125 | */ | ||
126 | extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); | ||
127 | |||
128 | /* Get the prom major version. */ | ||
129 | extern int prom_version(void); | ||
130 | |||
131 | /* Get the prom plugin revision. */ | ||
132 | extern int prom_getrev(void); | ||
133 | |||
134 | /* Get the prom firmware revision. */ | ||
135 | extern int prom_getprev(void); | ||
136 | |||
137 | /* Character operations to/from the console.... */ | ||
138 | |||
139 | /* Non-blocking get character from console. */ | ||
140 | extern int prom_nbgetchar(void); | ||
141 | |||
142 | /* Non-blocking put character to console. */ | ||
143 | extern int prom_nbputchar(char character); | ||
144 | |||
145 | /* Blocking get character from console. */ | ||
146 | extern char prom_getchar(void); | ||
147 | |||
148 | /* Blocking put character to console. */ | ||
149 | extern void prom_putchar(char character); | ||
150 | |||
151 | /* Prom's internal printf routine, don't use in kernel/boot code. */ | ||
152 | void prom_printf(char *fmt, ...); | ||
153 | |||
154 | /* Query for input device type */ | ||
155 | |||
156 | enum prom_input_device { | ||
157 | PROMDEV_IKBD, /* input from keyboard */ | ||
158 | PROMDEV_ITTYA, /* input from ttya */ | ||
159 | PROMDEV_ITTYB, /* input from ttyb */ | ||
160 | PROMDEV_I_UNK, | ||
161 | }; | ||
162 | |||
163 | extern enum prom_input_device prom_query_input_device(void); | ||
164 | |||
165 | /* Query for output device type */ | ||
166 | |||
167 | enum prom_output_device { | ||
168 | PROMDEV_OSCREEN, /* to screen */ | ||
169 | PROMDEV_OTTYA, /* to ttya */ | ||
170 | PROMDEV_OTTYB, /* to ttyb */ | ||
171 | PROMDEV_O_UNK, | ||
172 | }; | ||
173 | |||
174 | extern enum prom_output_device prom_query_output_device(void); | ||
175 | |||
176 | /* Multiprocessor operations... */ | ||
177 | |||
178 | /* Start the CPU with the given device tree node, context table, and context | ||
179 | * at the passed program counter. | ||
180 | */ | ||
181 | extern int prom_startcpu(int cpunode, struct linux_prom_registers *context_table, | ||
182 | int context, char *program_counter); | ||
183 | |||
184 | /* Stop the CPU with the passed device tree node. */ | ||
185 | extern int prom_stopcpu(int cpunode); | ||
186 | |||
187 | /* Idle the CPU with the passed device tree node. */ | ||
188 | extern int prom_idlecpu(int cpunode); | ||
189 | |||
190 | /* Re-Start the CPU with the passed device tree node. */ | ||
191 | extern int prom_restartcpu(int cpunode); | ||
192 | |||
193 | /* PROM memory allocation facilities... */ | ||
194 | |||
195 | /* Allocated at possibly the given virtual address a chunk of the | ||
196 | * indicated size. | ||
197 | */ | ||
198 | extern char *prom_alloc(char *virt_hint, unsigned int size); | ||
199 | |||
200 | /* Free a previously allocated chunk. */ | ||
201 | extern void prom_free(char *virt_addr, unsigned int size); | ||
202 | |||
203 | /* Sun4/sun4c specific memory-management startup hook. */ | ||
204 | |||
205 | /* Map the passed segment in the given context at the passed | ||
206 | * virtual address. | ||
207 | */ | ||
208 | extern void prom_putsegment(int context, unsigned long virt_addr, | ||
209 | int physical_segment); | ||
210 | |||
211 | /* PROM device tree traversal functions... */ | ||
212 | |||
213 | /* Get the child node of the given node, or zero if no child exists. */ | ||
214 | extern int prom_getchild(int parent_node); | ||
215 | |||
216 | /* Get the next sibling node of the given node, or zero if no further | ||
217 | * siblings exist. | ||
218 | */ | ||
219 | extern int prom_getsibling(int node); | ||
220 | |||
221 | /* Get the length, at the passed node, of the given property type. | ||
222 | * Returns -1 on error (ie. no such property at this node). | ||
223 | */ | ||
224 | extern int prom_getproplen(int thisnode, char *property); | ||
225 | |||
226 | /* Fetch the requested property using the given buffer. Returns | ||
227 | * the number of bytes the prom put into your buffer or -1 on error. | ||
228 | */ | ||
229 | extern int prom_getproperty(int thisnode, char *property, | ||
230 | char *prop_buffer, int propbuf_size); | ||
231 | |||
232 | /* Acquire an integer property. */ | ||
233 | extern int prom_getint(int node, char *property); | ||
234 | |||
235 | /* Acquire an integer property, with a default value. */ | ||
236 | extern int prom_getintdefault(int node, char *property, int defval); | ||
237 | |||
238 | /* Acquire a boolean property, 0=FALSE 1=TRUE. */ | ||
239 | extern int prom_getbool(int node, char *prop); | ||
240 | |||
241 | /* Acquire a string property, null string on error. */ | ||
242 | extern void prom_getstring(int node, char *prop, char *buf, int bufsize); | ||
243 | |||
244 | /* Does the passed node have the given "name"? YES=1 NO=0 */ | ||
245 | extern int prom_nodematch(int thisnode, char *name); | ||
246 | |||
247 | /* Puts in buffer a prom name in the form name@x,y or name (x for which_io | ||
248 | * and y for first regs phys address | ||
249 | */ | ||
250 | extern int prom_getname(int node, char *buf, int buflen); | ||
251 | |||
252 | /* Search all siblings starting at the passed node for "name" matching | ||
253 | * the given string. Returns the node on success, zero on failure. | ||
254 | */ | ||
255 | extern int prom_searchsiblings(int node_start, char *name); | ||
256 | |||
257 | /* Return the first property type, as a string, for the given node. | ||
258 | * Returns a null string on error. | ||
259 | */ | ||
260 | extern char *prom_firstprop(int node); | ||
261 | |||
262 | /* Returns the next property after the passed property for the given | ||
263 | * node. Returns null string on failure. | ||
264 | */ | ||
265 | extern char *prom_nextprop(int node, char *prev_property); | ||
266 | |||
267 | /* Returns 1 if the specified node has given property. */ | ||
268 | extern int prom_node_has_property(int node, char *property); | ||
269 | |||
270 | /* Set the indicated property at the given node with the passed value. | ||
271 | * Returns the number of bytes of your value that the prom took. | ||
272 | */ | ||
273 | extern int prom_setprop(int node, char *prop_name, char *prop_value, | ||
274 | int value_size); | ||
275 | |||
276 | extern int prom_pathtoinode(char *path); | ||
277 | extern int prom_inst2pkg(int); | ||
278 | |||
279 | /* Dorking with Bus ranges... */ | ||
280 | |||
281 | /* Adjust reg values with the passed ranges. */ | ||
282 | extern void prom_adjust_regs(struct linux_prom_registers *regp, int nregs, | ||
283 | struct linux_prom_ranges *rangep, int nranges); | ||
284 | |||
285 | /* Adjust child ranges with the passed parent ranges. */ | ||
286 | extern void prom_adjust_ranges(struct linux_prom_ranges *cranges, int ncranges, | ||
287 | struct linux_prom_ranges *pranges, int npranges); | ||
288 | |||
289 | /* Apply promlib probed OBIO ranges to registers. */ | ||
290 | extern void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs); | ||
291 | |||
292 | /* Apply ranges of any prom node (and optionally parent node as well) to registers. */ | ||
293 | extern void prom_apply_generic_ranges(int node, int parent, | ||
294 | struct linux_prom_registers *sbusregs, int nregs); | ||
295 | |||
296 | |||
297 | #endif /* !(__SPARC_OPLIB_H) */ | ||
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h new file mode 100644 index 000000000000..99a516709210 --- /dev/null +++ b/include/asm-m68k/page.h | |||
@@ -0,0 +1,195 @@ | |||
1 | #ifndef _M68K_PAGE_H | ||
2 | #define _M68K_PAGE_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | |||
6 | /* PAGE_SHIFT determines the page size */ | ||
7 | #ifndef CONFIG_SUN3 | ||
8 | #define PAGE_SHIFT (12) | ||
9 | #else | ||
10 | #define PAGE_SHIFT (13) | ||
11 | #endif | ||
12 | #ifdef __ASSEMBLY__ | ||
13 | #define PAGE_SIZE (1 << PAGE_SHIFT) | ||
14 | #else | ||
15 | #define PAGE_SIZE (1UL << PAGE_SHIFT) | ||
16 | #endif | ||
17 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
18 | |||
19 | #ifdef __KERNEL__ | ||
20 | |||
21 | #include <asm/setup.h> | ||
22 | |||
23 | #if PAGE_SHIFT < 13 | ||
24 | #define THREAD_SIZE (8192) | ||
25 | #else | ||
26 | #define THREAD_SIZE PAGE_SIZE | ||
27 | #endif | ||
28 | |||
29 | #ifndef __ASSEMBLY__ | ||
30 | |||
31 | #define get_user_page(vaddr) __get_free_page(GFP_KERNEL) | ||
32 | #define free_user_page(page, addr) free_page(addr) | ||
33 | |||
34 | /* | ||
35 | * We don't need to check for alignment etc. | ||
36 | */ | ||
37 | #ifdef CPU_M68040_OR_M68060_ONLY | ||
38 | static inline void copy_page(void *to, void *from) | ||
39 | { | ||
40 | unsigned long tmp; | ||
41 | |||
42 | __asm__ __volatile__("1:\t" | ||
43 | ".chip 68040\n\t" | ||
44 | "move16 %1@+,%0@+\n\t" | ||
45 | "move16 %1@+,%0@+\n\t" | ||
46 | ".chip 68k\n\t" | ||
47 | "dbra %2,1b\n\t" | ||
48 | : "=a" (to), "=a" (from), "=d" (tmp) | ||
49 | : "0" (to), "1" (from) , "2" (PAGE_SIZE / 32 - 1) | ||
50 | ); | ||
51 | } | ||
52 | |||
53 | static inline void clear_page(void *page) | ||
54 | { | ||
55 | unsigned long tmp; | ||
56 | unsigned long *sp = page; | ||
57 | |||
58 | *sp++ = 0; | ||
59 | *sp++ = 0; | ||
60 | *sp++ = 0; | ||
61 | *sp++ = 0; | ||
62 | |||
63 | __asm__ __volatile__("1:\t" | ||
64 | ".chip 68040\n\t" | ||
65 | "move16 %2@+,%0@+\n\t" | ||
66 | ".chip 68k\n\t" | ||
67 | "subqw #8,%2\n\t" | ||
68 | "subqw #8,%2\n\t" | ||
69 | "dbra %1,1b\n\t" | ||
70 | : "=a" (sp), "=d" (tmp) | ||
71 | : "a" (page), "0" (sp), | ||
72 | "1" ((PAGE_SIZE - 16) / 16 - 1)); | ||
73 | } | ||
74 | |||
75 | #else | ||
76 | #define clear_page(page) memset((page), 0, PAGE_SIZE) | ||
77 | #define copy_page(to,from) memcpy((to), (from), PAGE_SIZE) | ||
78 | #endif | ||
79 | |||
80 | #define clear_user_page(addr, vaddr, page) \ | ||
81 | do { clear_page(addr); \ | ||
82 | flush_dcache_page(page); \ | ||
83 | } while (0) | ||
84 | #define copy_user_page(to, from, vaddr, page) \ | ||
85 | do { copy_page(to, from); \ | ||
86 | flush_dcache_page(page); \ | ||
87 | } while (0) | ||
88 | |||
89 | /* | ||
90 | * These are used to make use of C type-checking.. | ||
91 | */ | ||
92 | typedef struct { unsigned long pte; } pte_t; | ||
93 | typedef struct { unsigned long pmd[16]; } pmd_t; | ||
94 | typedef struct { unsigned long pgd; } pgd_t; | ||
95 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
96 | |||
97 | #define pte_val(x) ((x).pte) | ||
98 | #define pmd_val(x) ((&x)->pmd[0]) | ||
99 | #define pgd_val(x) ((x).pgd) | ||
100 | #define pgprot_val(x) ((x).pgprot) | ||
101 | |||
102 | #define __pte(x) ((pte_t) { (x) } ) | ||
103 | #define __pmd(x) ((pmd_t) { (x) } ) | ||
104 | #define __pgd(x) ((pgd_t) { (x) } ) | ||
105 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
106 | |||
107 | /* to align the pointer to the (next) page boundary */ | ||
108 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) | ||
109 | |||
110 | /* Pure 2^n version of get_order */ | ||
111 | static inline int get_order(unsigned long size) | ||
112 | { | ||
113 | int order; | ||
114 | |||
115 | size = (size-1) >> (PAGE_SHIFT-1); | ||
116 | order = -1; | ||
117 | do { | ||
118 | size >>= 1; | ||
119 | order++; | ||
120 | } while (size); | ||
121 | return order; | ||
122 | } | ||
123 | |||
124 | #endif /* !__ASSEMBLY__ */ | ||
125 | |||
126 | #include <asm/page_offset.h> | ||
127 | |||
128 | #define PAGE_OFFSET (PAGE_OFFSET_RAW) | ||
129 | |||
130 | #ifndef __ASSEMBLY__ | ||
131 | |||
132 | #ifndef CONFIG_SUN3 | ||
133 | |||
134 | #define WANT_PAGE_VIRTUAL | ||
135 | #ifdef CONFIG_SINGLE_MEMORY_CHUNK | ||
136 | extern unsigned long m68k_memoffset; | ||
137 | |||
138 | #define __pa(vaddr) ((unsigned long)(vaddr)+m68k_memoffset) | ||
139 | #define __va(paddr) ((void *)((unsigned long)(paddr)-m68k_memoffset)) | ||
140 | #else | ||
141 | #define __pa(vaddr) virt_to_phys((void *)vaddr) | ||
142 | #define __va(paddr) phys_to_virt((unsigned long)paddr) | ||
143 | #endif | ||
144 | |||
145 | #else /* !CONFIG_SUN3 */ | ||
146 | /* This #define is a horrible hack to suppress lots of warnings. --m */ | ||
147 | #define __pa(x) ___pa((unsigned long)x) | ||
148 | static inline unsigned long ___pa(unsigned long x) | ||
149 | { | ||
150 | if(x == 0) | ||
151 | return 0; | ||
152 | if(x >= PAGE_OFFSET) | ||
153 | return (x-PAGE_OFFSET); | ||
154 | else | ||
155 | return (x+0x2000000); | ||
156 | } | ||
157 | |||
158 | static inline void *__va(unsigned long x) | ||
159 | { | ||
160 | if(x == 0) | ||
161 | return (void *)0; | ||
162 | |||
163 | if(x < 0x2000000) | ||
164 | return (void *)(x+PAGE_OFFSET); | ||
165 | else | ||
166 | return (void *)(x-0x2000000); | ||
167 | } | ||
168 | #endif /* CONFIG_SUN3 */ | ||
169 | |||
170 | /* | ||
171 | * NOTE: virtual isn't really correct, actually it should be the offset into the | ||
172 | * memory node, but we have no highmem, so that works for now. | ||
173 | * TODO: implement (fast) pfn<->pgdat_idx conversion functions, this makes lots | ||
174 | * of the shifts unnecessary. | ||
175 | */ | ||
176 | #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) | ||
177 | #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) | ||
178 | |||
179 | #define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr)-PAGE_OFFSET) >> PAGE_SHIFT)) | ||
180 | #define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) | ||
181 | |||
182 | #define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn)) | ||
183 | #define page_to_pfn(page) virt_to_pfn(page_to_virt(page)) | ||
184 | |||
185 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory) | ||
186 | #define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn)) | ||
187 | |||
188 | #endif /* __ASSEMBLY__ */ | ||
189 | |||
190 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | ||
191 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
192 | |||
193 | #endif /* __KERNEL__ */ | ||
194 | |||
195 | #endif /* _M68K_PAGE_H */ | ||
diff --git a/include/asm-m68k/page_offset.h b/include/asm-m68k/page_offset.h new file mode 100644 index 000000000000..86d3c2845ad4 --- /dev/null +++ b/include/asm-m68k/page_offset.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #include <linux/config.h> | ||
2 | |||
3 | /* This handles the memory map.. */ | ||
4 | #ifndef CONFIG_SUN3 | ||
5 | #define PAGE_OFFSET_RAW 0x00000000 | ||
6 | #else | ||
7 | #define PAGE_OFFSET_RAW 0x0E000000 | ||
8 | #endif | ||
9 | |||
diff --git a/include/asm-m68k/param.h b/include/asm-m68k/param.h new file mode 100644 index 000000000000..60f409d81658 --- /dev/null +++ b/include/asm-m68k/param.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef _M68K_PARAM_H | ||
2 | #define _M68K_PARAM_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | # define HZ 100 /* Internal kernel timer frequency */ | ||
6 | # define USER_HZ 100 /* .. some user interfaces are in "ticks" */ | ||
7 | # define CLOCKS_PER_SEC (USER_HZ) /* like times() */ | ||
8 | #endif | ||
9 | |||
10 | #ifndef HZ | ||
11 | #define HZ 100 | ||
12 | #endif | ||
13 | |||
14 | #define EXEC_PAGESIZE 8192 | ||
15 | |||
16 | #ifndef NOGROUP | ||
17 | #define NOGROUP (-1) | ||
18 | #endif | ||
19 | |||
20 | #define MAXHOSTNAMELEN 64 /* max length of hostname */ | ||
21 | |||
22 | #endif /* _M68K_PARAM_H */ | ||
diff --git a/include/asm-m68k/parport.h b/include/asm-m68k/parport.h new file mode 100644 index 000000000000..646b1872f73b --- /dev/null +++ b/include/asm-m68k/parport.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * parport.h: platform-specific PC-style parport initialisation | ||
3 | * | ||
4 | * Copyright (C) 1999, 2000 Tim Waugh <tim@cyberelk.demon.co.uk> | ||
5 | * | ||
6 | * This file should only be included by drivers/parport/parport_pc.c. | ||
7 | * | ||
8 | * RZ: for use with Q40 and other ISA machines | ||
9 | */ | ||
10 | |||
11 | #ifndef _ASM_M68K_PARPORT_H | ||
12 | #define _ASM_M68K_PARPORT_H 1 | ||
13 | |||
14 | #define insl(port,buf,len) isa_insb(port,buf,(len)<<2) | ||
15 | #define outsl(port,buf,len) isa_outsb(port,buf,(len)<<2) | ||
16 | |||
17 | /* no dma, or IRQ autoprobing */ | ||
18 | static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); | ||
19 | static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) | ||
20 | { | ||
21 | if (! (MACH_IS_Q40)) | ||
22 | return 0; /* count=0 */ | ||
23 | return parport_pc_find_isa_ports (PARPORT_IRQ_NONE, PARPORT_DMA_NONE); | ||
24 | } | ||
25 | |||
26 | #endif /* !(_ASM_M68K_PARPORT_H) */ | ||
diff --git a/include/asm-m68k/pci.h b/include/asm-m68k/pci.h new file mode 100644 index 000000000000..9e7d79ab5d13 --- /dev/null +++ b/include/asm-m68k/pci.h | |||
@@ -0,0 +1,61 @@ | |||
1 | #ifndef _ASM_M68K_PCI_H | ||
2 | #define _ASM_M68K_PCI_H | ||
3 | |||
4 | /* | ||
5 | * asm-m68k/pci_m68k.h - m68k specific PCI declarations. | ||
6 | * | ||
7 | * Written by Wout Klaren. | ||
8 | */ | ||
9 | |||
10 | #include <asm/scatterlist.h> | ||
11 | |||
12 | struct pci_ops; | ||
13 | |||
14 | /* | ||
15 | * Structure with hardware dependent information and functions of the | ||
16 | * PCI bus. | ||
17 | */ | ||
18 | |||
19 | struct pci_bus_info | ||
20 | { | ||
21 | /* | ||
22 | * Resources of the PCI bus. | ||
23 | */ | ||
24 | |||
25 | struct resource mem_space; | ||
26 | struct resource io_space; | ||
27 | |||
28 | /* | ||
29 | * System dependent functions. | ||
30 | */ | ||
31 | |||
32 | struct pci_ops *m68k_pci_ops; | ||
33 | |||
34 | void (*fixup)(int pci_modify); | ||
35 | void (*conf_device)(struct pci_dev *dev); | ||
36 | }; | ||
37 | |||
38 | #define pcibios_assign_all_busses() 0 | ||
39 | #define pcibios_scan_all_fns(a, b) 0 | ||
40 | |||
41 | static inline void pcibios_set_master(struct pci_dev *dev) | ||
42 | { | ||
43 | /* No special bus mastering setup handling */ | ||
44 | } | ||
45 | |||
46 | static inline void pcibios_penalize_isa_irq(int irq) | ||
47 | { | ||
48 | /* We don't do dynamic PCI IRQ allocation */ | ||
49 | } | ||
50 | |||
51 | /* The PCI address space does equal the physical memory | ||
52 | * address space. The networking and block device layers use | ||
53 | * this boolean for bounce buffer decisions. | ||
54 | */ | ||
55 | #define PCI_DMA_BUS_IS_PHYS (1) | ||
56 | |||
57 | static inline void pcibios_add_platform_entries(struct pci_dev *dev) | ||
58 | { | ||
59 | } | ||
60 | |||
61 | #endif /* _ASM_M68K_PCI_H */ | ||
diff --git a/include/asm-m68k/percpu.h b/include/asm-m68k/percpu.h new file mode 100644 index 000000000000..0859d048faf5 --- /dev/null +++ b/include/asm-m68k/percpu.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __ASM_M68K_PERCPU_H | ||
2 | #define __ASM_M68K_PERCPU_H | ||
3 | |||
4 | #include <asm-generic/percpu.h> | ||
5 | |||
6 | #endif /* __ASM_M68K_PERCPU_H */ | ||
diff --git a/include/asm-m68k/pgalloc.h b/include/asm-m68k/pgalloc.h new file mode 100644 index 000000000000..b468b7958aaa --- /dev/null +++ b/include/asm-m68k/pgalloc.h | |||
@@ -0,0 +1,19 @@ | |||
1 | |||
2 | #ifndef M68K_PGALLOC_H | ||
3 | #define M68K_PGALLOC_H | ||
4 | |||
5 | #include <linux/config.h> | ||
6 | #include <linux/mm.h> | ||
7 | #include <linux/highmem.h> | ||
8 | #include <asm/setup.h> | ||
9 | #include <asm/virtconvert.h> | ||
10 | |||
11 | |||
12 | |||
13 | #ifdef CONFIG_SUN3 | ||
14 | #include <asm/sun3_pgalloc.h> | ||
15 | #else | ||
16 | #include <asm/motorola_pgalloc.h> | ||
17 | #endif | ||
18 | |||
19 | #endif /* M68K_PGALLOC_H */ | ||
diff --git a/include/asm-m68k/pgtable.h b/include/asm-m68k/pgtable.h new file mode 100644 index 000000000000..0eef32778df2 --- /dev/null +++ b/include/asm-m68k/pgtable.h | |||
@@ -0,0 +1,191 @@ | |||
1 | #ifndef _M68K_PGTABLE_H | ||
2 | #define _M68K_PGTABLE_H | ||
3 | |||
4 | #include <asm-generic/4level-fixup.h> | ||
5 | |||
6 | #include <linux/config.h> | ||
7 | #include <asm/setup.h> | ||
8 | |||
9 | #ifndef __ASSEMBLY__ | ||
10 | #include <asm/processor.h> | ||
11 | #include <linux/sched.h> | ||
12 | #include <linux/threads.h> | ||
13 | |||
14 | /* | ||
15 | * This file contains the functions and defines necessary to modify and use | ||
16 | * the m68k page table tree. | ||
17 | */ | ||
18 | |||
19 | #include <asm/virtconvert.h> | ||
20 | |||
21 | /* Certain architectures need to do special things when pte's | ||
22 | * within a page table are directly modified. Thus, the following | ||
23 | * hook is made available. | ||
24 | */ | ||
25 | #define set_pte(pteptr, pteval) \ | ||
26 | do{ \ | ||
27 | *(pteptr) = (pteval); \ | ||
28 | } while(0) | ||
29 | #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) | ||
30 | |||
31 | |||
32 | /* PMD_SHIFT determines the size of the area a second-level page table can map */ | ||
33 | #ifdef CONFIG_SUN3 | ||
34 | #define PMD_SHIFT 17 | ||
35 | #else | ||
36 | #define PMD_SHIFT 22 | ||
37 | #endif | ||
38 | #define PMD_SIZE (1UL << PMD_SHIFT) | ||
39 | #define PMD_MASK (~(PMD_SIZE-1)) | ||
40 | |||
41 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | ||
42 | #ifdef CONFIG_SUN3 | ||
43 | #define PGDIR_SHIFT 17 | ||
44 | #else | ||
45 | #define PGDIR_SHIFT 25 | ||
46 | #endif | ||
47 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | ||
48 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | ||
49 | |||
50 | /* | ||
51 | * entries per page directory level: the m68k is configured as three-level, | ||
52 | * so we do have PMD level physically. | ||
53 | */ | ||
54 | #ifdef CONFIG_SUN3 | ||
55 | #define PTRS_PER_PTE 16 | ||
56 | #define PTRS_PER_PMD 1 | ||
57 | #define PTRS_PER_PGD 2048 | ||
58 | #else | ||
59 | #define PTRS_PER_PTE 1024 | ||
60 | #define PTRS_PER_PMD 8 | ||
61 | #define PTRS_PER_PGD 128 | ||
62 | #endif | ||
63 | #define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE) | ||
64 | #define FIRST_USER_PGD_NR 0 | ||
65 | |||
66 | /* Virtual address region for use by kernel_map() */ | ||
67 | #ifdef CONFIG_SUN3 | ||
68 | #define KMAP_START 0x0DC00000 | ||
69 | #define KMAP_END 0x0E000000 | ||
70 | #else | ||
71 | #define KMAP_START 0xd0000000 | ||
72 | #define KMAP_END 0xf0000000 | ||
73 | #endif | ||
74 | |||
75 | #ifndef CONFIG_SUN3 | ||
76 | /* Just any arbitrary offset to the start of the vmalloc VM area: the | ||
77 | * current 8MB value just means that there will be a 8MB "hole" after the | ||
78 | * physical memory until the kernel virtual memory starts. That means that | ||
79 | * any out-of-bounds memory accesses will hopefully be caught. | ||
80 | * The vmalloc() routines leaves a hole of 4kB between each vmalloced | ||
81 | * area for the same reason. ;) | ||
82 | */ | ||
83 | #define VMALLOC_OFFSET (8*1024*1024) | ||
84 | #define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) | ||
85 | #define VMALLOC_END KMAP_START | ||
86 | #else | ||
87 | extern unsigned long vmalloc_end; | ||
88 | #define VMALLOC_START 0x0f800000 | ||
89 | #define VMALLOC_END vmalloc_end | ||
90 | #endif /* CONFIG_SUN3 */ | ||
91 | |||
92 | /* zero page used for uninitialized stuff */ | ||
93 | extern void *empty_zero_page; | ||
94 | |||
95 | /* | ||
96 | * ZERO_PAGE is a global shared page that is always zero: used | ||
97 | * for zero-mapped memory areas etc.. | ||
98 | */ | ||
99 | #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) | ||
100 | |||
101 | /* number of bits that fit into a memory pointer */ | ||
102 | #define BITS_PER_PTR (8*sizeof(unsigned long)) | ||
103 | |||
104 | /* to align the pointer to a pointer address */ | ||
105 | #define PTR_MASK (~(sizeof(void*)-1)) | ||
106 | |||
107 | /* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */ | ||
108 | /* 64-bit machines, beware! SRB. */ | ||
109 | #define SIZEOF_PTR_LOG2 2 | ||
110 | |||
111 | /* | ||
112 | * Check if the addr/len goes up to the end of a physical | ||
113 | * memory chunk. Used for DMA functions. | ||
114 | */ | ||
115 | #ifdef CONFIG_SINGLE_MEMORY_CHUNK | ||
116 | /* | ||
117 | * It makes no sense to consider whether we cross a memory boundary if | ||
118 | * we support just one physical chunk of memory. | ||
119 | */ | ||
120 | static inline int mm_end_of_chunk(unsigned long addr, int len) | ||
121 | { | ||
122 | return 0; | ||
123 | } | ||
124 | #else | ||
125 | int mm_end_of_chunk (unsigned long addr, int len); | ||
126 | #endif | ||
127 | |||
128 | extern void kernel_set_cachemode(void *addr, unsigned long size, int cmode); | ||
129 | |||
130 | /* | ||
131 | * The m68k doesn't have any external MMU info: the kernel page | ||
132 | * tables contain all the necessary information. The Sun3 does, but | ||
133 | * they are updated on demand. | ||
134 | */ | ||
135 | static inline void update_mmu_cache(struct vm_area_struct *vma, | ||
136 | unsigned long address, pte_t pte) | ||
137 | { | ||
138 | } | ||
139 | |||
140 | #endif /* !__ASSEMBLY__ */ | ||
141 | |||
142 | #define kern_addr_valid(addr) (1) | ||
143 | |||
144 | #define io_remap_page_range(vma, vaddr, paddr, size, prot) \ | ||
145 | remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot) | ||
146 | |||
147 | #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ | ||
148 | remap_pfn_range(vma, vaddr, pfn, size, prot) | ||
149 | |||
150 | #define MK_IOSPACE_PFN(space, pfn) (pfn) | ||
151 | #define GET_IOSPACE(pfn) 0 | ||
152 | #define GET_PFN(pfn) (pfn) | ||
153 | |||
154 | /* MMU-specific headers */ | ||
155 | |||
156 | #ifdef CONFIG_SUN3 | ||
157 | #include <asm/sun3_pgtable.h> | ||
158 | #else | ||
159 | #include <asm/motorola_pgtable.h> | ||
160 | #endif | ||
161 | |||
162 | #ifndef __ASSEMBLY__ | ||
163 | #include <asm-generic/pgtable.h> | ||
164 | |||
165 | /* | ||
166 | * Macro to mark a page protection value as "uncacheable". | ||
167 | */ | ||
168 | #ifdef SUN3_PAGE_NOCACHE | ||
169 | # define __SUN3_PAGE_NOCACHE SUN3_PAGE_NOCACHE | ||
170 | #else | ||
171 | # define __SUN3_PAGE_NOCACHE 0 | ||
172 | #endif | ||
173 | #define pgprot_noncached(prot) \ | ||
174 | (MMU_IS_SUN3 \ | ||
175 | ? (__pgprot(pgprot_val(prot) | __SUN3_PAGE_NOCACHE)) \ | ||
176 | : ((MMU_IS_851 || MMU_IS_030) \ | ||
177 | ? (__pgprot(pgprot_val(prot) | _PAGE_NOCACHE030)) \ | ||
178 | : (MMU_IS_040 || MMU_IS_060) \ | ||
179 | ? (__pgprot((pgprot_val(prot) & _CACHEMASK040) | _PAGE_NOCACHE_S)) \ | ||
180 | : (prot))) | ||
181 | |||
182 | #endif /* !__ASSEMBLY__ */ | ||
183 | |||
184 | /* | ||
185 | * No page table caches to initialise | ||
186 | */ | ||
187 | #define pgtable_cache_init() do { } while (0) | ||
188 | |||
189 | #define check_pgt_cache() do { } while (0) | ||
190 | |||
191 | #endif /* _M68K_PGTABLE_H */ | ||
diff --git a/include/asm-m68k/poll.h b/include/asm-m68k/poll.h new file mode 100644 index 000000000000..c4b69c4a87e1 --- /dev/null +++ b/include/asm-m68k/poll.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef __m68k_POLL_H | ||
2 | #define __m68k_POLL_H | ||
3 | |||
4 | #define POLLIN 1 | ||
5 | #define POLLPRI 2 | ||
6 | #define POLLOUT 4 | ||
7 | #define POLLERR 8 | ||
8 | #define POLLHUP 16 | ||
9 | #define POLLNVAL 32 | ||
10 | #define POLLRDNORM 64 | ||
11 | #define POLLWRNORM POLLOUT | ||
12 | #define POLLRDBAND 128 | ||
13 | #define POLLWRBAND 256 | ||
14 | #define POLLMSG 0x0400 | ||
15 | #define POLLREMOVE 0x1000 | ||
16 | |||
17 | struct pollfd { | ||
18 | int fd; | ||
19 | short events; | ||
20 | short revents; | ||
21 | }; | ||
22 | |||
23 | #endif | ||
diff --git a/include/asm-m68k/posix_types.h b/include/asm-m68k/posix_types.h new file mode 100644 index 000000000000..fa166ee30286 --- /dev/null +++ b/include/asm-m68k/posix_types.h | |||
@@ -0,0 +1,65 @@ | |||
1 | #ifndef __ARCH_M68K_POSIX_TYPES_H | ||
2 | #define __ARCH_M68K_POSIX_TYPES_H | ||
3 | |||
4 | /* | ||
5 | * This file is generally used by user-level software, so you need to | ||
6 | * be a little careful about namespace pollution etc. Also, we cannot | ||
7 | * assume GCC is being used. | ||
8 | */ | ||
9 | |||
10 | typedef unsigned long __kernel_ino_t; | ||
11 | typedef unsigned short __kernel_mode_t; | ||
12 | typedef unsigned short __kernel_nlink_t; | ||
13 | typedef long __kernel_off_t; | ||
14 | typedef int __kernel_pid_t; | ||
15 | typedef unsigned short __kernel_ipc_pid_t; | ||
16 | typedef unsigned short __kernel_uid_t; | ||
17 | typedef unsigned short __kernel_gid_t; | ||
18 | typedef unsigned int __kernel_size_t; | ||
19 | typedef int __kernel_ssize_t; | ||
20 | typedef int __kernel_ptrdiff_t; | ||
21 | typedef long __kernel_time_t; | ||
22 | typedef long __kernel_suseconds_t; | ||
23 | typedef long __kernel_clock_t; | ||
24 | typedef int __kernel_timer_t; | ||
25 | typedef int __kernel_clockid_t; | ||
26 | typedef int __kernel_daddr_t; | ||
27 | typedef char * __kernel_caddr_t; | ||
28 | typedef unsigned short __kernel_uid16_t; | ||
29 | typedef unsigned short __kernel_gid16_t; | ||
30 | typedef unsigned int __kernel_uid32_t; | ||
31 | typedef unsigned int __kernel_gid32_t; | ||
32 | |||
33 | typedef unsigned short __kernel_old_uid_t; | ||
34 | typedef unsigned short __kernel_old_gid_t; | ||
35 | typedef unsigned short __kernel_old_dev_t; | ||
36 | |||
37 | #ifdef __GNUC__ | ||
38 | typedef long long __kernel_loff_t; | ||
39 | #endif | ||
40 | |||
41 | typedef struct { | ||
42 | #if defined(__KERNEL__) || defined(__USE_ALL) | ||
43 | int val[2]; | ||
44 | #else /* !defined(__KERNEL__) && !defined(__USE_ALL) */ | ||
45 | int __val[2]; | ||
46 | #endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ | ||
47 | } __kernel_fsid_t; | ||
48 | |||
49 | #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) | ||
50 | |||
51 | #undef __FD_SET | ||
52 | #define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) | ||
53 | |||
54 | #undef __FD_CLR | ||
55 | #define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) | ||
56 | |||
57 | #undef __FD_ISSET | ||
58 | #define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) | ||
59 | |||
60 | #undef __FD_ZERO | ||
61 | #define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp))) | ||
62 | |||
63 | #endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ | ||
64 | |||
65 | #endif | ||
diff --git a/include/asm-m68k/processor.h b/include/asm-m68k/processor.h new file mode 100644 index 000000000000..df1575db32af --- /dev/null +++ b/include/asm-m68k/processor.h | |||
@@ -0,0 +1,140 @@ | |||
1 | /* | ||
2 | * include/asm-m68k/processor.h | ||
3 | * | ||
4 | * Copyright (C) 1995 Hamish Macdonald | ||
5 | */ | ||
6 | |||
7 | #ifndef __ASM_M68K_PROCESSOR_H | ||
8 | #define __ASM_M68K_PROCESSOR_H | ||
9 | |||
10 | /* | ||
11 | * Default implementation of macro that returns current | ||
12 | * instruction pointer ("program counter"). | ||
13 | */ | ||
14 | #define current_text_addr() ({ __label__ _l; _l: &&_l;}) | ||
15 | |||
16 | #include <linux/config.h> | ||
17 | #include <asm/segment.h> | ||
18 | #include <asm/fpu.h> | ||
19 | #include <asm/ptrace.h> | ||
20 | |||
21 | static inline unsigned long rdusp(void) | ||
22 | { | ||
23 | unsigned long usp; | ||
24 | |||
25 | __asm__ __volatile__("move %/usp,%0" : "=a" (usp)); | ||
26 | return usp; | ||
27 | } | ||
28 | |||
29 | static inline void wrusp(unsigned long usp) | ||
30 | { | ||
31 | __asm__ __volatile__("move %0,%/usp" : : "a" (usp)); | ||
32 | } | ||
33 | |||
34 | /* | ||
35 | * User space process size: 3.75GB. This is hardcoded into a few places, | ||
36 | * so don't change it unless you know what you are doing. | ||
37 | */ | ||
38 | #ifndef CONFIG_SUN3 | ||
39 | #define TASK_SIZE (0xF0000000UL) | ||
40 | #else | ||
41 | #ifdef __ASSEMBLY__ | ||
42 | #define TASK_SIZE (0x0E000000) | ||
43 | #else | ||
44 | #define TASK_SIZE (0x0E000000UL) | ||
45 | #endif | ||
46 | #endif | ||
47 | |||
48 | /* This decides where the kernel will search for a free chunk of vm | ||
49 | * space during mmap's. | ||
50 | */ | ||
51 | #ifndef CONFIG_SUN3 | ||
52 | #define TASK_UNMAPPED_BASE 0xC0000000UL | ||
53 | #else | ||
54 | #define TASK_UNMAPPED_BASE 0x0A000000UL | ||
55 | #endif | ||
56 | #define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr) | ||
57 | |||
58 | struct task_work { | ||
59 | unsigned char sigpending; | ||
60 | unsigned char notify_resume; /* request for notification on | ||
61 | userspace execution resumption */ | ||
62 | char need_resched; | ||
63 | unsigned char delayed_trace; /* single step a syscall */ | ||
64 | unsigned char syscall_trace; /* count of syscall interceptors */ | ||
65 | unsigned char memdie; /* task was selected to be killed */ | ||
66 | unsigned char pad[2]; | ||
67 | }; | ||
68 | |||
69 | struct thread_struct { | ||
70 | unsigned long ksp; /* kernel stack pointer */ | ||
71 | unsigned long usp; /* user stack pointer */ | ||
72 | unsigned short sr; /* saved status register */ | ||
73 | unsigned short fs; /* saved fs (sfc, dfc) */ | ||
74 | unsigned long crp[2]; /* cpu root pointer */ | ||
75 | unsigned long esp0; /* points to SR of stack frame */ | ||
76 | unsigned long faddr; /* info about last fault */ | ||
77 | int signo, code; | ||
78 | unsigned long fp[8*3]; | ||
79 | unsigned long fpcntl[3]; /* fp control regs */ | ||
80 | unsigned char fpstate[FPSTATESIZE]; /* floating point state */ | ||
81 | struct task_work work; | ||
82 | }; | ||
83 | |||
84 | #define INIT_THREAD { \ | ||
85 | ksp: sizeof(init_stack) + (unsigned long) init_stack, \ | ||
86 | sr: PS_S, \ | ||
87 | fs: __KERNEL_DS, \ | ||
88 | info: INIT_THREAD_INFO(init_task) \ | ||
89 | } | ||
90 | |||
91 | /* | ||
92 | * Do necessary setup to start up a newly executed thread. | ||
93 | */ | ||
94 | static inline void start_thread(struct pt_regs * regs, unsigned long pc, | ||
95 | unsigned long usp) | ||
96 | { | ||
97 | /* reads from user space */ | ||
98 | set_fs(USER_DS); | ||
99 | |||
100 | regs->pc = pc; | ||
101 | regs->sr &= ~0x2000; | ||
102 | wrusp(usp); | ||
103 | } | ||
104 | |||
105 | /* Forward declaration, a strange C thing */ | ||
106 | struct task_struct; | ||
107 | |||
108 | /* Free all resources held by a thread. */ | ||
109 | static inline void release_thread(struct task_struct *dead_task) | ||
110 | { | ||
111 | } | ||
112 | |||
113 | /* Prepare to copy thread state - unlazy all lazy status */ | ||
114 | #define prepare_to_copy(tsk) do { } while (0) | ||
115 | |||
116 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
117 | |||
118 | /* | ||
119 | * Free current thread data structures etc.. | ||
120 | */ | ||
121 | static inline void exit_thread(void) | ||
122 | { | ||
123 | } | ||
124 | |||
125 | extern unsigned long thread_saved_pc(struct task_struct *tsk); | ||
126 | |||
127 | unsigned long get_wchan(struct task_struct *p); | ||
128 | |||
129 | #define KSTK_EIP(tsk) \ | ||
130 | ({ \ | ||
131 | unsigned long eip = 0; \ | ||
132 | if ((tsk)->thread.esp0 > PAGE_SIZE && \ | ||
133 | (virt_addr_valid((tsk)->thread.esp0))) \ | ||
134 | eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \ | ||
135 | eip; }) | ||
136 | #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp) | ||
137 | |||
138 | #define cpu_relax() barrier() | ||
139 | |||
140 | #endif | ||
diff --git a/include/asm-m68k/ptrace.h b/include/asm-m68k/ptrace.h new file mode 100644 index 000000000000..57e763d79bf4 --- /dev/null +++ b/include/asm-m68k/ptrace.h | |||
@@ -0,0 +1,80 @@ | |||
1 | #ifndef _M68K_PTRACE_H | ||
2 | #define _M68K_PTRACE_H | ||
3 | |||
4 | #define PT_D1 0 | ||
5 | #define PT_D2 1 | ||
6 | #define PT_D3 2 | ||
7 | #define PT_D4 3 | ||
8 | #define PT_D5 4 | ||
9 | #define PT_D6 5 | ||
10 | #define PT_D7 6 | ||
11 | #define PT_A0 7 | ||
12 | #define PT_A1 8 | ||
13 | #define PT_A2 9 | ||
14 | #define PT_A3 10 | ||
15 | #define PT_A4 11 | ||
16 | #define PT_A5 12 | ||
17 | #define PT_A6 13 | ||
18 | #define PT_D0 14 | ||
19 | #define PT_USP 15 | ||
20 | #define PT_ORIG_D0 16 | ||
21 | #define PT_SR 17 | ||
22 | #define PT_PC 18 | ||
23 | |||
24 | #ifndef __ASSEMBLY__ | ||
25 | |||
26 | /* this struct defines the way the registers are stored on the | ||
27 | stack during a system call. */ | ||
28 | |||
29 | struct pt_regs { | ||
30 | long d1; | ||
31 | long d2; | ||
32 | long d3; | ||
33 | long d4; | ||
34 | long d5; | ||
35 | long a0; | ||
36 | long a1; | ||
37 | long a2; | ||
38 | long d0; | ||
39 | long orig_d0; | ||
40 | long stkadj; | ||
41 | unsigned short sr; | ||
42 | unsigned long pc; | ||
43 | unsigned format : 4; /* frame format specifier */ | ||
44 | unsigned vector : 12; /* vector offset */ | ||
45 | }; | ||
46 | |||
47 | /* | ||
48 | * This is the extended stack used by signal handlers and the context | ||
49 | * switcher: it's pushed after the normal "struct pt_regs". | ||
50 | */ | ||
51 | struct switch_stack { | ||
52 | unsigned long d6; | ||
53 | unsigned long d7; | ||
54 | unsigned long a3; | ||
55 | unsigned long a4; | ||
56 | unsigned long a5; | ||
57 | unsigned long a6; | ||
58 | unsigned long retpc; | ||
59 | }; | ||
60 | |||
61 | /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ | ||
62 | #define PTRACE_GETREGS 12 | ||
63 | #define PTRACE_SETREGS 13 | ||
64 | #define PTRACE_GETFPREGS 14 | ||
65 | #define PTRACE_SETFPREGS 15 | ||
66 | |||
67 | #ifdef __KERNEL__ | ||
68 | |||
69 | #ifndef PS_S | ||
70 | #define PS_S (0x2000) | ||
71 | #define PS_M (0x1000) | ||
72 | #endif | ||
73 | |||
74 | #define user_mode(regs) (!((regs)->sr & PS_S)) | ||
75 | #define instruction_pointer(regs) ((regs)->pc) | ||
76 | #define profile_pc(regs) instruction_pointer(regs) | ||
77 | extern void show_regs(struct pt_regs *); | ||
78 | #endif /* __KERNEL__ */ | ||
79 | #endif /* __ASSEMBLY__ */ | ||
80 | #endif /* _M68K_PTRACE_H */ | ||
diff --git a/include/asm-m68k/q40_master.h b/include/asm-m68k/q40_master.h new file mode 100644 index 000000000000..3907a09d4fca --- /dev/null +++ b/include/asm-m68k/q40_master.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * Q40 master Chip Control | ||
3 | * RTC stuff merged for compactnes.. | ||
4 | */ | ||
5 | |||
6 | #ifndef _Q40_MASTER_H | ||
7 | #define _Q40_MASTER_H | ||
8 | |||
9 | #include <asm/raw_io.h> | ||
10 | |||
11 | |||
12 | #define q40_master_addr 0xff000000 | ||
13 | |||
14 | #define IIRQ_REG 0x0 /* internal IRQ reg */ | ||
15 | #define EIRQ_REG 0x4 /* external ... */ | ||
16 | #define KEYCODE_REG 0x1c /* value of received scancode */ | ||
17 | #define DISPLAY_CONTROL_REG 0x18 | ||
18 | #define FRAME_CLEAR_REG 0x24 | ||
19 | #define LED_REG 0x30 | ||
20 | |||
21 | #define Q40_LED_ON() master_outb(1,LED_REG) | ||
22 | #define Q40_LED_OFF() master_outb(0,LED_REG) | ||
23 | |||
24 | #define INTERRUPT_REG IIRQ_REG /* "native" ints */ | ||
25 | #define KEY_IRQ_ENABLE_REG 0x08 /**/ | ||
26 | #define KEYBOARD_UNLOCK_REG 0x20 /* clear kb int */ | ||
27 | |||
28 | #define SAMPLE_ENABLE_REG 0x14 /* generate SAMPLE ints */ | ||
29 | #define SAMPLE_RATE_REG 0x2c | ||
30 | #define SAMPLE_CLEAR_REG 0x28 | ||
31 | #define SAMPLE_LOW 0x00 | ||
32 | #define SAMPLE_HIGH 0x01 | ||
33 | |||
34 | #define FRAME_RATE_REG 0x38 /* generate FRAME ints at 200 HZ rate */ | ||
35 | |||
36 | #if 0 | ||
37 | #define SER_ENABLE_REG 0x0c /* allow serial ints to be generated */ | ||
38 | #endif | ||
39 | #define EXT_ENABLE_REG 0x10 /* ... rest of the ISA ints ... */ | ||
40 | |||
41 | |||
42 | #define master_inb(_reg_) in_8((unsigned char *)q40_master_addr+_reg_) | ||
43 | #define master_outb(_b_,_reg_) out_8((unsigned char *)q40_master_addr+_reg_,_b_) | ||
44 | |||
45 | /* RTC defines */ | ||
46 | |||
47 | #define Q40_RTC_BASE (0xff021ffc) | ||
48 | |||
49 | #define Q40_RTC_YEAR (*(volatile unsigned char *)(Q40_RTC_BASE+0)) | ||
50 | #define Q40_RTC_MNTH (*(volatile unsigned char *)(Q40_RTC_BASE-4)) | ||
51 | #define Q40_RTC_DATE (*(volatile unsigned char *)(Q40_RTC_BASE-8)) | ||
52 | #define Q40_RTC_DOW (*(volatile unsigned char *)(Q40_RTC_BASE-12)) | ||
53 | #define Q40_RTC_HOUR (*(volatile unsigned char *)(Q40_RTC_BASE-16)) | ||
54 | #define Q40_RTC_MINS (*(volatile unsigned char *)(Q40_RTC_BASE-20)) | ||
55 | #define Q40_RTC_SECS (*(volatile unsigned char *)(Q40_RTC_BASE-24)) | ||
56 | #define Q40_RTC_CTRL (*(volatile unsigned char *)(Q40_RTC_BASE-28)) | ||
57 | |||
58 | /* some control bits */ | ||
59 | #define Q40_RTC_READ 64 /* prepare for reading */ | ||
60 | #define Q40_RTC_WRITE 128 | ||
61 | |||
62 | /* define some Q40 specific ints */ | ||
63 | #include "q40ints.h" | ||
64 | |||
65 | /* misc defs */ | ||
66 | #define DAC_LEFT ((unsigned char *)0xff008000) | ||
67 | #define DAC_RIGHT ((unsigned char *)0xff008004) | ||
68 | |||
69 | #endif /* _Q40_MASTER_H */ | ||
diff --git a/include/asm-m68k/q40ints.h b/include/asm-m68k/q40ints.h new file mode 100644 index 000000000000..3d970afb708f --- /dev/null +++ b/include/asm-m68k/q40ints.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * contains some Q40 related interrupt definitions | ||
3 | */ | ||
4 | |||
5 | #define Q40_IRQ_MAX (34) | ||
6 | |||
7 | #define Q40_IRQ_SAMPLE (34) | ||
8 | #define Q40_IRQ_KEYBOARD (32) | ||
9 | #define Q40_IRQ_FRAME (33) | ||
10 | |||
11 | |||
12 | /* masks for interrupt regiosters*/ | ||
13 | /* internal, IIRQ_REG */ | ||
14 | #define Q40_IRQ_KEYB_MASK (2) | ||
15 | #define Q40_IRQ_SER_MASK (1<<2) | ||
16 | #define Q40_IRQ_FRAME_MASK (1<<3) | ||
17 | #define Q40_IRQ_EXT_MASK (1<<4) /* is a EIRQ */ | ||
18 | /* eirq, EIRQ_REG */ | ||
19 | #define Q40_IRQ3_MASK (1) | ||
20 | #define Q40_IRQ4_MASK (1<<1) | ||
21 | #define Q40_IRQ5_MASK (1<<2) | ||
22 | #define Q40_IRQ6_MASK (1<<3) | ||
23 | #define Q40_IRQ7_MASK (1<<4) | ||
24 | #define Q40_IRQ10_MASK (1<<5) | ||
25 | #define Q40_IRQ14_MASK (1<<6) | ||
26 | #define Q40_IRQ15_MASK (1<<7) | ||
27 | |||
28 | extern unsigned long q40_probe_irq_on (void); | ||
29 | extern int q40_probe_irq_off (unsigned long irqs); | ||
diff --git a/include/asm-m68k/raw_io.h b/include/asm-m68k/raw_io.h new file mode 100644 index 000000000000..041f0a87b25d --- /dev/null +++ b/include/asm-m68k/raw_io.h | |||
@@ -0,0 +1,342 @@ | |||
1 | /* | ||
2 | * linux/include/asm-m68k/raw_io.h | ||
3 | * | ||
4 | * 10/20/00 RZ: - created from bits of io.h and ide.h to cleanup namespace | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #ifndef _RAW_IO_H | ||
9 | #define _RAW_IO_H | ||
10 | |||
11 | #ifdef __KERNEL__ | ||
12 | |||
13 | #include <asm/types.h> | ||
14 | |||
15 | |||
16 | /* Values for nocacheflag and cmode */ | ||
17 | #define IOMAP_FULL_CACHING 0 | ||
18 | #define IOMAP_NOCACHE_SER 1 | ||
19 | #define IOMAP_NOCACHE_NONSER 2 | ||
20 | #define IOMAP_WRITETHROUGH 3 | ||
21 | |||
22 | extern void iounmap(void *addr); | ||
23 | |||
24 | extern void *__ioremap(unsigned long physaddr, unsigned long size, | ||
25 | int cacheflag); | ||
26 | extern void __iounmap(void *addr, unsigned long size); | ||
27 | |||
28 | |||
29 | /* ++roman: The assignments to temp. vars avoid that gcc sometimes generates | ||
30 | * two accesses to memory, which may be undesirable for some devices. | ||
31 | */ | ||
32 | #define in_8(addr) \ | ||
33 | ({ u8 __v = (*(volatile u8 *) (addr)); __v; }) | ||
34 | #define in_be16(addr) \ | ||
35 | ({ u16 __v = (*(volatile u16 *) (addr)); __v; }) | ||
36 | #define in_be32(addr) \ | ||
37 | ({ u32 __v = (*(volatile u32 *) (addr)); __v; }) | ||
38 | #define in_le16(addr) \ | ||
39 | ({ u16 __v = le16_to_cpu(*(volatile u16 *) (addr)); __v; }) | ||
40 | #define in_le32(addr) \ | ||
41 | ({ u32 __v = le32_to_cpu(*(volatile u32 *) (addr)); __v; }) | ||
42 | |||
43 | #define out_8(addr,b) (void)((*(volatile u8 *) (addr)) = (b)) | ||
44 | #define out_be16(addr,w) (void)((*(volatile u16 *) (addr)) = (w)) | ||
45 | #define out_be32(addr,l) (void)((*(volatile u32 *) (addr)) = (l)) | ||
46 | #define out_le16(addr,w) (void)((*(volatile u16 *) (addr)) = cpu_to_le16(w)) | ||
47 | #define out_le32(addr,l) (void)((*(volatile u32 *) (addr)) = cpu_to_le32(l)) | ||
48 | |||
49 | #define raw_inb in_8 | ||
50 | #define raw_inw in_be16 | ||
51 | #define raw_inl in_be32 | ||
52 | |||
53 | #define raw_outb(val,port) out_8((port),(val)) | ||
54 | #define raw_outw(val,port) out_be16((port),(val)) | ||
55 | #define raw_outl(val,port) out_be32((port),(val)) | ||
56 | |||
57 | static inline void raw_insb(volatile u8 *port, u8 *buf, unsigned int len) | ||
58 | { | ||
59 | unsigned int i; | ||
60 | |||
61 | for (i = 0; i < len; i++) | ||
62 | *buf++ = in_8(port); | ||
63 | } | ||
64 | |||
65 | static inline void raw_outsb(volatile u8 *port, const u8 *buf, | ||
66 | unsigned int len) | ||
67 | { | ||
68 | unsigned int i; | ||
69 | |||
70 | for (i = 0; i < len; i++) | ||
71 | out_8(port, *buf++); | ||
72 | } | ||
73 | |||
74 | static inline void raw_insw(volatile u16 *port, u16 *buf, unsigned int nr) | ||
75 | { | ||
76 | unsigned int tmp; | ||
77 | |||
78 | if (nr & 15) { | ||
79 | tmp = (nr & 15) - 1; | ||
80 | asm volatile ( | ||
81 | "1: movew %2@,%0@+; dbra %1,1b" | ||
82 | : "=a" (buf), "=d" (tmp) | ||
83 | : "a" (port), "0" (buf), | ||
84 | "1" (tmp)); | ||
85 | } | ||
86 | if (nr >> 4) { | ||
87 | tmp = (nr >> 4) - 1; | ||
88 | asm volatile ( | ||
89 | "1: " | ||
90 | "movew %2@,%0@+; " | ||
91 | "movew %2@,%0@+; " | ||
92 | "movew %2@,%0@+; " | ||
93 | "movew %2@,%0@+; " | ||
94 | "movew %2@,%0@+; " | ||
95 | "movew %2@,%0@+; " | ||
96 | "movew %2@,%0@+; " | ||
97 | "movew %2@,%0@+; " | ||
98 | "movew %2@,%0@+; " | ||
99 | "movew %2@,%0@+; " | ||
100 | "movew %2@,%0@+; " | ||
101 | "movew %2@,%0@+; " | ||
102 | "movew %2@,%0@+; " | ||
103 | "movew %2@,%0@+; " | ||
104 | "movew %2@,%0@+; " | ||
105 | "movew %2@,%0@+; " | ||
106 | "dbra %1,1b" | ||
107 | : "=a" (buf), "=d" (tmp) | ||
108 | : "a" (port), "0" (buf), | ||
109 | "1" (tmp)); | ||
110 | } | ||
111 | } | ||
112 | |||
113 | static inline void raw_outsw(volatile u16 *port, const u16 *buf, | ||
114 | unsigned int nr) | ||
115 | { | ||
116 | unsigned int tmp; | ||
117 | |||
118 | if (nr & 15) { | ||
119 | tmp = (nr & 15) - 1; | ||
120 | asm volatile ( | ||
121 | "1: movew %0@+,%2@; dbra %1,1b" | ||
122 | : "=a" (buf), "=d" (tmp) | ||
123 | : "a" (port), "0" (buf), | ||
124 | "1" (tmp)); | ||
125 | } | ||
126 | if (nr >> 4) { | ||
127 | tmp = (nr >> 4) - 1; | ||
128 | asm volatile ( | ||
129 | "1: " | ||
130 | "movew %0@+,%2@; " | ||
131 | "movew %0@+,%2@; " | ||
132 | "movew %0@+,%2@; " | ||
133 | "movew %0@+,%2@; " | ||
134 | "movew %0@+,%2@; " | ||
135 | "movew %0@+,%2@; " | ||
136 | "movew %0@+,%2@; " | ||
137 | "movew %0@+,%2@; " | ||
138 | "movew %0@+,%2@; " | ||
139 | "movew %0@+,%2@; " | ||
140 | "movew %0@+,%2@; " | ||
141 | "movew %0@+,%2@; " | ||
142 | "movew %0@+,%2@; " | ||
143 | "movew %0@+,%2@; " | ||
144 | "movew %0@+,%2@; " | ||
145 | "movew %0@+,%2@; " | ||
146 | "dbra %1,1b" | ||
147 | : "=a" (buf), "=d" (tmp) | ||
148 | : "a" (port), "0" (buf), | ||
149 | "1" (tmp)); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | static inline void raw_insl(volatile u32 *port, u32 *buf, unsigned int nr) | ||
154 | { | ||
155 | unsigned int tmp; | ||
156 | |||
157 | if (nr & 15) { | ||
158 | tmp = (nr & 15) - 1; | ||
159 | asm volatile ( | ||
160 | "1: movel %2@,%0@+; dbra %1,1b" | ||
161 | : "=a" (buf), "=d" (tmp) | ||
162 | : "a" (port), "0" (buf), | ||
163 | "1" (tmp)); | ||
164 | } | ||
165 | if (nr >> 4) { | ||
166 | tmp = (nr >> 4) - 1; | ||
167 | asm volatile ( | ||
168 | "1: " | ||
169 | "movel %2@,%0@+; " | ||
170 | "movel %2@,%0@+; " | ||
171 | "movel %2@,%0@+; " | ||
172 | "movel %2@,%0@+; " | ||
173 | "movel %2@,%0@+; " | ||
174 | "movel %2@,%0@+; " | ||
175 | "movel %2@,%0@+; " | ||
176 | "movel %2@,%0@+; " | ||
177 | "movel %2@,%0@+; " | ||
178 | "movel %2@,%0@+; " | ||
179 | "movel %2@,%0@+; " | ||
180 | "movel %2@,%0@+; " | ||
181 | "movel %2@,%0@+; " | ||
182 | "movel %2@,%0@+; " | ||
183 | "movel %2@,%0@+; " | ||
184 | "movel %2@,%0@+; " | ||
185 | "dbra %1,1b" | ||
186 | : "=a" (buf), "=d" (tmp) | ||
187 | : "a" (port), "0" (buf), | ||
188 | "1" (tmp)); | ||
189 | } | ||
190 | } | ||
191 | |||
192 | static inline void raw_outsl(volatile u32 *port, const u32 *buf, | ||
193 | unsigned int nr) | ||
194 | { | ||
195 | unsigned int tmp; | ||
196 | |||
197 | if (nr & 15) { | ||
198 | tmp = (nr & 15) - 1; | ||
199 | asm volatile ( | ||
200 | "1: movel %0@+,%2@; dbra %1,1b" | ||
201 | : "=a" (buf), "=d" (tmp) | ||
202 | : "a" (port), "0" (buf), | ||
203 | "1" (tmp)); | ||
204 | } | ||
205 | if (nr >> 4) { | ||
206 | tmp = (nr >> 4) - 1; | ||
207 | asm volatile ( | ||
208 | "1: " | ||
209 | "movel %0@+,%2@; " | ||
210 | "movel %0@+,%2@; " | ||
211 | "movel %0@+,%2@; " | ||
212 | "movel %0@+,%2@; " | ||
213 | "movel %0@+,%2@; " | ||
214 | "movel %0@+,%2@; " | ||
215 | "movel %0@+,%2@; " | ||
216 | "movel %0@+,%2@; " | ||
217 | "movel %0@+,%2@; " | ||
218 | "movel %0@+,%2@; " | ||
219 | "movel %0@+,%2@; " | ||
220 | "movel %0@+,%2@; " | ||
221 | "movel %0@+,%2@; " | ||
222 | "movel %0@+,%2@; " | ||
223 | "movel %0@+,%2@; " | ||
224 | "movel %0@+,%2@; " | ||
225 | "dbra %1,1b" | ||
226 | : "=a" (buf), "=d" (tmp) | ||
227 | : "a" (port), "0" (buf), | ||
228 | "1" (tmp)); | ||
229 | } | ||
230 | } | ||
231 | |||
232 | |||
233 | static inline void raw_insw_swapw(volatile u16 *port, u16 *buf, | ||
234 | unsigned int nr) | ||
235 | { | ||
236 | if ((nr) % 8) | ||
237 | __asm__ __volatile__ | ||
238 | ("\tmovel %0,%/a0\n\t" | ||
239 | "movel %1,%/a1\n\t" | ||
240 | "movel %2,%/d6\n\t" | ||
241 | "subql #1,%/d6\n" | ||
242 | "1:\tmovew %/a0@,%/d0\n\t" | ||
243 | "rolw #8,%/d0\n\t" | ||
244 | "movew %/d0,%/a1@+\n\t" | ||
245 | "dbra %/d6,1b" | ||
246 | : | ||
247 | : "g" (port), "g" (buf), "g" (nr) | ||
248 | : "d0", "a0", "a1", "d6"); | ||
249 | else | ||
250 | __asm__ __volatile__ | ||
251 | ("movel %0,%/a0\n\t" | ||
252 | "movel %1,%/a1\n\t" | ||
253 | "movel %2,%/d6\n\t" | ||
254 | "lsrl #3,%/d6\n\t" | ||
255 | "subql #1,%/d6\n" | ||
256 | "1:\tmovew %/a0@,%/d0\n\t" | ||
257 | "rolw #8,%/d0\n\t" | ||
258 | "movew %/d0,%/a1@+\n\t" | ||
259 | "movew %/a0@,%/d0\n\t" | ||
260 | "rolw #8,%/d0\n\t" | ||
261 | "movew %/d0,%/a1@+\n\t" | ||
262 | "movew %/a0@,%/d0\n\t" | ||
263 | "rolw #8,%/d0\n\t" | ||
264 | "movew %/d0,%/a1@+\n\t" | ||
265 | "movew %/a0@,%/d0\n\t" | ||
266 | "rolw #8,%/d0\n\t" | ||
267 | "movew %/d0,%/a1@+\n\t" | ||
268 | "movew %/a0@,%/d0\n\t" | ||
269 | "rolw #8,%/d0\n\t" | ||
270 | "movew %/d0,%/a1@+\n\t" | ||
271 | "movew %/a0@,%/d0\n\t" | ||
272 | "rolw #8,%/d0\n\t" | ||
273 | "movew %/d0,%/a1@+\n\t" | ||
274 | "movew %/a0@,%/d0\n\t" | ||
275 | "rolw #8,%/d0\n\t" | ||
276 | "movew %/d0,%/a1@+\n\t" | ||
277 | "movew %/a0@,%/d0\n\t" | ||
278 | "rolw #8,%/d0\n\t" | ||
279 | "movew %/d0,%/a1@+\n\t" | ||
280 | "dbra %/d6,1b" | ||
281 | : | ||
282 | : "g" (port), "g" (buf), "g" (nr) | ||
283 | : "d0", "a0", "a1", "d6"); | ||
284 | } | ||
285 | |||
286 | static inline void raw_outsw_swapw(volatile u16 *port, const u16 *buf, | ||
287 | unsigned int nr) | ||
288 | { | ||
289 | if ((nr) % 8) | ||
290 | __asm__ __volatile__ | ||
291 | ("movel %0,%/a0\n\t" | ||
292 | "movel %1,%/a1\n\t" | ||
293 | "movel %2,%/d6\n\t" | ||
294 | "subql #1,%/d6\n" | ||
295 | "1:\tmovew %/a1@+,%/d0\n\t" | ||
296 | "rolw #8,%/d0\n\t" | ||
297 | "movew %/d0,%/a0@\n\t" | ||
298 | "dbra %/d6,1b" | ||
299 | : | ||
300 | : "g" (port), "g" (buf), "g" (nr) | ||
301 | : "d0", "a0", "a1", "d6"); | ||
302 | else | ||
303 | __asm__ __volatile__ | ||
304 | ("movel %0,%/a0\n\t" | ||
305 | "movel %1,%/a1\n\t" | ||
306 | "movel %2,%/d6\n\t" | ||
307 | "lsrl #3,%/d6\n\t" | ||
308 | "subql #1,%/d6\n" | ||
309 | "1:\tmovew %/a1@+,%/d0\n\t" | ||
310 | "rolw #8,%/d0\n\t" | ||
311 | "movew %/d0,%/a0@\n\t" | ||
312 | "movew %/a1@+,%/d0\n\t" | ||
313 | "rolw #8,%/d0\n\t" | ||
314 | "movew %/d0,%/a0@\n\t" | ||
315 | "movew %/a1@+,%/d0\n\t" | ||
316 | "rolw #8,%/d0\n\t" | ||
317 | "movew %/d0,%/a0@\n\t" | ||
318 | "movew %/a1@+,%/d0\n\t" | ||
319 | "rolw #8,%/d0\n\t" | ||
320 | "movew %/d0,%/a0@\n\t" | ||
321 | "movew %/a1@+,%/d0\n\t" | ||
322 | "rolw #8,%/d0\n\t" | ||
323 | "movew %/d0,%/a0@\n\t" | ||
324 | "movew %/a1@+,%/d0\n\t" | ||
325 | "rolw #8,%/d0\n\t" | ||
326 | "movew %/d0,%/a0@\n\t" | ||
327 | "movew %/a1@+,%/d0\n\t" | ||
328 | "rolw #8,%/d0\n\t" | ||
329 | "movew %/d0,%/a0@\n\t" | ||
330 | "movew %/a1@+,%/d0\n\t" | ||
331 | "rolw #8,%/d0\n\t" | ||
332 | "movew %/d0,%/a0@\n\t" | ||
333 | "dbra %/d6,1b" | ||
334 | : | ||
335 | : "g" (port), "g" (buf), "g" (nr) | ||
336 | : "d0", "a0", "a1", "d6"); | ||
337 | } | ||
338 | |||
339 | |||
340 | #endif /* __KERNEL__ */ | ||
341 | |||
342 | #endif /* _RAW_IO_H */ | ||
diff --git a/include/asm-m68k/resource.h b/include/asm-m68k/resource.h new file mode 100644 index 000000000000..e7d35019f337 --- /dev/null +++ b/include/asm-m68k/resource.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _M68K_RESOURCE_H | ||
2 | #define _M68K_RESOURCE_H | ||
3 | |||
4 | #include <asm-generic/resource.h> | ||
5 | |||
6 | #endif /* _M68K_RESOURCE_H */ | ||
diff --git a/include/asm-m68k/rtc.h b/include/asm-m68k/rtc.h new file mode 100644 index 000000000000..71406fc4e599 --- /dev/null +++ b/include/asm-m68k/rtc.h | |||
@@ -0,0 +1,76 @@ | |||
1 | /* asm-m68k/rtc.h | ||
2 | * | ||
3 | * Copyright Richard Zidlicky | ||
4 | * implementation details for genrtc/q40rtc driver | ||
5 | */ | ||
6 | /* permission is hereby granted to copy, modify and redistribute this code | ||
7 | * in terms of the GNU Library General Public License, Version 2 or later, | ||
8 | * at your option. | ||
9 | */ | ||
10 | |||
11 | #ifndef _ASM_RTC_H | ||
12 | #define _ASM_RTC_H | ||
13 | |||
14 | #ifdef __KERNEL__ | ||
15 | |||
16 | #include <linux/rtc.h> | ||
17 | #include <asm/errno.h> | ||
18 | #include <asm/machdep.h> | ||
19 | |||
20 | #define RTC_PIE 0x40 /* periodic interrupt enable */ | ||
21 | #define RTC_AIE 0x20 /* alarm interrupt enable */ | ||
22 | #define RTC_UIE 0x10 /* update-finished interrupt enable */ | ||
23 | |||
24 | /* some dummy definitions */ | ||
25 | #define RTC_BATT_BAD 0x100 /* battery bad */ | ||
26 | #define RTC_SQWE 0x08 /* enable square-wave output */ | ||
27 | #define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */ | ||
28 | #define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */ | ||
29 | #define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */ | ||
30 | |||
31 | static inline unsigned int get_rtc_time(struct rtc_time *time) | ||
32 | { | ||
33 | /* | ||
34 | * Only the values that we read from the RTC are set. We leave | ||
35 | * tm_wday, tm_yday and tm_isdst untouched. Even though the | ||
36 | * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated | ||
37 | * by the RTC when initially set to a non-zero value. | ||
38 | */ | ||
39 | mach_hwclk(0, time); | ||
40 | return RTC_24H; | ||
41 | } | ||
42 | |||
43 | static inline int set_rtc_time(struct rtc_time *time) | ||
44 | { | ||
45 | return mach_hwclk(1, time); | ||
46 | } | ||
47 | |||
48 | static inline unsigned int get_rtc_ss(void) | ||
49 | { | ||
50 | if (mach_get_ss) | ||
51 | return mach_get_ss(); | ||
52 | else{ | ||
53 | struct rtc_time h; | ||
54 | |||
55 | get_rtc_time(&h); | ||
56 | return h.tm_sec; | ||
57 | } | ||
58 | } | ||
59 | |||
60 | static inline int get_rtc_pll(struct rtc_pll_info *pll) | ||
61 | { | ||
62 | if (mach_get_rtc_pll) | ||
63 | return mach_get_rtc_pll(pll); | ||
64 | else | ||
65 | return -EINVAL; | ||
66 | } | ||
67 | static inline int set_rtc_pll(struct rtc_pll_info *pll) | ||
68 | { | ||
69 | if (mach_set_rtc_pll) | ||
70 | return mach_set_rtc_pll(pll); | ||
71 | else | ||
72 | return -EINVAL; | ||
73 | } | ||
74 | #endif /* __KERNEL__ */ | ||
75 | |||
76 | #endif /* _ASM__RTC_H */ | ||
diff --git a/include/asm-m68k/sbus.h b/include/asm-m68k/sbus.h new file mode 100644 index 000000000000..3b25c0040aa6 --- /dev/null +++ b/include/asm-m68k/sbus.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * some sbus structures and macros to make usage of sbus drivers possible | ||
3 | */ | ||
4 | |||
5 | #ifndef __M68K_SBUS_H | ||
6 | #define __M68K_SBUS_H | ||
7 | |||
8 | struct sbus_dev { | ||
9 | struct { | ||
10 | unsigned int which_io; | ||
11 | unsigned int phys_addr; | ||
12 | } reg_addrs[1]; | ||
13 | }; | ||
14 | |||
15 | extern void *sparc_alloc_io (u32, void *, int, char *, u32, int); | ||
16 | #define sparc_alloc_io(a,b,c,d,e,f) (a) | ||
17 | |||
18 | #define ARCH_SUN4 0 | ||
19 | |||
20 | /* sbus IO functions stolen from include/asm-sparc/io.h for the serial driver */ | ||
21 | /* No SBUS on the Sun3, kludge -- sam */ | ||
22 | |||
23 | static inline void _sbus_writeb(unsigned char val, unsigned long addr) | ||
24 | { | ||
25 | *(volatile unsigned char *)addr = val; | ||
26 | } | ||
27 | |||
28 | static inline unsigned char _sbus_readb(unsigned long addr) | ||
29 | { | ||
30 | return *(volatile unsigned char *)addr; | ||
31 | } | ||
32 | |||
33 | static inline void _sbus_writel(unsigned long val, unsigned long addr) | ||
34 | { | ||
35 | *(volatile unsigned long *)addr = val; | ||
36 | |||
37 | } | ||
38 | |||
39 | extern inline unsigned long _sbus_readl(unsigned long addr) | ||
40 | { | ||
41 | return *(volatile unsigned long *)addr; | ||
42 | } | ||
43 | |||
44 | |||
45 | #define sbus_readb(a) _sbus_readb((unsigned long)a) | ||
46 | #define sbus_writeb(v, a) _sbus_writeb(v, (unsigned long)a) | ||
47 | #define sbus_readl(a) _sbus_readl((unsigned long)a) | ||
48 | #define sbus_writel(v, a) _sbus_writel(v, (unsigned long)a) | ||
49 | |||
50 | #endif | ||
diff --git a/include/asm-m68k/scatterlist.h b/include/asm-m68k/scatterlist.h new file mode 100644 index 000000000000..d7c9b5c5e6c7 --- /dev/null +++ b/include/asm-m68k/scatterlist.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef _M68K_SCATTERLIST_H | ||
2 | #define _M68K_SCATTERLIST_H | ||
3 | |||
4 | struct scatterlist { | ||
5 | /* These two are only valid if ADDRESS member of this | ||
6 | * struct is NULL. | ||
7 | */ | ||
8 | struct page *page; | ||
9 | unsigned int offset; | ||
10 | |||
11 | unsigned int length; | ||
12 | |||
13 | __u32 dvma_address; /* A place to hang host-specific addresses at. */ | ||
14 | }; | ||
15 | |||
16 | /* This is bogus and should go away. */ | ||
17 | #define ISA_DMA_THRESHOLD (0x00ffffff) | ||
18 | |||
19 | #endif /* !(_M68K_SCATTERLIST_H) */ | ||
diff --git a/include/asm-m68k/sections.h b/include/asm-m68k/sections.h new file mode 100644 index 000000000000..d64967ecfec6 --- /dev/null +++ b/include/asm-m68k/sections.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_M68K_SECTIONS_H | ||
2 | #define _ASM_M68K_SECTIONS_H | ||
3 | |||
4 | #include <asm-generic/sections.h> | ||
5 | |||
6 | #endif /* _ASM_M68K_SECTIONS_H */ | ||
diff --git a/include/asm-m68k/segment.h b/include/asm-m68k/segment.h new file mode 100644 index 000000000000..7b0b2d3127f9 --- /dev/null +++ b/include/asm-m68k/segment.h | |||
@@ -0,0 +1,57 @@ | |||
1 | #ifndef _M68K_SEGMENT_H | ||
2 | #define _M68K_SEGMENT_H | ||
3 | |||
4 | /* define constants */ | ||
5 | /* Address spaces (FC0-FC2) */ | ||
6 | #define USER_DATA (1) | ||
7 | #ifndef __USER_DS | ||
8 | #define __USER_DS (USER_DATA) | ||
9 | #endif | ||
10 | #define USER_PROGRAM (2) | ||
11 | #define SUPER_DATA (5) | ||
12 | #ifndef __KERNEL_DS | ||
13 | #define __KERNEL_DS (SUPER_DATA) | ||
14 | #endif | ||
15 | #define SUPER_PROGRAM (6) | ||
16 | #define CPU_SPACE (7) | ||
17 | |||
18 | #ifndef __ASSEMBLY__ | ||
19 | |||
20 | typedef struct { | ||
21 | unsigned long seg; | ||
22 | } mm_segment_t; | ||
23 | |||
24 | #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) | ||
25 | #define USER_DS MAKE_MM_SEG(__USER_DS) | ||
26 | #define KERNEL_DS MAKE_MM_SEG(__KERNEL_DS) | ||
27 | |||
28 | /* | ||
29 | * Get/set the SFC/DFC registers for MOVES instructions | ||
30 | */ | ||
31 | |||
32 | static inline mm_segment_t get_fs(void) | ||
33 | { | ||
34 | mm_segment_t _v; | ||
35 | __asm__ ("movec %/dfc,%0":"=r" (_v.seg):); | ||
36 | |||
37 | return _v; | ||
38 | } | ||
39 | |||
40 | static inline mm_segment_t get_ds(void) | ||
41 | { | ||
42 | /* return the supervisor data space code */ | ||
43 | return KERNEL_DS; | ||
44 | } | ||
45 | |||
46 | static inline void set_fs(mm_segment_t val) | ||
47 | { | ||
48 | __asm__ __volatile__ ("movec %0,%/sfc\n\t" | ||
49 | "movec %0,%/dfc\n\t" | ||
50 | : /* no outputs */ : "r" (val.seg) : "memory"); | ||
51 | } | ||
52 | |||
53 | #define segment_eq(a,b) ((a).seg == (b).seg) | ||
54 | |||
55 | #endif /* __ASSEMBLY__ */ | ||
56 | |||
57 | #endif /* _M68K_SEGMENT_H */ | ||
diff --git a/include/asm-m68k/semaphore-helper.h b/include/asm-m68k/semaphore-helper.h new file mode 100644 index 000000000000..1516a642f9a5 --- /dev/null +++ b/include/asm-m68k/semaphore-helper.h | |||
@@ -0,0 +1,143 @@ | |||
1 | #ifndef _M68K_SEMAPHORE_HELPER_H | ||
2 | #define _M68K_SEMAPHORE_HELPER_H | ||
3 | |||
4 | /* | ||
5 | * SMP- and interrupt-safe semaphores helper functions. | ||
6 | * | ||
7 | * (C) Copyright 1996 Linus Torvalds | ||
8 | * | ||
9 | * m68k version by Andreas Schwab | ||
10 | */ | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <linux/errno.h> | ||
14 | |||
15 | /* | ||
16 | * These two _must_ execute atomically wrt each other. | ||
17 | */ | ||
18 | static inline void wake_one_more(struct semaphore * sem) | ||
19 | { | ||
20 | atomic_inc(&sem->waking); | ||
21 | } | ||
22 | |||
23 | #ifndef CONFIG_RMW_INSNS | ||
24 | extern spinlock_t semaphore_wake_lock; | ||
25 | #endif | ||
26 | |||
27 | static inline int waking_non_zero(struct semaphore *sem) | ||
28 | { | ||
29 | int ret; | ||
30 | #ifndef CONFIG_RMW_INSNS | ||
31 | unsigned long flags; | ||
32 | |||
33 | spin_lock_irqsave(&semaphore_wake_lock, flags); | ||
34 | ret = 0; | ||
35 | if (atomic_read(&sem->waking) > 0) { | ||
36 | atomic_dec(&sem->waking); | ||
37 | ret = 1; | ||
38 | } | ||
39 | spin_unlock_irqrestore(&semaphore_wake_lock, flags); | ||
40 | #else | ||
41 | int tmp1, tmp2; | ||
42 | |||
43 | __asm__ __volatile__ | ||
44 | ("1: movel %1,%2\n" | ||
45 | " jle 2f\n" | ||
46 | " subql #1,%2\n" | ||
47 | " casl %1,%2,%3\n" | ||
48 | " jne 1b\n" | ||
49 | " moveq #1,%0\n" | ||
50 | "2:" | ||
51 | : "=d" (ret), "=d" (tmp1), "=d" (tmp2) | ||
52 | : "m" (sem->waking), "0" (0), "1" (sem->waking)); | ||
53 | #endif | ||
54 | |||
55 | return ret; | ||
56 | } | ||
57 | |||
58 | /* | ||
59 | * waking_non_zero_interruptible: | ||
60 | * 1 got the lock | ||
61 | * 0 go to sleep | ||
62 | * -EINTR interrupted | ||
63 | */ | ||
64 | static inline int waking_non_zero_interruptible(struct semaphore *sem, | ||
65 | struct task_struct *tsk) | ||
66 | { | ||
67 | int ret; | ||
68 | #ifndef CONFIG_RMW_INSNS | ||
69 | unsigned long flags; | ||
70 | |||
71 | spin_lock_irqsave(&semaphore_wake_lock, flags); | ||
72 | ret = 0; | ||
73 | if (atomic_read(&sem->waking) > 0) { | ||
74 | atomic_dec(&sem->waking); | ||
75 | ret = 1; | ||
76 | } else if (signal_pending(tsk)) { | ||
77 | atomic_inc(&sem->count); | ||
78 | ret = -EINTR; | ||
79 | } | ||
80 | spin_unlock_irqrestore(&semaphore_wake_lock, flags); | ||
81 | #else | ||
82 | int tmp1, tmp2; | ||
83 | |||
84 | __asm__ __volatile__ | ||
85 | ("1: movel %1,%2\n" | ||
86 | " jle 2f\n" | ||
87 | " subql #1,%2\n" | ||
88 | " casl %1,%2,%3\n" | ||
89 | " jne 1b\n" | ||
90 | " moveq #1,%0\n" | ||
91 | " jra %a4\n" | ||
92 | "2:" | ||
93 | : "=d" (ret), "=d" (tmp1), "=d" (tmp2) | ||
94 | : "m" (sem->waking), "i" (&&next), "0" (0), "1" (sem->waking)); | ||
95 | if (signal_pending(tsk)) { | ||
96 | atomic_inc(&sem->count); | ||
97 | ret = -EINTR; | ||
98 | } | ||
99 | next: | ||
100 | #endif | ||
101 | |||
102 | return ret; | ||
103 | } | ||
104 | |||
105 | /* | ||
106 | * waking_non_zero_trylock: | ||
107 | * 1 failed to lock | ||
108 | * 0 got the lock | ||
109 | */ | ||
110 | static inline int waking_non_zero_trylock(struct semaphore *sem) | ||
111 | { | ||
112 | int ret; | ||
113 | #ifndef CONFIG_RMW_INSNS | ||
114 | unsigned long flags; | ||
115 | |||
116 | spin_lock_irqsave(&semaphore_wake_lock, flags); | ||
117 | ret = 1; | ||
118 | if (atomic_read(&sem->waking) > 0) { | ||
119 | atomic_dec(&sem->waking); | ||
120 | ret = 0; | ||
121 | } else | ||
122 | atomic_inc(&sem->count); | ||
123 | spin_unlock_irqrestore(&semaphore_wake_lock, flags); | ||
124 | #else | ||
125 | int tmp1, tmp2; | ||
126 | |||
127 | __asm__ __volatile__ | ||
128 | ("1: movel %1,%2\n" | ||
129 | " jle 2f\n" | ||
130 | " subql #1,%2\n" | ||
131 | " casl %1,%2,%3\n" | ||
132 | " jne 1b\n" | ||
133 | " moveq #0,%0\n" | ||
134 | "2:" | ||
135 | : "=d" (ret), "=d" (tmp1), "=d" (tmp2) | ||
136 | : "m" (sem->waking), "0" (1), "1" (sem->waking)); | ||
137 | if (ret) | ||
138 | atomic_inc(&sem->count); | ||
139 | #endif | ||
140 | return ret; | ||
141 | } | ||
142 | |||
143 | #endif | ||
diff --git a/include/asm-m68k/semaphore.h b/include/asm-m68k/semaphore.h new file mode 100644 index 000000000000..ab94cf3ed447 --- /dev/null +++ b/include/asm-m68k/semaphore.h | |||
@@ -0,0 +1,167 @@ | |||
1 | #ifndef _M68K_SEMAPHORE_H | ||
2 | #define _M68K_SEMAPHORE_H | ||
3 | |||
4 | #define RW_LOCK_BIAS 0x01000000 | ||
5 | |||
6 | #ifndef __ASSEMBLY__ | ||
7 | |||
8 | #include <linux/linkage.h> | ||
9 | #include <linux/wait.h> | ||
10 | #include <linux/spinlock.h> | ||
11 | #include <linux/rwsem.h> | ||
12 | #include <linux/stringify.h> | ||
13 | |||
14 | #include <asm/system.h> | ||
15 | #include <asm/atomic.h> | ||
16 | |||
17 | /* | ||
18 | * Interrupt-safe semaphores.. | ||
19 | * | ||
20 | * (C) Copyright 1996 Linus Torvalds | ||
21 | * | ||
22 | * m68k version by Andreas Schwab | ||
23 | */ | ||
24 | |||
25 | |||
26 | struct semaphore { | ||
27 | atomic_t count; | ||
28 | atomic_t waking; | ||
29 | wait_queue_head_t wait; | ||
30 | }; | ||
31 | |||
32 | #define __SEMAPHORE_INITIALIZER(name, n) \ | ||
33 | { \ | ||
34 | .count = ATOMIC_INIT(n), \ | ||
35 | .waking = ATOMIC_INIT(0), \ | ||
36 | .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \ | ||
37 | } | ||
38 | |||
39 | #define __MUTEX_INITIALIZER(name) \ | ||
40 | __SEMAPHORE_INITIALIZER(name,1) | ||
41 | |||
42 | #define __DECLARE_SEMAPHORE_GENERIC(name,count) \ | ||
43 | struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) | ||
44 | |||
45 | #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) | ||
46 | #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) | ||
47 | |||
48 | static inline void sema_init(struct semaphore *sem, int val) | ||
49 | { | ||
50 | *sem = (struct semaphore)__SEMAPHORE_INITIALIZER(*sem, val); | ||
51 | } | ||
52 | |||
53 | static inline void init_MUTEX (struct semaphore *sem) | ||
54 | { | ||
55 | sema_init(sem, 1); | ||
56 | } | ||
57 | |||
58 | static inline void init_MUTEX_LOCKED (struct semaphore *sem) | ||
59 | { | ||
60 | sema_init(sem, 0); | ||
61 | } | ||
62 | |||
63 | asmlinkage void __down_failed(void /* special register calling convention */); | ||
64 | asmlinkage int __down_failed_interruptible(void /* params in registers */); | ||
65 | asmlinkage int __down_failed_trylock(void /* params in registers */); | ||
66 | asmlinkage void __up_wakeup(void /* special register calling convention */); | ||
67 | |||
68 | asmlinkage void __down(struct semaphore * sem); | ||
69 | asmlinkage int __down_interruptible(struct semaphore * sem); | ||
70 | asmlinkage int __down_trylock(struct semaphore * sem); | ||
71 | asmlinkage void __up(struct semaphore * sem); | ||
72 | |||
73 | /* | ||
74 | * This is ugly, but we want the default case to fall through. | ||
75 | * "down_failed" is a special asm handler that calls the C | ||
76 | * routine that actually waits. See arch/m68k/lib/semaphore.S | ||
77 | */ | ||
78 | static inline void down(struct semaphore *sem) | ||
79 | { | ||
80 | register struct semaphore *sem1 __asm__ ("%a1") = sem; | ||
81 | |||
82 | might_sleep(); | ||
83 | __asm__ __volatile__( | ||
84 | "| atomic down operation\n\t" | ||
85 | "subql #1,%0@\n\t" | ||
86 | "jmi 2f\n\t" | ||
87 | "1:\n" | ||
88 | LOCK_SECTION_START(".even\n\t") | ||
89 | "2:\tpea 1b\n\t" | ||
90 | "jbra __down_failed\n" | ||
91 | LOCK_SECTION_END | ||
92 | : /* no outputs */ | ||
93 | : "a" (sem1) | ||
94 | : "memory"); | ||
95 | } | ||
96 | |||
97 | static inline int down_interruptible(struct semaphore *sem) | ||
98 | { | ||
99 | register struct semaphore *sem1 __asm__ ("%a1") = sem; | ||
100 | register int result __asm__ ("%d0"); | ||
101 | |||
102 | might_sleep(); | ||
103 | __asm__ __volatile__( | ||
104 | "| atomic interruptible down operation\n\t" | ||
105 | "subql #1,%1@\n\t" | ||
106 | "jmi 2f\n\t" | ||
107 | "clrl %0\n" | ||
108 | "1:\n" | ||
109 | LOCK_SECTION_START(".even\n\t") | ||
110 | "2:\tpea 1b\n\t" | ||
111 | "jbra __down_failed_interruptible\n" | ||
112 | LOCK_SECTION_END | ||
113 | : "=d" (result) | ||
114 | : "a" (sem1) | ||
115 | : "memory"); | ||
116 | return result; | ||
117 | } | ||
118 | |||
119 | static inline int down_trylock(struct semaphore *sem) | ||
120 | { | ||
121 | register struct semaphore *sem1 __asm__ ("%a1") = sem; | ||
122 | register int result __asm__ ("%d0"); | ||
123 | |||
124 | __asm__ __volatile__( | ||
125 | "| atomic down trylock operation\n\t" | ||
126 | "subql #1,%1@\n\t" | ||
127 | "jmi 2f\n\t" | ||
128 | "clrl %0\n" | ||
129 | "1:\n" | ||
130 | LOCK_SECTION_START(".even\n\t") | ||
131 | "2:\tpea 1b\n\t" | ||
132 | "jbra __down_failed_trylock\n" | ||
133 | LOCK_SECTION_END | ||
134 | : "=d" (result) | ||
135 | : "a" (sem1) | ||
136 | : "memory"); | ||
137 | return result; | ||
138 | } | ||
139 | |||
140 | /* | ||
141 | * Note! This is subtle. We jump to wake people up only if | ||
142 | * the semaphore was negative (== somebody was waiting on it). | ||
143 | * The default case (no contention) will result in NO | ||
144 | * jumps for both down() and up(). | ||
145 | */ | ||
146 | static inline void up(struct semaphore *sem) | ||
147 | { | ||
148 | register struct semaphore *sem1 __asm__ ("%a1") = sem; | ||
149 | |||
150 | __asm__ __volatile__( | ||
151 | "| atomic up operation\n\t" | ||
152 | "addql #1,%0@\n\t" | ||
153 | "jle 2f\n" | ||
154 | "1:\n" | ||
155 | LOCK_SECTION_START(".even\n\t") | ||
156 | "2:\t" | ||
157 | "pea 1b\n\t" | ||
158 | "jbra __up_wakeup\n" | ||
159 | LOCK_SECTION_END | ||
160 | : /* no outputs */ | ||
161 | : "a" (sem1) | ||
162 | : "memory"); | ||
163 | } | ||
164 | |||
165 | #endif /* __ASSEMBLY__ */ | ||
166 | |||
167 | #endif | ||
diff --git a/include/asm-m68k/sembuf.h b/include/asm-m68k/sembuf.h new file mode 100644 index 000000000000..2308052a8c24 --- /dev/null +++ b/include/asm-m68k/sembuf.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef _M68K_SEMBUF_H | ||
2 | #define _M68K_SEMBUF_H | ||
3 | |||
4 | /* | ||
5 | * The semid64_ds structure for m68k architecture. | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 64-bit time_t to solve y2038 problem | ||
11 | * - 2 miscellaneous 32-bit values | ||
12 | */ | ||
13 | |||
14 | struct semid64_ds { | ||
15 | struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ | ||
16 | __kernel_time_t sem_otime; /* last semop time */ | ||
17 | unsigned long __unused1; | ||
18 | __kernel_time_t sem_ctime; /* last change time */ | ||
19 | unsigned long __unused2; | ||
20 | unsigned long sem_nsems; /* no. of semaphores in array */ | ||
21 | unsigned long __unused3; | ||
22 | unsigned long __unused4; | ||
23 | }; | ||
24 | |||
25 | #endif /* _M68K_SEMBUF_H */ | ||
diff --git a/include/asm-m68k/serial.h b/include/asm-m68k/serial.h new file mode 100644 index 000000000000..9f5bcdc105fc --- /dev/null +++ b/include/asm-m68k/serial.h | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | * include/asm-m68k/serial.h | ||
3 | * | ||
4 | * currently this seems useful only for a Q40, | ||
5 | * it's an almost exact copy of ../asm-alpha/serial.h | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #include <linux/config.h> | ||
10 | |||
11 | /* | ||
12 | * This assumes you have a 1.8432 MHz clock for your UART. | ||
13 | * | ||
14 | * It'd be nice if someone built a serial card with a 24.576 MHz | ||
15 | * clock, since the 16550A is capable of handling a top speed of 1.5 | ||
16 | * megabits/second; but this requires the faster clock. | ||
17 | */ | ||
18 | #define BASE_BAUD ( 1843200 / 16 ) | ||
19 | |||
20 | /* Standard COM flags (except for COM4, because of the 8514 problem) */ | ||
21 | #ifdef CONFIG_SERIAL_DETECT_IRQ | ||
22 | #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ) | ||
23 | #define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ) | ||
24 | #else | ||
25 | #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) | ||
26 | #define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF | ||
27 | #endif | ||
28 | |||
29 | #ifdef CONFIG_SERIAL_MANY_PORTS | ||
30 | #define FOURPORT_FLAGS ASYNC_FOURPORT | ||
31 | #define ACCENT_FLAGS 0 | ||
32 | #define BOCA_FLAGS 0 | ||
33 | #endif | ||
34 | |||
35 | #define STD_SERIAL_PORT_DEFNS \ | ||
36 | /* UART CLK PORT IRQ FLAGS */ \ | ||
37 | { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \ | ||
38 | { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \ | ||
39 | { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \ | ||
40 | { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */ | ||
41 | |||
42 | |||
43 | #ifdef CONFIG_SERIAL_MANY_PORTS | ||
44 | #define EXTRA_SERIAL_PORT_DEFNS \ | ||
45 | { 0, BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS }, /* ttyS4 */ \ | ||
46 | { 0, BASE_BAUD, 0x1A8, 9, FOURPORT_FLAGS }, /* ttyS5 */ \ | ||
47 | { 0, BASE_BAUD, 0x1B0, 9, FOURPORT_FLAGS }, /* ttyS6 */ \ | ||
48 | { 0, BASE_BAUD, 0x1B8, 9, FOURPORT_FLAGS }, /* ttyS7 */ \ | ||
49 | { 0, BASE_BAUD, 0x2A0, 5, FOURPORT_FLAGS }, /* ttyS8 */ \ | ||
50 | { 0, BASE_BAUD, 0x2A8, 5, FOURPORT_FLAGS }, /* ttyS9 */ \ | ||
51 | { 0, BASE_BAUD, 0x2B0, 5, FOURPORT_FLAGS }, /* ttyS10 */ \ | ||
52 | { 0, BASE_BAUD, 0x2B8, 5, FOURPORT_FLAGS }, /* ttyS11 */ \ | ||
53 | { 0, BASE_BAUD, 0x330, 4, ACCENT_FLAGS }, /* ttyS12 */ \ | ||
54 | { 0, BASE_BAUD, 0x338, 4, ACCENT_FLAGS }, /* ttyS13 */ \ | ||
55 | { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS14 (spare) */ \ | ||
56 | { 0, BASE_BAUD, 0x000, 0, 0 }, /* ttyS15 (spare) */ \ | ||
57 | { 0, BASE_BAUD, 0x100, 12, BOCA_FLAGS }, /* ttyS16 */ \ | ||
58 | { 0, BASE_BAUD, 0x108, 12, BOCA_FLAGS }, /* ttyS17 */ \ | ||
59 | { 0, BASE_BAUD, 0x110, 12, BOCA_FLAGS }, /* ttyS18 */ \ | ||
60 | { 0, BASE_BAUD, 0x118, 12, BOCA_FLAGS }, /* ttyS19 */ \ | ||
61 | { 0, BASE_BAUD, 0x120, 12, BOCA_FLAGS }, /* ttyS20 */ \ | ||
62 | { 0, BASE_BAUD, 0x128, 12, BOCA_FLAGS }, /* ttyS21 */ \ | ||
63 | { 0, BASE_BAUD, 0x130, 12, BOCA_FLAGS }, /* ttyS22 */ \ | ||
64 | { 0, BASE_BAUD, 0x138, 12, BOCA_FLAGS }, /* ttyS23 */ \ | ||
65 | { 0, BASE_BAUD, 0x140, 12, BOCA_FLAGS }, /* ttyS24 */ \ | ||
66 | { 0, BASE_BAUD, 0x148, 12, BOCA_FLAGS }, /* ttyS25 */ \ | ||
67 | { 0, BASE_BAUD, 0x150, 12, BOCA_FLAGS }, /* ttyS26 */ \ | ||
68 | { 0, BASE_BAUD, 0x158, 12, BOCA_FLAGS }, /* ttyS27 */ \ | ||
69 | { 0, BASE_BAUD, 0x160, 12, BOCA_FLAGS }, /* ttyS28 */ \ | ||
70 | { 0, BASE_BAUD, 0x168, 12, BOCA_FLAGS }, /* ttyS29 */ \ | ||
71 | { 0, BASE_BAUD, 0x170, 12, BOCA_FLAGS }, /* ttyS30 */ \ | ||
72 | { 0, BASE_BAUD, 0x178, 12, BOCA_FLAGS }, /* ttyS31 */ | ||
73 | #else | ||
74 | #define EXTRA_SERIAL_PORT_DEFNS | ||
75 | #endif | ||
76 | |||
77 | #define SERIAL_PORT_DFNS \ | ||
78 | STD_SERIAL_PORT_DEFNS \ | ||
79 | EXTRA_SERIAL_PORT_DEFNS | ||
diff --git a/include/asm-m68k/setup.h b/include/asm-m68k/setup.h new file mode 100644 index 000000000000..9e23492685eb --- /dev/null +++ b/include/asm-m68k/setup.h | |||
@@ -0,0 +1,375 @@ | |||
1 | /* | ||
2 | ** asm/setup.h -- Definition of the Linux/m68k setup information | ||
3 | ** | ||
4 | ** Copyright 1992 by Greg Harp | ||
5 | ** | ||
6 | ** This file is subject to the terms and conditions of the GNU General Public | ||
7 | ** License. See the file COPYING in the main directory of this archive | ||
8 | ** for more details. | ||
9 | ** | ||
10 | ** Created 09/29/92 by Greg Harp | ||
11 | ** | ||
12 | ** 5/2/94 Roman Hodek: | ||
13 | ** Added bi_atari part of the machine dependent union bi_un; for now it | ||
14 | ** contains just a model field to distinguish between TT and Falcon. | ||
15 | ** 26/7/96 Roman Zippel: | ||
16 | ** Renamed to setup.h; added some useful macros to allow gcc some | ||
17 | ** optimizations if possible. | ||
18 | ** 5/10/96 Geert Uytterhoeven: | ||
19 | ** Redesign of the boot information structure; moved boot information | ||
20 | ** structure to bootinfo.h | ||
21 | */ | ||
22 | |||
23 | #ifndef _M68K_SETUP_H | ||
24 | #define _M68K_SETUP_H | ||
25 | |||
26 | #include <linux/config.h> | ||
27 | |||
28 | |||
29 | /* | ||
30 | * Linux/m68k Architectures | ||
31 | */ | ||
32 | |||
33 | #define MACH_AMIGA 1 | ||
34 | #define MACH_ATARI 2 | ||
35 | #define MACH_MAC 3 | ||
36 | #define MACH_APOLLO 4 | ||
37 | #define MACH_SUN3 5 | ||
38 | #define MACH_MVME147 6 | ||
39 | #define MACH_MVME16x 7 | ||
40 | #define MACH_BVME6000 8 | ||
41 | #define MACH_HP300 9 | ||
42 | #define MACH_Q40 10 | ||
43 | #define MACH_SUN3X 11 | ||
44 | |||
45 | #ifdef __KERNEL__ | ||
46 | |||
47 | #ifndef __ASSEMBLY__ | ||
48 | extern unsigned long m68k_machtype; | ||
49 | #endif /* !__ASSEMBLY__ */ | ||
50 | |||
51 | #if !defined(CONFIG_AMIGA) | ||
52 | # define MACH_IS_AMIGA (0) | ||
53 | #elif defined(CONFIG_ATARI) || defined(CONFIG_MAC) || defined(CONFIG_APOLLO) \ | ||
54 | || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) \ | ||
55 | || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ | ||
56 | || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) | ||
57 | # define MACH_IS_AMIGA (m68k_machtype == MACH_AMIGA) | ||
58 | #else | ||
59 | # define MACH_AMIGA_ONLY | ||
60 | # define MACH_IS_AMIGA (1) | ||
61 | # define MACH_TYPE (MACH_AMIGA) | ||
62 | #endif | ||
63 | |||
64 | #if !defined(CONFIG_ATARI) | ||
65 | # define MACH_IS_ATARI (0) | ||
66 | #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_APOLLO) \ | ||
67 | || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) \ | ||
68 | || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ | ||
69 | || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) | ||
70 | # define MACH_IS_ATARI (m68k_machtype == MACH_ATARI) | ||
71 | #else | ||
72 | # define MACH_ATARI_ONLY | ||
73 | # define MACH_IS_ATARI (1) | ||
74 | # define MACH_TYPE (MACH_ATARI) | ||
75 | #endif | ||
76 | |||
77 | #if !defined(CONFIG_MAC) | ||
78 | # define MACH_IS_MAC (0) | ||
79 | #elif defined(CONFIG_AMIGA) || defined(CONFIG_ATARI) || defined(CONFIG_APOLLO) \ | ||
80 | || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) \ | ||
81 | || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ | ||
82 | || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) | ||
83 | # define MACH_IS_MAC (m68k_machtype == MACH_MAC) | ||
84 | #else | ||
85 | # define MACH_MAC_ONLY | ||
86 | # define MACH_IS_MAC (1) | ||
87 | # define MACH_TYPE (MACH_MAC) | ||
88 | #endif | ||
89 | |||
90 | #if defined(CONFIG_SUN3) | ||
91 | #define MACH_IS_SUN3 (1) | ||
92 | #define MACH_SUN3_ONLY (1) | ||
93 | #define MACH_TYPE (MACH_SUN3) | ||
94 | #else | ||
95 | #define MACH_IS_SUN3 (0) | ||
96 | #endif | ||
97 | |||
98 | #if !defined (CONFIG_APOLLO) | ||
99 | # define MACH_IS_APOLLO (0) | ||
100 | #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ | ||
101 | || defined(CONFIG_MVME16x) || defined(CONFIG_BVME6000) \ | ||
102 | || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ | ||
103 | || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) | ||
104 | # define MACH_IS_APOLLO (m68k_machtype == MACH_APOLLO) | ||
105 | #else | ||
106 | # define MACH_APOLLO_ONLY | ||
107 | # define MACH_IS_APOLLO (1) | ||
108 | # define MACH_TYPE (MACH_APOLLO) | ||
109 | #endif | ||
110 | |||
111 | #if !defined (CONFIG_MVME147) | ||
112 | # define MACH_IS_MVME147 (0) | ||
113 | #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ | ||
114 | || defined(CONFIG_APOLLO) || defined(CONFIG_BVME6000) \ | ||
115 | || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ | ||
116 | || defined(CONFIG_SUN3X) || defined(CONFIG_MVME16x) | ||
117 | # define MACH_IS_MVME147 (m68k_machtype == MACH_MVME147) | ||
118 | #else | ||
119 | # define MACH_MVME147_ONLY | ||
120 | # define MACH_IS_MVME147 (1) | ||
121 | # define MACH_TYPE (MACH_MVME147) | ||
122 | #endif | ||
123 | |||
124 | #if !defined (CONFIG_MVME16x) | ||
125 | # define MACH_IS_MVME16x (0) | ||
126 | #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ | ||
127 | || defined(CONFIG_APOLLO) || defined(CONFIG_BVME6000) \ | ||
128 | || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ | ||
129 | || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) | ||
130 | # define MACH_IS_MVME16x (m68k_machtype == MACH_MVME16x) | ||
131 | #else | ||
132 | # define MACH_MVME16x_ONLY | ||
133 | # define MACH_IS_MVME16x (1) | ||
134 | # define MACH_TYPE (MACH_MVME16x) | ||
135 | #endif | ||
136 | |||
137 | #if !defined (CONFIG_BVME6000) | ||
138 | # define MACH_IS_BVME6000 (0) | ||
139 | #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ | ||
140 | || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) \ | ||
141 | || defined(CONFIG_HP300) || defined(CONFIG_Q40) \ | ||
142 | || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) | ||
143 | # define MACH_IS_BVME6000 (m68k_machtype == MACH_BVME6000) | ||
144 | #else | ||
145 | # define MACH_BVME6000_ONLY | ||
146 | # define MACH_IS_BVME6000 (1) | ||
147 | # define MACH_TYPE (MACH_BVME6000) | ||
148 | #endif | ||
149 | |||
150 | #if !defined (CONFIG_HP300) | ||
151 | # define MACH_IS_HP300 (0) | ||
152 | #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ | ||
153 | || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) \ | ||
154 | || defined(CONFIG_BVME6000) || defined(CONFIG_Q40) \ | ||
155 | || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) | ||
156 | # define MACH_IS_HP300 (m68k_machtype == MACH_HP300) | ||
157 | #else | ||
158 | # define MACH_HP300_ONLY | ||
159 | # define MACH_IS_HP300 (1) | ||
160 | # define MACH_TYPE (MACH_HP300) | ||
161 | #endif | ||
162 | |||
163 | #if !defined (CONFIG_Q40) | ||
164 | # define MACH_IS_Q40 (0) | ||
165 | #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ | ||
166 | || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) \ | ||
167 | || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) \ | ||
168 | || defined(CONFIG_SUN3X) || defined(CONFIG_MVME147) | ||
169 | # define MACH_IS_Q40 (m68k_machtype == MACH_Q40) | ||
170 | #else | ||
171 | # define MACH_Q40_ONLY | ||
172 | # define MACH_IS_Q40 (1) | ||
173 | # define MACH_TYPE (MACH_Q40) | ||
174 | #endif | ||
175 | |||
176 | #if !defined (CONFIG_SUN3X) | ||
177 | # define MACH_IS_SUN3X (0) | ||
178 | #elif defined(CONFIG_AMIGA) || defined(CONFIG_MAC) || defined(CONFIG_ATARI) \ | ||
179 | || defined(CONFIG_APOLLO) || defined(CONFIG_MVME16x) \ | ||
180 | || defined(CONFIG_BVME6000) || defined(CONFIG_HP300) \ | ||
181 | || defined(CONFIG_Q40) || defined(CONFIG_MVME147) | ||
182 | # define MACH_IS_SUN3X (m68k_machtype == MACH_SUN3X) | ||
183 | #else | ||
184 | # define CONFIG_SUN3X_ONLY | ||
185 | # define MACH_IS_SUN3X (1) | ||
186 | # define MACH_TYPE (MACH_SUN3X) | ||
187 | #endif | ||
188 | |||
189 | #ifndef MACH_TYPE | ||
190 | # define MACH_TYPE (m68k_machtype) | ||
191 | #endif | ||
192 | |||
193 | #endif /* __KERNEL__ */ | ||
194 | |||
195 | |||
196 | /* | ||
197 | * CPU, FPU and MMU types | ||
198 | * | ||
199 | * Note: we may rely on the following equalities: | ||
200 | * | ||
201 | * CPU_68020 == MMU_68851 | ||
202 | * CPU_68030 == MMU_68030 | ||
203 | * CPU_68040 == FPU_68040 == MMU_68040 | ||
204 | * CPU_68060 == FPU_68060 == MMU_68060 | ||
205 | */ | ||
206 | |||
207 | #define CPUB_68020 0 | ||
208 | #define CPUB_68030 1 | ||
209 | #define CPUB_68040 2 | ||
210 | #define CPUB_68060 3 | ||
211 | |||
212 | #define CPU_68020 (1<<CPUB_68020) | ||
213 | #define CPU_68030 (1<<CPUB_68030) | ||
214 | #define CPU_68040 (1<<CPUB_68040) | ||
215 | #define CPU_68060 (1<<CPUB_68060) | ||
216 | |||
217 | #define FPUB_68881 0 | ||
218 | #define FPUB_68882 1 | ||
219 | #define FPUB_68040 2 /* Internal FPU */ | ||
220 | #define FPUB_68060 3 /* Internal FPU */ | ||
221 | #define FPUB_SUNFPA 4 /* Sun-3 FPA */ | ||
222 | |||
223 | #define FPU_68881 (1<<FPUB_68881) | ||
224 | #define FPU_68882 (1<<FPUB_68882) | ||
225 | #define FPU_68040 (1<<FPUB_68040) | ||
226 | #define FPU_68060 (1<<FPUB_68060) | ||
227 | #define FPU_SUNFPA (1<<FPUB_SUNFPA) | ||
228 | |||
229 | #define MMUB_68851 0 | ||
230 | #define MMUB_68030 1 /* Internal MMU */ | ||
231 | #define MMUB_68040 2 /* Internal MMU */ | ||
232 | #define MMUB_68060 3 /* Internal MMU */ | ||
233 | #define MMUB_APOLLO 4 /* Custom Apollo */ | ||
234 | #define MMUB_SUN3 5 /* Custom Sun-3 */ | ||
235 | |||
236 | #define MMU_68851 (1<<MMUB_68851) | ||
237 | #define MMU_68030 (1<<MMUB_68030) | ||
238 | #define MMU_68040 (1<<MMUB_68040) | ||
239 | #define MMU_68060 (1<<MMUB_68060) | ||
240 | #define MMU_SUN3 (1<<MMUB_SUN3) | ||
241 | #define MMU_APOLLO (1<<MMUB_APOLLO) | ||
242 | |||
243 | #ifdef __KERNEL__ | ||
244 | |||
245 | #ifndef __ASSEMBLY__ | ||
246 | extern unsigned long m68k_cputype; | ||
247 | extern unsigned long m68k_fputype; | ||
248 | extern unsigned long m68k_mmutype; /* Not really used yet */ | ||
249 | #ifdef CONFIG_VME | ||
250 | extern unsigned long vme_brdtype; | ||
251 | #endif | ||
252 | |||
253 | /* | ||
254 | * m68k_is040or060 is != 0 for a '040 or higher; | ||
255 | * used numbers are 4 for 68040 and 6 for 68060. | ||
256 | */ | ||
257 | |||
258 | extern int m68k_is040or060; | ||
259 | #endif /* !__ASSEMBLY__ */ | ||
260 | |||
261 | #if !defined(CONFIG_M68020) | ||
262 | # define CPU_IS_020 (0) | ||
263 | # define MMU_IS_851 (0) | ||
264 | # define MMU_IS_SUN3 (0) | ||
265 | #elif defined(CONFIG_M68030) || defined(CONFIG_M68040) || defined(CONFIG_M68060) | ||
266 | # define CPU_IS_020 (m68k_cputype & CPU_68020) | ||
267 | # define MMU_IS_851 (m68k_mmutype & MMU_68851) | ||
268 | # define MMU_IS_SUN3 (0) /* Sun3 not supported with other CPU enabled */ | ||
269 | #else | ||
270 | # define CPU_M68020_ONLY | ||
271 | # define CPU_IS_020 (1) | ||
272 | #ifdef MACH_SUN3_ONLY | ||
273 | # define MMU_IS_SUN3 (1) | ||
274 | # define MMU_IS_851 (0) | ||
275 | #else | ||
276 | # define MMU_IS_SUN3 (0) | ||
277 | # define MMU_IS_851 (1) | ||
278 | #endif | ||
279 | #endif | ||
280 | |||
281 | #if !defined(CONFIG_M68030) | ||
282 | # define CPU_IS_030 (0) | ||
283 | # define MMU_IS_030 (0) | ||
284 | #elif defined(CONFIG_M68020) || defined(CONFIG_M68040) || defined(CONFIG_M68060) | ||
285 | # define CPU_IS_030 (m68k_cputype & CPU_68030) | ||
286 | # define MMU_IS_030 (m68k_mmutype & MMU_68030) | ||
287 | #else | ||
288 | # define CPU_M68030_ONLY | ||
289 | # define CPU_IS_030 (1) | ||
290 | # define MMU_IS_030 (1) | ||
291 | #endif | ||
292 | |||
293 | #if !defined(CONFIG_M68040) | ||
294 | # define CPU_IS_040 (0) | ||
295 | # define MMU_IS_040 (0) | ||
296 | #elif defined(CONFIG_M68020) || defined(CONFIG_M68030) || defined(CONFIG_M68060) | ||
297 | # define CPU_IS_040 (m68k_cputype & CPU_68040) | ||
298 | # define MMU_IS_040 (m68k_mmutype & MMU_68040) | ||
299 | #else | ||
300 | # define CPU_M68040_ONLY | ||
301 | # define CPU_IS_040 (1) | ||
302 | # define MMU_IS_040 (1) | ||
303 | #endif | ||
304 | |||
305 | #if !defined(CONFIG_M68060) | ||
306 | # define CPU_IS_060 (0) | ||
307 | # define MMU_IS_060 (0) | ||
308 | #elif defined(CONFIG_M68020) || defined(CONFIG_M68030) || defined(CONFIG_M68040) | ||
309 | # define CPU_IS_060 (m68k_cputype & CPU_68060) | ||
310 | # define MMU_IS_060 (m68k_mmutype & MMU_68060) | ||
311 | #else | ||
312 | # define CPU_M68060_ONLY | ||
313 | # define CPU_IS_060 (1) | ||
314 | # define MMU_IS_060 (1) | ||
315 | #endif | ||
316 | |||
317 | #if !defined(CONFIG_M68020) && !defined(CONFIG_M68030) | ||
318 | # define CPU_IS_020_OR_030 (0) | ||
319 | #else | ||
320 | # define CPU_M68020_OR_M68030 | ||
321 | # if defined(CONFIG_M68040) || defined(CONFIG_M68060) | ||
322 | # define CPU_IS_020_OR_030 (!m68k_is040or060) | ||
323 | # else | ||
324 | # define CPU_M68020_OR_M68030_ONLY | ||
325 | # define CPU_IS_020_OR_030 (1) | ||
326 | # endif | ||
327 | #endif | ||
328 | |||
329 | #if !defined(CONFIG_M68040) && !defined(CONFIG_M68060) | ||
330 | # define CPU_IS_040_OR_060 (0) | ||
331 | #else | ||
332 | # define CPU_M68040_OR_M68060 | ||
333 | # if defined(CONFIG_M68020) || defined(CONFIG_M68030) | ||
334 | # define CPU_IS_040_OR_060 (m68k_is040or060) | ||
335 | # else | ||
336 | # define CPU_M68040_OR_M68060_ONLY | ||
337 | # define CPU_IS_040_OR_060 (1) | ||
338 | # endif | ||
339 | #endif | ||
340 | |||
341 | #define CPU_TYPE (m68k_cputype) | ||
342 | |||
343 | #ifdef CONFIG_M68KFPU_EMU | ||
344 | # ifdef CONFIG_M68KFPU_EMU_ONLY | ||
345 | # define FPU_IS_EMU (1) | ||
346 | # else | ||
347 | # define FPU_IS_EMU (!m68k_fputype) | ||
348 | # endif | ||
349 | #else | ||
350 | # define FPU_IS_EMU (0) | ||
351 | #endif | ||
352 | |||
353 | |||
354 | /* | ||
355 | * Miscellaneous | ||
356 | */ | ||
357 | |||
358 | #define NUM_MEMINFO 4 | ||
359 | #define CL_SIZE 256 | ||
360 | #define COMMAND_LINE_SIZE CL_SIZE | ||
361 | |||
362 | #ifndef __ASSEMBLY__ | ||
363 | extern int m68k_num_memory; /* # of memory blocks found (and used) */ | ||
364 | extern int m68k_realnum_memory; /* real # of memory blocks found */ | ||
365 | extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */ | ||
366 | |||
367 | struct mem_info { | ||
368 | unsigned long addr; /* physical address of memory chunk */ | ||
369 | unsigned long size; /* length of memory chunk (in bytes) */ | ||
370 | }; | ||
371 | #endif | ||
372 | |||
373 | #endif /* __KERNEL__ */ | ||
374 | |||
375 | #endif /* _M68K_SETUP_H */ | ||
diff --git a/include/asm-m68k/shm.h b/include/asm-m68k/shm.h new file mode 100644 index 000000000000..3fa2f368fc1a --- /dev/null +++ b/include/asm-m68k/shm.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef _M68K_SHM_H | ||
2 | #define _M68K_SHM_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | |||
6 | /* format of page table entries that correspond to shared memory pages | ||
7 | currently out in swap space (see also mm/swap.c): | ||
8 | bits 0-1 (PAGE_PRESENT) is = 0 | ||
9 | bits 8..2 (SWP_TYPE) are = SHM_SWP_TYPE | ||
10 | bits 31..9 are used like this: | ||
11 | bits 15..9 (SHM_ID) the id of the shared memory segment | ||
12 | bits 30..16 (SHM_IDX) the index of the page within the shared memory segment | ||
13 | (actually only bits 25..16 get used since SHMMAX is so low) | ||
14 | bit 31 (SHM_READ_ONLY) flag whether the page belongs to a read-only attach | ||
15 | */ | ||
16 | /* on the m68k both bits 0 and 1 must be zero */ | ||
17 | /* format on the sun3 is similar, but bits 30, 31 are set to zero and all | ||
18 | others are reduced by 2. --m */ | ||
19 | |||
20 | #ifndef CONFIG_SUN3 | ||
21 | #define SHM_ID_SHIFT 9 | ||
22 | #else | ||
23 | #define SHM_ID_SHIFT 7 | ||
24 | #endif | ||
25 | #define _SHM_ID_BITS 7 | ||
26 | #define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1) | ||
27 | |||
28 | #define SHM_IDX_SHIFT (SHM_ID_SHIFT+_SHM_ID_BITS) | ||
29 | #define _SHM_IDX_BITS 15 | ||
30 | #define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1) | ||
31 | |||
32 | #endif /* _M68K_SHM_H */ | ||
diff --git a/include/asm-m68k/shmbuf.h b/include/asm-m68k/shmbuf.h new file mode 100644 index 000000000000..f8928d62f1b7 --- /dev/null +++ b/include/asm-m68k/shmbuf.h | |||
@@ -0,0 +1,42 @@ | |||
1 | #ifndef _M68K_SHMBUF_H | ||
2 | #define _M68K_SHMBUF_H | ||
3 | |||
4 | /* | ||
5 | * The shmid64_ds structure for m68k architecture. | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 64-bit time_t to solve y2038 problem | ||
11 | * - 2 miscellaneous 32-bit values | ||
12 | */ | ||
13 | |||
14 | struct shmid64_ds { | ||
15 | struct ipc64_perm shm_perm; /* operation perms */ | ||
16 | size_t shm_segsz; /* size of segment (bytes) */ | ||
17 | __kernel_time_t shm_atime; /* last attach time */ | ||
18 | unsigned long __unused1; | ||
19 | __kernel_time_t shm_dtime; /* last detach time */ | ||
20 | unsigned long __unused2; | ||
21 | __kernel_time_t shm_ctime; /* last change time */ | ||
22 | unsigned long __unused3; | ||
23 | __kernel_pid_t shm_cpid; /* pid of creator */ | ||
24 | __kernel_pid_t shm_lpid; /* pid of last operator */ | ||
25 | unsigned long shm_nattch; /* no. of current attaches */ | ||
26 | unsigned long __unused4; | ||
27 | unsigned long __unused5; | ||
28 | }; | ||
29 | |||
30 | struct shminfo64 { | ||
31 | unsigned long shmmax; | ||
32 | unsigned long shmmin; | ||
33 | unsigned long shmmni; | ||
34 | unsigned long shmseg; | ||
35 | unsigned long shmall; | ||
36 | unsigned long __unused1; | ||
37 | unsigned long __unused2; | ||
38 | unsigned long __unused3; | ||
39 | unsigned long __unused4; | ||
40 | }; | ||
41 | |||
42 | #endif /* _M68K_SHMBUF_H */ | ||
diff --git a/include/asm-m68k/shmparam.h b/include/asm-m68k/shmparam.h new file mode 100644 index 000000000000..558892a2efb3 --- /dev/null +++ b/include/asm-m68k/shmparam.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _M68K_SHMPARAM_H | ||
2 | #define _M68K_SHMPARAM_H | ||
3 | |||
4 | #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ | ||
5 | |||
6 | #endif /* _M68K_SHMPARAM_H */ | ||
diff --git a/include/asm-m68k/sigcontext.h b/include/asm-m68k/sigcontext.h new file mode 100644 index 000000000000..64fbe34cf26f --- /dev/null +++ b/include/asm-m68k/sigcontext.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef _ASM_M68k_SIGCONTEXT_H | ||
2 | #define _ASM_M68k_SIGCONTEXT_H | ||
3 | |||
4 | struct sigcontext { | ||
5 | unsigned long sc_mask; /* old sigmask */ | ||
6 | unsigned long sc_usp; /* old user stack pointer */ | ||
7 | unsigned long sc_d0; | ||
8 | unsigned long sc_d1; | ||
9 | unsigned long sc_a0; | ||
10 | unsigned long sc_a1; | ||
11 | unsigned short sc_sr; | ||
12 | unsigned long sc_pc; | ||
13 | unsigned short sc_formatvec; | ||
14 | unsigned long sc_fpregs[2*3]; /* room for two fp registers */ | ||
15 | unsigned long sc_fpcntl[3]; | ||
16 | unsigned char sc_fpstate[216]; | ||
17 | }; | ||
18 | |||
19 | #endif | ||
diff --git a/include/asm-m68k/siginfo.h b/include/asm-m68k/siginfo.h new file mode 100644 index 000000000000..05a8d6d90b58 --- /dev/null +++ b/include/asm-m68k/siginfo.h | |||
@@ -0,0 +1,92 @@ | |||
1 | #ifndef _M68K_SIGINFO_H | ||
2 | #define _M68K_SIGINFO_H | ||
3 | |||
4 | #define HAVE_ARCH_SIGINFO_T | ||
5 | #define HAVE_ARCH_COPY_SIGINFO | ||
6 | |||
7 | #include <asm-generic/siginfo.h> | ||
8 | |||
9 | typedef struct siginfo { | ||
10 | int si_signo; | ||
11 | int si_errno; | ||
12 | int si_code; | ||
13 | |||
14 | union { | ||
15 | int _pad[SI_PAD_SIZE]; | ||
16 | |||
17 | /* kill() */ | ||
18 | struct { | ||
19 | __kernel_pid_t _pid; /* sender's pid */ | ||
20 | __kernel_uid_t _uid; /* backwards compatibility */ | ||
21 | __kernel_uid32_t _uid32; /* sender's uid */ | ||
22 | } _kill; | ||
23 | |||
24 | /* POSIX.1b timers */ | ||
25 | struct { | ||
26 | timer_t _tid; /* timer id */ | ||
27 | int _overrun; /* overrun count */ | ||
28 | char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)]; | ||
29 | sigval_t _sigval; /* same as below */ | ||
30 | int _sys_private; /* not to be passed to user */ | ||
31 | } _timer; | ||
32 | |||
33 | /* POSIX.1b signals */ | ||
34 | struct { | ||
35 | __kernel_pid_t _pid; /* sender's pid */ | ||
36 | __kernel_uid_t _uid; /* backwards compatibility */ | ||
37 | sigval_t _sigval; | ||
38 | __kernel_uid32_t _uid32; /* sender's uid */ | ||
39 | } _rt; | ||
40 | |||
41 | /* SIGCHLD */ | ||
42 | struct { | ||
43 | __kernel_pid_t _pid; /* which child */ | ||
44 | __kernel_uid_t _uid; /* backwards compatibility */ | ||
45 | int _status; /* exit code */ | ||
46 | clock_t _utime; | ||
47 | clock_t _stime; | ||
48 | __kernel_uid32_t _uid32; /* sender's uid */ | ||
49 | } _sigchld; | ||
50 | |||
51 | /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ | ||
52 | struct { | ||
53 | void *_addr; /* faulting insn/memory ref. */ | ||
54 | } _sigfault; | ||
55 | |||
56 | /* SIGPOLL */ | ||
57 | struct { | ||
58 | int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ | ||
59 | int _fd; | ||
60 | } _sigpoll; | ||
61 | } _sifields; | ||
62 | } siginfo_t; | ||
63 | |||
64 | #define UID16_SIGINFO_COMPAT_NEEDED | ||
65 | |||
66 | /* | ||
67 | * How these fields are to be accessed. | ||
68 | */ | ||
69 | #undef si_uid | ||
70 | #ifdef __KERNEL__ | ||
71 | #define si_uid _sifields._kill._uid32 | ||
72 | #define si_uid16 _sifields._kill._uid | ||
73 | #else | ||
74 | #define si_uid _sifields._kill._uid | ||
75 | #endif | ||
76 | |||
77 | #ifdef __KERNEL__ | ||
78 | |||
79 | #include <linux/string.h> | ||
80 | |||
81 | static inline void copy_siginfo(struct siginfo *to, struct siginfo *from) | ||
82 | { | ||
83 | if (from->si_code < 0) | ||
84 | memcpy(to, from, sizeof(*to)); | ||
85 | else | ||
86 | /* _sigchld is currently the largest know union member */ | ||
87 | memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld)); | ||
88 | } | ||
89 | |||
90 | #endif /* __KERNEL__ */ | ||
91 | |||
92 | #endif | ||
diff --git a/include/asm-m68k/signal.h b/include/asm-m68k/signal.h new file mode 100644 index 000000000000..6681bb6a5523 --- /dev/null +++ b/include/asm-m68k/signal.h | |||
@@ -0,0 +1,220 @@ | |||
1 | #ifndef _M68K_SIGNAL_H | ||
2 | #define _M68K_SIGNAL_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* Avoid too many header ordering problems. */ | ||
7 | struct siginfo; | ||
8 | |||
9 | #ifdef __KERNEL__ | ||
10 | /* Most things should be clean enough to redefine this at will, if care | ||
11 | is taken to make libc match. */ | ||
12 | |||
13 | #define _NSIG 64 | ||
14 | #define _NSIG_BPW 32 | ||
15 | #define _NSIG_WORDS (_NSIG / _NSIG_BPW) | ||
16 | |||
17 | typedef unsigned long old_sigset_t; /* at least 32 bits */ | ||
18 | |||
19 | typedef struct { | ||
20 | unsigned long sig[_NSIG_WORDS]; | ||
21 | } sigset_t; | ||
22 | |||
23 | #else | ||
24 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
25 | |||
26 | #define NSIG 32 | ||
27 | typedef unsigned long sigset_t; | ||
28 | |||
29 | #endif /* __KERNEL__ */ | ||
30 | |||
31 | #define SIGHUP 1 | ||
32 | #define SIGINT 2 | ||
33 | #define SIGQUIT 3 | ||
34 | #define SIGILL 4 | ||
35 | #define SIGTRAP 5 | ||
36 | #define SIGABRT 6 | ||
37 | #define SIGIOT 6 | ||
38 | #define SIGBUS 7 | ||
39 | #define SIGFPE 8 | ||
40 | #define SIGKILL 9 | ||
41 | #define SIGUSR1 10 | ||
42 | #define SIGSEGV 11 | ||
43 | #define SIGUSR2 12 | ||
44 | #define SIGPIPE 13 | ||
45 | #define SIGALRM 14 | ||
46 | #define SIGTERM 15 | ||
47 | #define SIGSTKFLT 16 | ||
48 | #define SIGCHLD 17 | ||
49 | #define SIGCONT 18 | ||
50 | #define SIGSTOP 19 | ||
51 | #define SIGTSTP 20 | ||
52 | #define SIGTTIN 21 | ||
53 | #define SIGTTOU 22 | ||
54 | #define SIGURG 23 | ||
55 | #define SIGXCPU 24 | ||
56 | #define SIGXFSZ 25 | ||
57 | #define SIGVTALRM 26 | ||
58 | #define SIGPROF 27 | ||
59 | #define SIGWINCH 28 | ||
60 | #define SIGIO 29 | ||
61 | #define SIGPOLL SIGIO | ||
62 | /* | ||
63 | #define SIGLOST 29 | ||
64 | */ | ||
65 | #define SIGPWR 30 | ||
66 | #define SIGSYS 31 | ||
67 | #define SIGUNUSED 31 | ||
68 | |||
69 | /* These should not be considered constants from userland. */ | ||
70 | #define SIGRTMIN 32 | ||
71 | #define SIGRTMAX _NSIG | ||
72 | |||
73 | /* | ||
74 | * SA_FLAGS values: | ||
75 | * | ||
76 | * SA_ONSTACK indicates that a registered stack_t will be used. | ||
77 | * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the | ||
78 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
79 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
80 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
81 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
82 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
83 | * | ||
84 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
85 | * Unix names RESETHAND and NODEFER respectively. | ||
86 | */ | ||
87 | #define SA_NOCLDSTOP 0x00000001 | ||
88 | #define SA_NOCLDWAIT 0x00000002 | ||
89 | #define SA_SIGINFO 0x00000004 | ||
90 | #define SA_ONSTACK 0x08000000 | ||
91 | #define SA_RESTART 0x10000000 | ||
92 | #define SA_NODEFER 0x40000000 | ||
93 | #define SA_RESETHAND 0x80000000 | ||
94 | |||
95 | #define SA_NOMASK SA_NODEFER | ||
96 | #define SA_ONESHOT SA_RESETHAND | ||
97 | #define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ | ||
98 | |||
99 | /* | ||
100 | * sigaltstack controls | ||
101 | */ | ||
102 | #define SS_ONSTACK 1 | ||
103 | #define SS_DISABLE 2 | ||
104 | |||
105 | #define MINSIGSTKSZ 2048 | ||
106 | #define SIGSTKSZ 8192 | ||
107 | |||
108 | #ifdef __KERNEL__ | ||
109 | /* | ||
110 | * These values of sa_flags are used only by the kernel as part of the | ||
111 | * irq handling routines. | ||
112 | * | ||
113 | * SA_INTERRUPT is also used by the irq handling routines. | ||
114 | * SA_SHIRQ is for shared interrupt support on PCI and EISA. | ||
115 | */ | ||
116 | #define SA_PROBE SA_ONESHOT | ||
117 | #define SA_SAMPLE_RANDOM SA_RESTART | ||
118 | #define SA_SHIRQ 0x04000000 | ||
119 | #endif | ||
120 | |||
121 | #define SIG_BLOCK 0 /* for blocking signals */ | ||
122 | #define SIG_UNBLOCK 1 /* for unblocking signals */ | ||
123 | #define SIG_SETMASK 2 /* for setting the signal mask */ | ||
124 | |||
125 | /* Type of a signal handler. */ | ||
126 | typedef void (*__sighandler_t)(int); | ||
127 | |||
128 | #define SIG_DFL ((__sighandler_t)0) /* default signal handling */ | ||
129 | #define SIG_IGN ((__sighandler_t)1) /* ignore signal */ | ||
130 | #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ | ||
131 | |||
132 | #ifdef __KERNEL__ | ||
133 | struct old_sigaction { | ||
134 | __sighandler_t sa_handler; | ||
135 | old_sigset_t sa_mask; | ||
136 | unsigned long sa_flags; | ||
137 | void (*sa_restorer)(void); | ||
138 | }; | ||
139 | |||
140 | struct sigaction { | ||
141 | __sighandler_t sa_handler; | ||
142 | unsigned long sa_flags; | ||
143 | void (*sa_restorer)(void); | ||
144 | sigset_t sa_mask; /* mask last for extensibility */ | ||
145 | }; | ||
146 | |||
147 | struct k_sigaction { | ||
148 | struct sigaction sa; | ||
149 | }; | ||
150 | #else | ||
151 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
152 | |||
153 | struct sigaction { | ||
154 | union { | ||
155 | __sighandler_t _sa_handler; | ||
156 | void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
157 | } _u; | ||
158 | sigset_t sa_mask; | ||
159 | unsigned long sa_flags; | ||
160 | void (*sa_restorer)(void); | ||
161 | }; | ||
162 | |||
163 | #define sa_handler _u._sa_handler | ||
164 | #define sa_sigaction _u._sa_sigaction | ||
165 | |||
166 | #endif /* __KERNEL__ */ | ||
167 | |||
168 | typedef struct sigaltstack { | ||
169 | void *ss_sp; | ||
170 | int ss_flags; | ||
171 | size_t ss_size; | ||
172 | } stack_t; | ||
173 | |||
174 | #ifdef __KERNEL__ | ||
175 | #include <asm/sigcontext.h> | ||
176 | |||
177 | #define __HAVE_ARCH_SIG_BITOPS | ||
178 | |||
179 | static inline void sigaddset(sigset_t *set, int _sig) | ||
180 | { | ||
181 | __asm__("bfset %0{%1,#1}" : "=m" (*set) : "id" ((_sig - 1) ^ 31) | ||
182 | : "cc"); | ||
183 | } | ||
184 | |||
185 | static inline void sigdelset(sigset_t *set, int _sig) | ||
186 | { | ||
187 | __asm__("bfclr %0{%1,#1}" : "=m"(*set) : "id"((_sig - 1) ^ 31) | ||
188 | : "cc"); | ||
189 | } | ||
190 | |||
191 | static inline int __const_sigismember(sigset_t *set, int _sig) | ||
192 | { | ||
193 | unsigned long sig = _sig - 1; | ||
194 | return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW)); | ||
195 | } | ||
196 | |||
197 | static inline int __gen_sigismember(sigset_t *set, int _sig) | ||
198 | { | ||
199 | int ret; | ||
200 | __asm__("bfextu %1{%2,#1},%0" | ||
201 | : "=d"(ret) : "m"(*set), "id"((_sig-1) ^ 31)); | ||
202 | return ret; | ||
203 | } | ||
204 | |||
205 | #define sigismember(set,sig) \ | ||
206 | (__builtin_constant_p(sig) ? \ | ||
207 | __const_sigismember(set,sig) : \ | ||
208 | __gen_sigismember(set,sig)) | ||
209 | |||
210 | static inline int sigfindinword(unsigned long word) | ||
211 | { | ||
212 | __asm__("bfffo %1{#0,#0},%0" : "=d"(word) : "d"(word & -word) : "cc"); | ||
213 | return word ^ 31; | ||
214 | } | ||
215 | |||
216 | extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie); | ||
217 | |||
218 | #endif /* __KERNEL__ */ | ||
219 | |||
220 | #endif /* _M68K_SIGNAL_H */ | ||
diff --git a/include/asm-m68k/socket.h b/include/asm-m68k/socket.h new file mode 100644 index 000000000000..8d0b9fc2d07e --- /dev/null +++ b/include/asm-m68k/socket.h | |||
@@ -0,0 +1,50 @@ | |||
1 | #ifndef _ASM_SOCKET_H | ||
2 | #define _ASM_SOCKET_H | ||
3 | |||
4 | #include <asm/sockios.h> | ||
5 | |||
6 | /* For setsockopt(2) */ | ||
7 | #define SOL_SOCKET 1 | ||
8 | |||
9 | #define SO_DEBUG 1 | ||
10 | #define SO_REUSEADDR 2 | ||
11 | #define SO_TYPE 3 | ||
12 | #define SO_ERROR 4 | ||
13 | #define SO_DONTROUTE 5 | ||
14 | #define SO_BROADCAST 6 | ||
15 | #define SO_SNDBUF 7 | ||
16 | #define SO_RCVBUF 8 | ||
17 | #define SO_KEEPALIVE 9 | ||
18 | #define SO_OOBINLINE 10 | ||
19 | #define SO_NO_CHECK 11 | ||
20 | #define SO_PRIORITY 12 | ||
21 | #define SO_LINGER 13 | ||
22 | #define SO_BSDCOMPAT 14 | ||
23 | /* To add :#define SO_REUSEPORT 15 */ | ||
24 | #define SO_PASSCRED 16 | ||
25 | #define SO_PEERCRED 17 | ||
26 | #define SO_RCVLOWAT 18 | ||
27 | #define SO_SNDLOWAT 19 | ||
28 | #define SO_RCVTIMEO 20 | ||
29 | #define SO_SNDTIMEO 21 | ||
30 | |||
31 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | ||
32 | #define SO_SECURITY_AUTHENTICATION 22 | ||
33 | #define SO_SECURITY_ENCRYPTION_TRANSPORT 23 | ||
34 | #define SO_SECURITY_ENCRYPTION_NETWORK 24 | ||
35 | |||
36 | #define SO_BINDTODEVICE 25 | ||
37 | |||
38 | /* Socket filtering */ | ||
39 | #define SO_ATTACH_FILTER 26 | ||
40 | #define SO_DETACH_FILTER 27 | ||
41 | |||
42 | #define SO_PEERNAME 28 | ||
43 | #define SO_TIMESTAMP 29 | ||
44 | #define SCM_TIMESTAMP SO_TIMESTAMP | ||
45 | |||
46 | #define SO_ACCEPTCONN 30 | ||
47 | |||
48 | #define SO_PEERSEC 31 | ||
49 | |||
50 | #endif /* _ASM_SOCKET_H */ | ||
diff --git a/include/asm-m68k/sockios.h b/include/asm-m68k/sockios.h new file mode 100644 index 000000000000..9b9ed973c24e --- /dev/null +++ b/include/asm-m68k/sockios.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef __ARCH_M68K_SOCKIOS__ | ||
2 | #define __ARCH_M68K_SOCKIOS__ | ||
3 | |||
4 | /* Socket-level I/O control calls. */ | ||
5 | #define FIOSETOWN 0x8901 | ||
6 | #define SIOCSPGRP 0x8902 | ||
7 | #define FIOGETOWN 0x8903 | ||
8 | #define SIOCGPGRP 0x8904 | ||
9 | #define SIOCATMARK 0x8905 | ||
10 | #define SIOCGSTAMP 0x8906 /* Get stamp */ | ||
11 | |||
12 | #endif /* __ARCH_M68K_SOCKIOS__ */ | ||
diff --git a/include/asm-m68k/spinlock.h b/include/asm-m68k/spinlock.h new file mode 100644 index 000000000000..20f46e27b534 --- /dev/null +++ b/include/asm-m68k/spinlock.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __M68K_SPINLOCK_H | ||
2 | #define __M68K_SPINLOCK_H | ||
3 | |||
4 | #error "m68k doesn't do SMP yet" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-m68k/stat.h b/include/asm-m68k/stat.h new file mode 100644 index 000000000000..c4c402a45e21 --- /dev/null +++ b/include/asm-m68k/stat.h | |||
@@ -0,0 +1,78 @@ | |||
1 | #ifndef _M68K_STAT_H | ||
2 | #define _M68K_STAT_H | ||
3 | |||
4 | struct __old_kernel_stat { | ||
5 | unsigned short st_dev; | ||
6 | unsigned short st_ino; | ||
7 | unsigned short st_mode; | ||
8 | unsigned short st_nlink; | ||
9 | unsigned short st_uid; | ||
10 | unsigned short st_gid; | ||
11 | unsigned short st_rdev; | ||
12 | unsigned long st_size; | ||
13 | unsigned long st_atime; | ||
14 | unsigned long st_mtime; | ||
15 | unsigned long st_ctime; | ||
16 | }; | ||
17 | |||
18 | struct stat { | ||
19 | unsigned short st_dev; | ||
20 | unsigned short __pad1; | ||
21 | unsigned long st_ino; | ||
22 | unsigned short st_mode; | ||
23 | unsigned short st_nlink; | ||
24 | unsigned short st_uid; | ||
25 | unsigned short st_gid; | ||
26 | unsigned short st_rdev; | ||
27 | unsigned short __pad2; | ||
28 | unsigned long st_size; | ||
29 | unsigned long st_blksize; | ||
30 | unsigned long st_blocks; | ||
31 | unsigned long st_atime; | ||
32 | unsigned long __unused1; | ||
33 | unsigned long st_mtime; | ||
34 | unsigned long __unused2; | ||
35 | unsigned long st_ctime; | ||
36 | unsigned long __unused3; | ||
37 | unsigned long __unused4; | ||
38 | unsigned long __unused5; | ||
39 | }; | ||
40 | |||
41 | /* This matches struct stat64 in glibc2.1, hence the absolutely | ||
42 | * insane amounts of padding around dev_t's. | ||
43 | */ | ||
44 | struct stat64 { | ||
45 | unsigned long long st_dev; | ||
46 | unsigned char __pad1[2]; | ||
47 | |||
48 | #define STAT64_HAS_BROKEN_ST_INO 1 | ||
49 | unsigned long __st_ino; | ||
50 | |||
51 | unsigned int st_mode; | ||
52 | unsigned int st_nlink; | ||
53 | |||
54 | unsigned long st_uid; | ||
55 | unsigned long st_gid; | ||
56 | |||
57 | unsigned long long st_rdev; | ||
58 | unsigned char __pad3[2]; | ||
59 | |||
60 | long long st_size; | ||
61 | unsigned long st_blksize; | ||
62 | |||
63 | unsigned long __pad4; /* future possible st_blocks high bits */ | ||
64 | unsigned long st_blocks; /* Number 512-byte blocks allocated. */ | ||
65 | |||
66 | unsigned long st_atime; | ||
67 | unsigned long st_atime_nsec; | ||
68 | |||
69 | unsigned long st_mtime; | ||
70 | unsigned long st_mtime_nsec; | ||
71 | |||
72 | unsigned long st_ctime; | ||
73 | unsigned long st_ctime_nsec; | ||
74 | |||
75 | unsigned long long st_ino; | ||
76 | }; | ||
77 | |||
78 | #endif /* _M68K_STAT_H */ | ||
diff --git a/include/asm-m68k/statfs.h b/include/asm-m68k/statfs.h new file mode 100644 index 000000000000..08d93f14e061 --- /dev/null +++ b/include/asm-m68k/statfs.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _M68K_STATFS_H | ||
2 | #define _M68K_STATFS_H | ||
3 | |||
4 | #include <asm-generic/statfs.h> | ||
5 | |||
6 | #endif /* _M68K_STATFS_H */ | ||
diff --git a/include/asm-m68k/string.h b/include/asm-m68k/string.h new file mode 100644 index 000000000000..44def078132a --- /dev/null +++ b/include/asm-m68k/string.h | |||
@@ -0,0 +1,542 @@ | |||
1 | #ifndef _M68K_STRING_H_ | ||
2 | #define _M68K_STRING_H_ | ||
3 | |||
4 | #include <asm/setup.h> | ||
5 | #include <asm/page.h> | ||
6 | |||
7 | #define __HAVE_ARCH_STRCPY | ||
8 | static inline char * strcpy(char * dest,const char *src) | ||
9 | { | ||
10 | char *xdest = dest; | ||
11 | |||
12 | __asm__ __volatile__ | ||
13 | ("1:\tmoveb %1@+,%0@+\n\t" | ||
14 | "jne 1b" | ||
15 | : "=a" (dest), "=a" (src) | ||
16 | : "0" (dest), "1" (src) : "memory"); | ||
17 | return xdest; | ||
18 | } | ||
19 | |||
20 | #define __HAVE_ARCH_STRNCPY | ||
21 | static inline char * strncpy(char *dest, const char *src, size_t n) | ||
22 | { | ||
23 | char *xdest = dest; | ||
24 | |||
25 | if (n == 0) | ||
26 | return xdest; | ||
27 | |||
28 | __asm__ __volatile__ | ||
29 | ("1:\tmoveb %1@+,%0@+\n\t" | ||
30 | "jeq 2f\n\t" | ||
31 | "subql #1,%2\n\t" | ||
32 | "jne 1b\n\t" | ||
33 | "2:" | ||
34 | : "=a" (dest), "=a" (src), "=d" (n) | ||
35 | : "0" (dest), "1" (src), "2" (n) | ||
36 | : "memory"); | ||
37 | return xdest; | ||
38 | } | ||
39 | |||
40 | #define __HAVE_ARCH_STRCAT | ||
41 | static inline char * strcat(char * dest, const char * src) | ||
42 | { | ||
43 | char *tmp = dest; | ||
44 | |||
45 | while (*dest) | ||
46 | dest++; | ||
47 | while ((*dest++ = *src++)) | ||
48 | ; | ||
49 | |||
50 | return tmp; | ||
51 | } | ||
52 | |||
53 | #define __HAVE_ARCH_STRNCAT | ||
54 | static inline char * strncat(char *dest, const char *src, size_t count) | ||
55 | { | ||
56 | char *tmp = dest; | ||
57 | |||
58 | if (count) { | ||
59 | while (*dest) | ||
60 | dest++; | ||
61 | while ((*dest++ = *src++)) { | ||
62 | if (--count == 0) { | ||
63 | *dest++='\0'; | ||
64 | break; | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | |||
69 | return tmp; | ||
70 | } | ||
71 | |||
72 | #define __HAVE_ARCH_STRCHR | ||
73 | static inline char * strchr(const char * s, int c) | ||
74 | { | ||
75 | const char ch = c; | ||
76 | |||
77 | for(; *s != ch; ++s) | ||
78 | if (*s == '\0') | ||
79 | return( NULL ); | ||
80 | return( (char *) s); | ||
81 | } | ||
82 | |||
83 | #if 0 | ||
84 | #define __HAVE_ARCH_STRPBRK | ||
85 | static inline char *strpbrk(const char *cs,const char *ct) | ||
86 | { | ||
87 | const char *sc1,*sc2; | ||
88 | |||
89 | for( sc1 = cs; *sc1 != '\0'; ++sc1) | ||
90 | for( sc2 = ct; *sc2 != '\0'; ++sc2) | ||
91 | if (*sc1 == *sc2) | ||
92 | return((char *) sc1); | ||
93 | return( NULL ); | ||
94 | } | ||
95 | #endif | ||
96 | |||
97 | #if 0 | ||
98 | #define __HAVE_ARCH_STRSPN | ||
99 | static inline size_t strspn(const char *s, const char *accept) | ||
100 | { | ||
101 | const char *p; | ||
102 | const char *a; | ||
103 | size_t count = 0; | ||
104 | |||
105 | for (p = s; *p != '\0'; ++p) | ||
106 | { | ||
107 | for (a = accept; *a != '\0'; ++a) | ||
108 | if (*p == *a) | ||
109 | break; | ||
110 | if (*a == '\0') | ||
111 | return count; | ||
112 | else | ||
113 | ++count; | ||
114 | } | ||
115 | |||
116 | return count; | ||
117 | } | ||
118 | #endif | ||
119 | |||
120 | /* strstr !! */ | ||
121 | |||
122 | #define __HAVE_ARCH_STRLEN | ||
123 | static inline size_t strlen(const char * s) | ||
124 | { | ||
125 | const char *sc; | ||
126 | for (sc = s; *sc != '\0'; ++sc) ; | ||
127 | return(sc - s); | ||
128 | } | ||
129 | |||
130 | /* strnlen !! */ | ||
131 | |||
132 | #define __HAVE_ARCH_STRCMP | ||
133 | static inline int strcmp(const char * cs,const char * ct) | ||
134 | { | ||
135 | char __res; | ||
136 | |||
137 | __asm__ | ||
138 | ("1:\tmoveb %0@+,%2\n\t" /* get *cs */ | ||
139 | "cmpb %1@+,%2\n\t" /* compare a byte */ | ||
140 | "jne 2f\n\t" /* not equal, break out */ | ||
141 | "tstb %2\n\t" /* at end of cs? */ | ||
142 | "jne 1b\n\t" /* no, keep going */ | ||
143 | "jra 3f\n\t" /* strings are equal */ | ||
144 | "2:\tsubb %1@-,%2\n\t" /* *cs - *ct */ | ||
145 | "3:" | ||
146 | : "=a" (cs), "=a" (ct), "=d" (__res) | ||
147 | : "0" (cs), "1" (ct)); | ||
148 | return __res; | ||
149 | } | ||
150 | |||
151 | #define __HAVE_ARCH_STRNCMP | ||
152 | static inline int strncmp(const char * cs,const char * ct,size_t count) | ||
153 | { | ||
154 | char __res; | ||
155 | |||
156 | if (!count) | ||
157 | return 0; | ||
158 | __asm__ | ||
159 | ("1:\tmovb %0@+,%3\n\t" /* get *cs */ | ||
160 | "cmpb %1@+,%3\n\t" /* compare a byte */ | ||
161 | "jne 3f\n\t" /* not equal, break out */ | ||
162 | "tstb %3\n\t" /* at end of cs? */ | ||
163 | "jeq 4f\n\t" /* yes, all done */ | ||
164 | "subql #1,%2\n\t" /* no, adjust count */ | ||
165 | "jne 1b\n\t" /* more to do, keep going */ | ||
166 | "2:\tmoveq #0,%3\n\t" /* strings are equal */ | ||
167 | "jra 4f\n\t" | ||
168 | "3:\tsubb %1@-,%3\n\t" /* *cs - *ct */ | ||
169 | "4:" | ||
170 | : "=a" (cs), "=a" (ct), "=d" (count), "=d" (__res) | ||
171 | : "0" (cs), "1" (ct), "2" (count)); | ||
172 | return __res; | ||
173 | } | ||
174 | |||
175 | #define __HAVE_ARCH_MEMSET | ||
176 | /* | ||
177 | * This is really ugly, but its highly optimizatiable by the | ||
178 | * compiler and is meant as compensation for gcc's missing | ||
179 | * __builtin_memset(). For the 680[23]0 it might be worth considering | ||
180 | * the optimal number of misaligned writes compared to the number of | ||
181 | * tests'n'branches needed to align the destination address. The | ||
182 | * 680[46]0 doesn't really care due to their copy-back caches. | ||
183 | * 10/09/96 - Jes Sorensen | ||
184 | */ | ||
185 | static inline void * __memset_g(void * s, int c, size_t count) | ||
186 | { | ||
187 | void *xs = s; | ||
188 | size_t temp; | ||
189 | |||
190 | if (!count) | ||
191 | return xs; | ||
192 | |||
193 | c &= 0xff; | ||
194 | c |= c << 8; | ||
195 | c |= c << 16; | ||
196 | |||
197 | if (count < 36){ | ||
198 | long *ls = s; | ||
199 | |||
200 | switch(count){ | ||
201 | case 32: case 33: case 34: case 35: | ||
202 | *ls++ = c; | ||
203 | case 28: case 29: case 30: case 31: | ||
204 | *ls++ = c; | ||
205 | case 24: case 25: case 26: case 27: | ||
206 | *ls++ = c; | ||
207 | case 20: case 21: case 22: case 23: | ||
208 | *ls++ = c; | ||
209 | case 16: case 17: case 18: case 19: | ||
210 | *ls++ = c; | ||
211 | case 12: case 13: case 14: case 15: | ||
212 | *ls++ = c; | ||
213 | case 8: case 9: case 10: case 11: | ||
214 | *ls++ = c; | ||
215 | case 4: case 5: case 6: case 7: | ||
216 | *ls++ = c; | ||
217 | break; | ||
218 | default: | ||
219 | break; | ||
220 | } | ||
221 | s = ls; | ||
222 | if (count & 0x02){ | ||
223 | short *ss = s; | ||
224 | *ss++ = c; | ||
225 | s = ss; | ||
226 | } | ||
227 | if (count & 0x01){ | ||
228 | char *cs = s; | ||
229 | *cs++ = c; | ||
230 | s = cs; | ||
231 | } | ||
232 | return xs; | ||
233 | } | ||
234 | |||
235 | if ((long) s & 1) | ||
236 | { | ||
237 | char *cs = s; | ||
238 | *cs++ = c; | ||
239 | s = cs; | ||
240 | count--; | ||
241 | } | ||
242 | if (count > 2 && (long) s & 2) | ||
243 | { | ||
244 | short *ss = s; | ||
245 | *ss++ = c; | ||
246 | s = ss; | ||
247 | count -= 2; | ||
248 | } | ||
249 | temp = count >> 2; | ||
250 | if (temp) | ||
251 | { | ||
252 | long *ls = s; | ||
253 | temp--; | ||
254 | do | ||
255 | *ls++ = c; | ||
256 | while (temp--); | ||
257 | s = ls; | ||
258 | } | ||
259 | if (count & 2) | ||
260 | { | ||
261 | short *ss = s; | ||
262 | *ss++ = c; | ||
263 | s = ss; | ||
264 | } | ||
265 | if (count & 1) | ||
266 | { | ||
267 | char *cs = s; | ||
268 | *cs = c; | ||
269 | } | ||
270 | return xs; | ||
271 | } | ||
272 | |||
273 | /* | ||
274 | * __memset_page assumes that data is longword aligned. Most, if not | ||
275 | * all, of these page sized memsets are performed on page aligned | ||
276 | * areas, thus we do not need to check if the destination is longword | ||
277 | * aligned. Of course we suffer a serious performance loss if this is | ||
278 | * not the case but I think the risk of this ever happening is | ||
279 | * extremely small. We spend a lot of time clearing pages in | ||
280 | * get_empty_page() so I think it is worth it anyway. Besides, the | ||
281 | * 680[46]0 do not really care about misaligned writes due to their | ||
282 | * copy-back cache. | ||
283 | * | ||
284 | * The optimized case for the 680[46]0 is implemented using the move16 | ||
285 | * instruction. My tests showed that this implementation is 35-45% | ||
286 | * faster than the original implementation using movel, the only | ||
287 | * caveat is that the destination address must be 16-byte aligned. | ||
288 | * 01/09/96 - Jes Sorensen | ||
289 | */ | ||
290 | static inline void * __memset_page(void * s,int c,size_t count) | ||
291 | { | ||
292 | unsigned long data, tmp; | ||
293 | void *xs = s; | ||
294 | |||
295 | c = c & 255; | ||
296 | data = c | (c << 8); | ||
297 | data |= data << 16; | ||
298 | |||
299 | #ifdef CPU_M68040_OR_M68060_ONLY | ||
300 | |||
301 | if (((unsigned long) s) & 0x0f) | ||
302 | __memset_g(s, c, count); | ||
303 | else{ | ||
304 | unsigned long *sp = s; | ||
305 | *sp++ = data; | ||
306 | *sp++ = data; | ||
307 | *sp++ = data; | ||
308 | *sp++ = data; | ||
309 | |||
310 | __asm__ __volatile__("1:\t" | ||
311 | ".chip 68040\n\t" | ||
312 | "move16 %2@+,%0@+\n\t" | ||
313 | ".chip 68k\n\t" | ||
314 | "subqw #8,%2\n\t" | ||
315 | "subqw #8,%2\n\t" | ||
316 | "dbra %1,1b\n\t" | ||
317 | : "=a" (sp), "=d" (tmp) | ||
318 | : "a" (s), "0" (sp), "1" ((count - 16) / 16 - 1) | ||
319 | ); | ||
320 | } | ||
321 | |||
322 | #else | ||
323 | __asm__ __volatile__("1:\t" | ||
324 | "movel %2,%0@+\n\t" | ||
325 | "movel %2,%0@+\n\t" | ||
326 | "movel %2,%0@+\n\t" | ||
327 | "movel %2,%0@+\n\t" | ||
328 | "movel %2,%0@+\n\t" | ||
329 | "movel %2,%0@+\n\t" | ||
330 | "movel %2,%0@+\n\t" | ||
331 | "movel %2,%0@+\n\t" | ||
332 | "dbra %1,1b\n\t" | ||
333 | : "=a" (s), "=d" (tmp) | ||
334 | : "d" (data), "0" (s), "1" (count / 32 - 1) | ||
335 | ); | ||
336 | #endif | ||
337 | |||
338 | return xs; | ||
339 | } | ||
340 | |||
341 | extern void *memset(void *,int,__kernel_size_t); | ||
342 | |||
343 | #define __memset_const(s,c,count) \ | ||
344 | ((count==PAGE_SIZE) ? \ | ||
345 | __memset_page((s),(c),(count)) : \ | ||
346 | __memset_g((s),(c),(count))) | ||
347 | |||
348 | #define memset(s, c, count) \ | ||
349 | (__builtin_constant_p(count) ? \ | ||
350 | __memset_const((s),(c),(count)) : \ | ||
351 | __memset_g((s),(c),(count))) | ||
352 | |||
353 | #define __HAVE_ARCH_MEMCPY | ||
354 | extern void * memcpy(void *, const void *, size_t ); | ||
355 | /* | ||
356 | * __builtin_memcpy() does not handle page-sized memcpys very well, | ||
357 | * thus following the same assumptions as for page-sized memsets, this | ||
358 | * function copies page-sized areas using an unrolled loop, without | ||
359 | * considering alignment. | ||
360 | * | ||
361 | * For the 680[46]0 only kernels we use the move16 instruction instead | ||
362 | * as it writes through the data-cache, invalidating the cache-lines | ||
363 | * touched. In this way we do not use up the entire data-cache (well, | ||
364 | * half of it on the 68060) by copying a page. An unrolled loop of two | ||
365 | * move16 instructions seem to the fastest. The only caveat is that | ||
366 | * both source and destination must be 16-byte aligned, if not we fall | ||
367 | * back to the generic memcpy function. - Jes | ||
368 | */ | ||
369 | static inline void * __memcpy_page(void * to, const void * from, size_t count) | ||
370 | { | ||
371 | unsigned long tmp; | ||
372 | void *xto = to; | ||
373 | |||
374 | #ifdef CPU_M68040_OR_M68060_ONLY | ||
375 | |||
376 | if (((unsigned long) to | (unsigned long) from) & 0x0f) | ||
377 | return memcpy(to, from, count); | ||
378 | |||
379 | __asm__ __volatile__("1:\t" | ||
380 | ".chip 68040\n\t" | ||
381 | "move16 %1@+,%0@+\n\t" | ||
382 | "move16 %1@+,%0@+\n\t" | ||
383 | ".chip 68k\n\t" | ||
384 | "dbra %2,1b\n\t" | ||
385 | : "=a" (to), "=a" (from), "=d" (tmp) | ||
386 | : "0" (to), "1" (from) , "2" (count / 32 - 1) | ||
387 | ); | ||
388 | #else | ||
389 | __asm__ __volatile__("1:\t" | ||
390 | "movel %1@+,%0@+\n\t" | ||
391 | "movel %1@+,%0@+\n\t" | ||
392 | "movel %1@+,%0@+\n\t" | ||
393 | "movel %1@+,%0@+\n\t" | ||
394 | "movel %1@+,%0@+\n\t" | ||
395 | "movel %1@+,%0@+\n\t" | ||
396 | "movel %1@+,%0@+\n\t" | ||
397 | "movel %1@+,%0@+\n\t" | ||
398 | "dbra %2,1b\n\t" | ||
399 | : "=a" (to), "=a" (from), "=d" (tmp) | ||
400 | : "0" (to), "1" (from) , "2" (count / 32 - 1) | ||
401 | ); | ||
402 | #endif | ||
403 | return xto; | ||
404 | } | ||
405 | |||
406 | #define __memcpy_const(to, from, n) \ | ||
407 | ((n==PAGE_SIZE) ? \ | ||
408 | __memcpy_page((to),(from),(n)) : \ | ||
409 | __builtin_memcpy((to),(from),(n))) | ||
410 | |||
411 | #define memcpy(to, from, n) \ | ||
412 | (__builtin_constant_p(n) ? \ | ||
413 | __memcpy_const((to),(from),(n)) : \ | ||
414 | memcpy((to),(from),(n))) | ||
415 | |||
416 | #define __HAVE_ARCH_MEMMOVE | ||
417 | static inline void * memmove(void * dest,const void * src, size_t n) | ||
418 | { | ||
419 | void *xdest = dest; | ||
420 | size_t temp; | ||
421 | |||
422 | if (!n) | ||
423 | return xdest; | ||
424 | |||
425 | if (dest < src) | ||
426 | { | ||
427 | if ((long) dest & 1) | ||
428 | { | ||
429 | char *cdest = dest; | ||
430 | const char *csrc = src; | ||
431 | *cdest++ = *csrc++; | ||
432 | dest = cdest; | ||
433 | src = csrc; | ||
434 | n--; | ||
435 | } | ||
436 | if (n > 2 && (long) dest & 2) | ||
437 | { | ||
438 | short *sdest = dest; | ||
439 | const short *ssrc = src; | ||
440 | *sdest++ = *ssrc++; | ||
441 | dest = sdest; | ||
442 | src = ssrc; | ||
443 | n -= 2; | ||
444 | } | ||
445 | temp = n >> 2; | ||
446 | if (temp) | ||
447 | { | ||
448 | long *ldest = dest; | ||
449 | const long *lsrc = src; | ||
450 | temp--; | ||
451 | do | ||
452 | *ldest++ = *lsrc++; | ||
453 | while (temp--); | ||
454 | dest = ldest; | ||
455 | src = lsrc; | ||
456 | } | ||
457 | if (n & 2) | ||
458 | { | ||
459 | short *sdest = dest; | ||
460 | const short *ssrc = src; | ||
461 | *sdest++ = *ssrc++; | ||
462 | dest = sdest; | ||
463 | src = ssrc; | ||
464 | } | ||
465 | if (n & 1) | ||
466 | { | ||
467 | char *cdest = dest; | ||
468 | const char *csrc = src; | ||
469 | *cdest = *csrc; | ||
470 | } | ||
471 | } | ||
472 | else | ||
473 | { | ||
474 | dest = (char *) dest + n; | ||
475 | src = (const char *) src + n; | ||
476 | if ((long) dest & 1) | ||
477 | { | ||
478 | char *cdest = dest; | ||
479 | const char *csrc = src; | ||
480 | *--cdest = *--csrc; | ||
481 | dest = cdest; | ||
482 | src = csrc; | ||
483 | n--; | ||
484 | } | ||
485 | if (n > 2 && (long) dest & 2) | ||
486 | { | ||
487 | short *sdest = dest; | ||
488 | const short *ssrc = src; | ||
489 | *--sdest = *--ssrc; | ||
490 | dest = sdest; | ||
491 | src = ssrc; | ||
492 | n -= 2; | ||
493 | } | ||
494 | temp = n >> 2; | ||
495 | if (temp) | ||
496 | { | ||
497 | long *ldest = dest; | ||
498 | const long *lsrc = src; | ||
499 | temp--; | ||
500 | do | ||
501 | *--ldest = *--lsrc; | ||
502 | while (temp--); | ||
503 | dest = ldest; | ||
504 | src = lsrc; | ||
505 | } | ||
506 | if (n & 2) | ||
507 | { | ||
508 | short *sdest = dest; | ||
509 | const short *ssrc = src; | ||
510 | *--sdest = *--ssrc; | ||
511 | dest = sdest; | ||
512 | src = ssrc; | ||
513 | } | ||
514 | if (n & 1) | ||
515 | { | ||
516 | char *cdest = dest; | ||
517 | const char *csrc = src; | ||
518 | *--cdest = *--csrc; | ||
519 | } | ||
520 | } | ||
521 | return xdest; | ||
522 | } | ||
523 | |||
524 | #define __HAVE_ARCH_MEMCMP | ||
525 | extern int memcmp(const void * ,const void * ,size_t ); | ||
526 | #define memcmp(cs, ct, n) \ | ||
527 | (__builtin_constant_p(n) ? \ | ||
528 | __builtin_memcmp((cs),(ct),(n)) : \ | ||
529 | memcmp((cs),(ct),(n))) | ||
530 | |||
531 | #define __HAVE_ARCH_MEMCHR | ||
532 | static inline void *memchr(const void *cs, int c, size_t count) | ||
533 | { | ||
534 | /* Someone else can optimize this, I don't care - tonym@mac.linux-m68k.org */ | ||
535 | unsigned char *ret = (unsigned char *)cs; | ||
536 | for(;count>0;count--,ret++) | ||
537 | if(*ret == c) return ret; | ||
538 | |||
539 | return NULL; | ||
540 | } | ||
541 | |||
542 | #endif /* _M68K_STRING_H_ */ | ||
diff --git a/include/asm-m68k/sun3-head.h b/include/asm-m68k/sun3-head.h new file mode 100644 index 000000000000..f799d95bad53 --- /dev/null +++ b/include/asm-m68k/sun3-head.h | |||
@@ -0,0 +1,12 @@ | |||
1 | /* $Id: head.h,v 1.32 1996/12/04 00:12:48 ecd Exp $ */ | ||
2 | #ifndef __SUN3_HEAD_H | ||
3 | #define __SUN3_HEAD_H | ||
4 | |||
5 | #define KERNBASE 0xE000000 /* First address the kernel will eventually be */ | ||
6 | #define LOAD_ADDR 0x4000 /* prom jumps to us here unless this is elf /boot */ | ||
7 | #define BI_START (KERNBASE + 0x3000) /* beginning of the bootinfo records */ | ||
8 | #define FC_CONTROL 3 | ||
9 | #define FC_SUPERD 5 | ||
10 | #define FC_CPU 7 | ||
11 | |||
12 | #endif /* __SUN3_HEAD_H */ | ||
diff --git a/include/asm-m68k/sun3_pgalloc.h b/include/asm-m68k/sun3_pgalloc.h new file mode 100644 index 000000000000..fd8241117649 --- /dev/null +++ b/include/asm-m68k/sun3_pgalloc.h | |||
@@ -0,0 +1,95 @@ | |||
1 | /* sun3_pgalloc.h -- | ||
2 | * reorganization around 2.3.39, routines moved from sun3_pgtable.h | ||
3 | * | ||
4 | * | ||
5 | * 02/27/2002 -- Modified to support "highpte" implementation in 2.5.5 (Sam) | ||
6 | * | ||
7 | * moved 1/26/2000 Sam Creasey | ||
8 | */ | ||
9 | |||
10 | #ifndef _SUN3_PGALLOC_H | ||
11 | #define _SUN3_PGALLOC_H | ||
12 | |||
13 | #include <asm/tlb.h> | ||
14 | |||
15 | /* FIXME - when we get this compiling */ | ||
16 | /* erm, now that it's compiling, what do we do with it? */ | ||
17 | #define _KERNPG_TABLE 0 | ||
18 | |||
19 | extern const char bad_pmd_string[]; | ||
20 | |||
21 | #define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) | ||
22 | |||
23 | |||
24 | static inline void pte_free_kernel(pte_t * pte) | ||
25 | { | ||
26 | free_page((unsigned long) pte); | ||
27 | } | ||
28 | |||
29 | static inline void pte_free(struct page *page) | ||
30 | { | ||
31 | __free_page(page); | ||
32 | } | ||
33 | |||
34 | #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) | ||
35 | |||
36 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | ||
37 | unsigned long address) | ||
38 | { | ||
39 | unsigned long page = __get_free_page(GFP_KERNEL|__GFP_REPEAT); | ||
40 | |||
41 | if (!page) | ||
42 | return NULL; | ||
43 | |||
44 | memset((void *)page, 0, PAGE_SIZE); | ||
45 | return (pte_t *) (page); | ||
46 | } | ||
47 | |||
48 | static inline struct page *pte_alloc_one(struct mm_struct *mm, | ||
49 | unsigned long address) | ||
50 | { | ||
51 | struct page *page = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0); | ||
52 | |||
53 | if (page == NULL) | ||
54 | return NULL; | ||
55 | |||
56 | clear_highpage(page); | ||
57 | return page; | ||
58 | |||
59 | } | ||
60 | |||
61 | static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) | ||
62 | { | ||
63 | pmd_val(*pmd) = __pa((unsigned long)pte); | ||
64 | } | ||
65 | |||
66 | static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page) | ||
67 | { | ||
68 | pmd_val(*pmd) = __pa((unsigned long)page_address(page)); | ||
69 | } | ||
70 | |||
71 | /* | ||
72 | * allocating and freeing a pmd is trivial: the 1-entry pmd is | ||
73 | * inside the pgd, so has no extra memory associated with it. | ||
74 | */ | ||
75 | #define pmd_free(x) do { } while (0) | ||
76 | #define __pmd_free_tlb(tlb, x) do { } while (0) | ||
77 | |||
78 | static inline void pgd_free(pgd_t * pgd) | ||
79 | { | ||
80 | free_page((unsigned long) pgd); | ||
81 | } | ||
82 | |||
83 | static inline pgd_t * pgd_alloc(struct mm_struct *mm) | ||
84 | { | ||
85 | pgd_t *new_pgd; | ||
86 | |||
87 | new_pgd = (pgd_t *)get_zeroed_page(GFP_KERNEL); | ||
88 | memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE); | ||
89 | memset(new_pgd, 0, (PAGE_OFFSET >> PGDIR_SHIFT)); | ||
90 | return new_pgd; | ||
91 | } | ||
92 | |||
93 | #define pgd_populate(mm, pmd, pte) BUG() | ||
94 | |||
95 | #endif /* SUN3_PGALLOC_H */ | ||
diff --git a/include/asm-m68k/sun3_pgtable.h b/include/asm-m68k/sun3_pgtable.h new file mode 100644 index 000000000000..e974bb072047 --- /dev/null +++ b/include/asm-m68k/sun3_pgtable.h | |||
@@ -0,0 +1,238 @@ | |||
1 | #ifndef _SUN3_PGTABLE_H | ||
2 | #define _SUN3_PGTABLE_H | ||
3 | |||
4 | #include <asm/sun3mmu.h> | ||
5 | |||
6 | #ifndef __ASSEMBLY__ | ||
7 | #include <asm/virtconvert.h> | ||
8 | #include <linux/linkage.h> | ||
9 | |||
10 | /* | ||
11 | * This file contains all the things which change drastically for the sun3 | ||
12 | * pagetable stuff, to avoid making too much of a mess of the generic m68k | ||
13 | * `pgtable.h'; this should only be included from the generic file. --m | ||
14 | */ | ||
15 | |||
16 | /* For virtual address to physical address conversion */ | ||
17 | #define VTOP(addr) __pa(addr) | ||
18 | #define PTOV(addr) __va(addr) | ||
19 | |||
20 | |||
21 | #endif /* !__ASSEMBLY__ */ | ||
22 | |||
23 | /* These need to be defined for compatibility although the sun3 doesn't use them */ | ||
24 | #define _PAGE_NOCACHE030 0x040 | ||
25 | #define _CACHEMASK040 (~0x060) | ||
26 | #define _PAGE_NOCACHE_S 0x040 | ||
27 | |||
28 | /* Page protection values within PTE. */ | ||
29 | #define SUN3_PAGE_VALID (0x80000000) | ||
30 | #define SUN3_PAGE_WRITEABLE (0x40000000) | ||
31 | #define SUN3_PAGE_SYSTEM (0x20000000) | ||
32 | #define SUN3_PAGE_NOCACHE (0x10000000) | ||
33 | #define SUN3_PAGE_ACCESSED (0x02000000) | ||
34 | #define SUN3_PAGE_MODIFIED (0x01000000) | ||
35 | |||
36 | |||
37 | /* Externally used page protection values. */ | ||
38 | #define _PAGE_PRESENT (SUN3_PAGE_VALID) | ||
39 | #define _PAGE_ACCESSED (SUN3_PAGE_ACCESSED) | ||
40 | |||
41 | #define PTE_FILE_MAX_BITS 28 | ||
42 | |||
43 | /* Compound page protection values. */ | ||
44 | //todo: work out which ones *should* have SUN3_PAGE_NOCACHE and fix... | ||
45 | // is it just PAGE_KERNEL and PAGE_SHARED? | ||
46 | #define PAGE_NONE __pgprot(SUN3_PAGE_VALID \ | ||
47 | | SUN3_PAGE_ACCESSED \ | ||
48 | | SUN3_PAGE_NOCACHE) | ||
49 | #define PAGE_SHARED __pgprot(SUN3_PAGE_VALID \ | ||
50 | | SUN3_PAGE_WRITEABLE \ | ||
51 | | SUN3_PAGE_ACCESSED \ | ||
52 | | SUN3_PAGE_NOCACHE) | ||
53 | #define PAGE_COPY __pgprot(SUN3_PAGE_VALID \ | ||
54 | | SUN3_PAGE_ACCESSED \ | ||
55 | | SUN3_PAGE_NOCACHE) | ||
56 | #define PAGE_READONLY __pgprot(SUN3_PAGE_VALID \ | ||
57 | | SUN3_PAGE_ACCESSED \ | ||
58 | | SUN3_PAGE_NOCACHE) | ||
59 | #define PAGE_KERNEL __pgprot(SUN3_PAGE_VALID \ | ||
60 | | SUN3_PAGE_WRITEABLE \ | ||
61 | | SUN3_PAGE_SYSTEM \ | ||
62 | | SUN3_PAGE_NOCACHE \ | ||
63 | | SUN3_PAGE_ACCESSED \ | ||
64 | | SUN3_PAGE_MODIFIED) | ||
65 | #define PAGE_INIT __pgprot(SUN3_PAGE_VALID \ | ||
66 | | SUN3_PAGE_WRITEABLE \ | ||
67 | | SUN3_PAGE_SYSTEM \ | ||
68 | | SUN3_PAGE_NOCACHE) | ||
69 | |||
70 | /* | ||
71 | * Page protections for initialising protection_map. The sun3 has only two | ||
72 | * protection settings, valid (implying read and execute) and writeable. These | ||
73 | * are as close as we can get... | ||
74 | */ | ||
75 | #define __P000 PAGE_NONE | ||
76 | #define __P001 PAGE_READONLY | ||
77 | #define __P010 PAGE_COPY | ||
78 | #define __P011 PAGE_COPY | ||
79 | #define __P100 PAGE_READONLY | ||
80 | #define __P101 PAGE_READONLY | ||
81 | #define __P110 PAGE_COPY | ||
82 | #define __P111 PAGE_COPY | ||
83 | |||
84 | #define __S000 PAGE_NONE | ||
85 | #define __S001 PAGE_READONLY | ||
86 | #define __S010 PAGE_SHARED | ||
87 | #define __S011 PAGE_SHARED | ||
88 | #define __S100 PAGE_READONLY | ||
89 | #define __S101 PAGE_READONLY | ||
90 | #define __S110 PAGE_SHARED | ||
91 | #define __S111 PAGE_SHARED | ||
92 | |||
93 | /* Use these fake page-protections on PMDs. */ | ||
94 | #define SUN3_PMD_VALID (0x00000001) | ||
95 | #define SUN3_PMD_MASK (0x0000003F) | ||
96 | #define SUN3_PMD_MAGIC (0x0000002B) | ||
97 | |||
98 | #ifndef __ASSEMBLY__ | ||
99 | |||
100 | /* | ||
101 | * Conversion functions: convert a page and protection to a page entry, | ||
102 | * and a page entry and page directory to the page they refer to. | ||
103 | */ | ||
104 | #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) | ||
105 | |||
106 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | ||
107 | { | ||
108 | pte_val(pte) = (pte_val(pte) & SUN3_PAGE_CHG_MASK) | pgprot_val(newprot); | ||
109 | return pte; | ||
110 | } | ||
111 | |||
112 | #define pmd_set(pmdp,ptep) do {} while (0) | ||
113 | |||
114 | static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp) | ||
115 | { | ||
116 | pgd_val(*pgdp) = virt_to_phys(pmdp); | ||
117 | } | ||
118 | |||
119 | #define __pte_page(pte) \ | ||
120 | ((unsigned long) __va ((pte_val (pte) & SUN3_PAGE_PGNUM_MASK) << PAGE_SHIFT)) | ||
121 | #define __pmd_page(pmd) \ | ||
122 | ((unsigned long) __va (pmd_val (pmd) & PAGE_MASK)) | ||
123 | |||
124 | static inline int pte_none (pte_t pte) { return !pte_val (pte); } | ||
125 | static inline int pte_present (pte_t pte) { return pte_val (pte) & SUN3_PAGE_VALID; } | ||
126 | static inline void pte_clear (struct mm_struct *mm, unsigned long addr, pte_t *ptep) | ||
127 | { | ||
128 | pte_val (*ptep) = 0; | ||
129 | } | ||
130 | |||
131 | #define pte_pfn(pte) (pte_val(pte) & SUN3_PAGE_PGNUM_MASK) | ||
132 | #define pfn_pte(pfn, pgprot) \ | ||
133 | ({ pte_t __pte; pte_val(__pte) = pfn | pgprot_val(pgprot); __pte; }) | ||
134 | |||
135 | #define pte_page(pte) (mem_map+((__pte_page(pte) - PAGE_OFFSET) >> PAGE_SHIFT)) | ||
136 | #define pmd_page(pmd) (mem_map+((__pmd_page(pmd) - PAGE_OFFSET) >> PAGE_SHIFT)) | ||
137 | |||
138 | |||
139 | static inline int pmd_none2 (pmd_t *pmd) { return !pmd_val (*pmd); } | ||
140 | #define pmd_none(pmd) pmd_none2(&(pmd)) | ||
141 | //static inline int pmd_bad (pmd_t pmd) { return (pmd_val (pmd) & SUN3_PMD_MASK) != SUN3_PMD_MAGIC; } | ||
142 | static inline int pmd_bad2 (pmd_t *pmd) { return 0; } | ||
143 | #define pmd_bad(pmd) pmd_bad2(&(pmd)) | ||
144 | static inline int pmd_present2 (pmd_t *pmd) { return pmd_val (*pmd) & SUN3_PMD_VALID; } | ||
145 | /* #define pmd_present(pmd) pmd_present2(&(pmd)) */ | ||
146 | #define pmd_present(pmd) (!pmd_none2(&(pmd))) | ||
147 | static inline void pmd_clear (pmd_t *pmdp) { pmd_val (*pmdp) = 0; } | ||
148 | |||
149 | static inline int pgd_none (pgd_t pgd) { return 0; } | ||
150 | static inline int pgd_bad (pgd_t pgd) { return 0; } | ||
151 | static inline int pgd_present (pgd_t pgd) { return 1; } | ||
152 | static inline void pgd_clear (pgd_t *pgdp) {} | ||
153 | |||
154 | |||
155 | #define pte_ERROR(e) \ | ||
156 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) | ||
157 | #define pmd_ERROR(e) \ | ||
158 | printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) | ||
159 | #define pgd_ERROR(e) \ | ||
160 | printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) | ||
161 | |||
162 | |||
163 | /* | ||
164 | * The following only work if pte_present() is true. | ||
165 | * Undefined behaviour if not... | ||
166 | * [we have the full set here even if they don't change from m68k] | ||
167 | */ | ||
168 | static inline int pte_read(pte_t pte) { return 1; } | ||
169 | static inline int pte_write(pte_t pte) { return pte_val(pte) & SUN3_PAGE_WRITEABLE; } | ||
170 | static inline int pte_exec(pte_t pte) { return 1; } | ||
171 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & SUN3_PAGE_MODIFIED; } | ||
172 | static inline int pte_young(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; } | ||
173 | static inline int pte_file(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; } | ||
174 | |||
175 | static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_WRITEABLE; return pte; } | ||
176 | static inline pte_t pte_rdprotect(pte_t pte) { return pte; } | ||
177 | static inline pte_t pte_exprotect(pte_t pte) { return pte; } | ||
178 | static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_MODIFIED; return pte; } | ||
179 | static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_ACCESSED; return pte; } | ||
180 | static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= SUN3_PAGE_WRITEABLE; return pte; } | ||
181 | static inline pte_t pte_mkread(pte_t pte) { return pte; } | ||
182 | static inline pte_t pte_mkexec(pte_t pte) { return pte; } | ||
183 | static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= SUN3_PAGE_MODIFIED; return pte; } | ||
184 | static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= SUN3_PAGE_ACCESSED; return pte; } | ||
185 | static inline pte_t pte_mknocache(pte_t pte) { pte_val(pte) |= SUN3_PAGE_NOCACHE; return pte; } | ||
186 | // use this version when caches work... | ||
187 | //static inline pte_t pte_mkcache(pte_t pte) { pte_val(pte) &= SUN3_PAGE_NOCACHE; return pte; } | ||
188 | // until then, use: | ||
189 | static inline pte_t pte_mkcache(pte_t pte) { return pte; } | ||
190 | |||
191 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | ||
192 | extern pgd_t kernel_pg_dir[PTRS_PER_PGD]; | ||
193 | |||
194 | /* Find an entry in a pagetable directory. */ | ||
195 | #define pgd_index(address) ((address) >> PGDIR_SHIFT) | ||
196 | |||
197 | #define pgd_offset(mm, address) \ | ||
198 | ((mm)->pgd + pgd_index(address)) | ||
199 | |||
200 | /* Find an entry in a kernel pagetable directory. */ | ||
201 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) | ||
202 | |||
203 | /* Find an entry in the second-level pagetable. */ | ||
204 | static inline pmd_t *pmd_offset (pgd_t *pgd, unsigned long address) | ||
205 | { | ||
206 | return (pmd_t *) pgd; | ||
207 | } | ||
208 | |||
209 | static inline unsigned long pte_to_pgoff(pte_t pte) | ||
210 | { | ||
211 | return pte.pte & SUN3_PAGE_PGNUM_MASK; | ||
212 | } | ||
213 | |||
214 | static inline pte_t pgoff_to_pte(inline unsigned off) | ||
215 | { | ||
216 | pte_t pte = { off + SUN3_PAGE_ACCESSED }; | ||
217 | return pte; | ||
218 | } | ||
219 | |||
220 | |||
221 | /* Find an entry in the third-level pagetable. */ | ||
222 | #define pte_index(address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) | ||
223 | #define pte_offset_kernel(pmd, address) ((pte_t *) __pmd_page(*pmd) + pte_index(address)) | ||
224 | /* FIXME: should we bother with kmap() here? */ | ||
225 | #define pte_offset_map(pmd, address) ((pte_t *)kmap(pmd_page(*pmd)) + pte_index(address)) | ||
226 | #define pte_offset_map_nested(pmd, address) pte_offset_map(pmd, address) | ||
227 | #define pte_unmap(pte) kunmap(pte) | ||
228 | #define pte_unmap_nested(pte) kunmap(pte) | ||
229 | |||
230 | /* Macros to (de)construct the fake PTEs representing swap pages. */ | ||
231 | #define __swp_type(x) ((x).val & 0x7F) | ||
232 | #define __swp_offset(x) (((x).val) >> 7) | ||
233 | #define __swp_entry(type,offset) ((swp_entry_t) { ((type) | ((offset) << 7)) }) | ||
234 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) | ||
235 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | ||
236 | |||
237 | #endif /* !__ASSEMBLY__ */ | ||
238 | #endif /* !_SUN3_PGTABLE_H */ | ||
diff --git a/include/asm-m68k/sun3ints.h b/include/asm-m68k/sun3ints.h new file mode 100644 index 000000000000..fd838eb14213 --- /dev/null +++ b/include/asm-m68k/sun3ints.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * sun3ints.h -- Linux/Sun3 interrupt handling code definitions | ||
3 | * | ||
4 | * Erik Verbruggen (erik@bigmama.xtdnet.nl) | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file COPYING in the main directory of this archive for | ||
8 | * more details. | ||
9 | */ | ||
10 | |||
11 | #ifndef SUN3INTS_H | ||
12 | #define SUN3INTS_H | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/sched.h> | ||
17 | #include <linux/kernel_stat.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | #include <linux/seq_file.h> | ||
20 | #include <asm/segment.h> | ||
21 | #include <asm/intersil.h> | ||
22 | #include <asm/oplib.h> | ||
23 | |||
24 | #define SUN3_INT_VECS 192 | ||
25 | |||
26 | void sun3_enable_irq(unsigned int irq); | ||
27 | void sun3_disable_irq(unsigned int irq); | ||
28 | int sun3_request_irq(unsigned int irq, | ||
29 | irqreturn_t (*handler)(int, void *, struct pt_regs *), | ||
30 | unsigned long flags, const char *devname, void *dev_id | ||
31 | ); | ||
32 | extern void sun3_init_IRQ (void); | ||
33 | extern irqreturn_t (*sun3_default_handler[]) (int, void *, struct pt_regs *); | ||
34 | extern irqreturn_t (*sun3_inthandler[]) (int, void *, struct pt_regs *); | ||
35 | extern void sun3_free_irq (unsigned int irq, void *dev_id); | ||
36 | extern void sun3_enable_interrupts (void); | ||
37 | extern void sun3_disable_interrupts (void); | ||
38 | extern int show_sun3_interrupts(struct seq_file *, void *); | ||
39 | extern irqreturn_t sun3_process_int(int, struct pt_regs *); | ||
40 | extern volatile unsigned char* sun3_intreg; | ||
41 | |||
42 | /* master list of VME vectors -- don't fuck with this */ | ||
43 | #define SUN3_VEC_FLOPPY 0x40 | ||
44 | #define SUN3_VEC_VMESCSI0 0x40 | ||
45 | #define SUN3_VEC_VMESCSI1 0x41 | ||
46 | #define SUN3_VEC_CG 0xA8 | ||
47 | |||
48 | |||
49 | #endif /* SUN3INTS_H */ | ||
diff --git a/include/asm-m68k/sun3mmu.h b/include/asm-m68k/sun3mmu.h new file mode 100644 index 000000000000..6c8c17d047a1 --- /dev/null +++ b/include/asm-m68k/sun3mmu.h | |||
@@ -0,0 +1,170 @@ | |||
1 | /* | ||
2 | * Definitions for Sun3 custom MMU. | ||
3 | */ | ||
4 | #ifndef __SUN3_MMU_H__ | ||
5 | #define __SUN3_MMU_H__ | ||
6 | |||
7 | #include <asm/movs.h> | ||
8 | #include <asm/sun3-head.h> | ||
9 | |||
10 | /* MMU characteristics. */ | ||
11 | #define SUN3_SEGMAPS_PER_CONTEXT 2048 | ||
12 | #define SUN3_PMEGS_NUM 256 | ||
13 | #define SUN3_CONTEXTS_NUM 8 | ||
14 | |||
15 | #define SUN3_PMEG_SIZE_BITS 17 | ||
16 | #define SUN3_PMEG_SIZE (1 << SUN3_PMEG_SIZE_BITS) | ||
17 | #define SUN3_PMEG_MASK (SUN3_PMEG_SIZE - 1) | ||
18 | |||
19 | #define SUN3_PTE_SIZE_BITS 13 | ||
20 | #define SUN3_PTE_SIZE (1 << SUN3_PTE_SIZE_BITS) | ||
21 | #define SUN3_PTE_MASK (SUN3_PTE_SIZE - 1) | ||
22 | |||
23 | #define SUN3_CONTROL_MASK (0x0FFFFFFC) | ||
24 | #define SUN3_INVALID_PMEG 255 | ||
25 | #define SUN3_INVALID_CONTEXT 255 | ||
26 | |||
27 | #define AC_IDPROM 0x00000000 /* 34 ID PROM, R/O, byte, 32 bytes */ | ||
28 | #define AC_PAGEMAP 0x10000000 /* 3 Pagemap R/W, long */ | ||
29 | #define AC_SEGMAP 0x20000000 /* 3 Segment map, byte */ | ||
30 | #define AC_CONTEXT 0x30000000 /* 34c current mmu-context */ | ||
31 | #define AC_SENABLE 0x40000000 /* 34c system dvma/cache/reset enable reg*/ | ||
32 | #define AC_UDVMA_ENB 0x50000000 /* 34 Not used on Sun boards, byte */ | ||
33 | #define AC_BUS_ERROR 0x60000000 /* 34 Cleared on read, byte. */ | ||
34 | #define AC_SYNC_ERR 0x60000000 /* c fault type */ | ||
35 | #define AC_SYNC_VA 0x60000004 /* c fault virtual address */ | ||
36 | #define AC_ASYNC_ERR 0x60000008 /* c asynchronous fault type */ | ||
37 | #define AC_ASYNC_VA 0x6000000c /* c async fault virtual address */ | ||
38 | #define AC_LEDS 0x70000000 /* 34 Zero turns on LEDs, byte */ | ||
39 | #define AC_CACHETAGS 0x80000000 /* 34c direct access to the VAC tags */ | ||
40 | #define AC_CACHEDDATA 0x90000000 /* 3 c direct access to the VAC data */ | ||
41 | #define AC_UDVMA_MAP 0xD0000000 /* 4 Not used on Sun boards, byte */ | ||
42 | #define AC_VME_VECTOR 0xE0000000 /* 4 For non-Autovector VME, byte */ | ||
43 | #define AC_BOOT_SCC 0xF0000000 /* 34 bypass to access Zilog 8530. byte.*/ | ||
44 | |||
45 | #define SUN3_PAGE_CHG_MASK (SUN3_PAGE_PGNUM_MASK \ | ||
46 | | SUN3_PAGE_ACCESSED | SUN3_PAGE_MODIFIED) | ||
47 | |||
48 | /* Bus access type within PTE. */ | ||
49 | #define SUN3_PAGE_TYPE_MASK (0x0c000000) | ||
50 | #define SUN3_PAGE_TYPE_MEMORY (0x00000000) | ||
51 | #define SUN3_PAGE_TYPE_IO (0x04000000) | ||
52 | #define SUN3_PAGE_TYPE_VME16 (0x08000000) | ||
53 | #define SUN3_PAGE_TYPE_VME32 (0x0c000000) | ||
54 | |||
55 | /* Mask for page number within PTE. */ | ||
56 | #define SUN3_PAGE_PGNUM_MASK (0x0007FFFF) | ||
57 | |||
58 | /* Bits within bus-error register. */ | ||
59 | #define SUN3_BUSERR_WATCHDOG (0x01) | ||
60 | #define SUN3_BUSERR_unused (0x02) | ||
61 | #define SUN3_BUSERR_FPAENERR (0x04) | ||
62 | #define SUN3_BUSERR_FPABERR (0x08) | ||
63 | #define SUN3_BUSERR_VMEBERR (0x10) | ||
64 | #define SUN3_BUSERR_TIMEOUT (0x20) | ||
65 | #define SUN3_BUSERR_PROTERR (0x40) | ||
66 | #define SUN3_BUSERR_INVALID (0x80) | ||
67 | |||
68 | #ifndef __ASSEMBLY__ | ||
69 | |||
70 | /* Read bus error status register (implicitly clearing it). */ | ||
71 | static inline unsigned char sun3_get_buserr(void) | ||
72 | { | ||
73 | unsigned char sfc, c; | ||
74 | |||
75 | GET_SFC (sfc); | ||
76 | SET_SFC (FC_CONTROL); | ||
77 | GET_CONTROL_BYTE (AC_BUS_ERROR, c); | ||
78 | SET_SFC (sfc); | ||
79 | |||
80 | return c; | ||
81 | } | ||
82 | |||
83 | /* Read segmap from hardware MMU. */ | ||
84 | static inline unsigned long sun3_get_segmap(unsigned long addr) | ||
85 | { | ||
86 | register unsigned long entry; | ||
87 | unsigned char c, sfc; | ||
88 | |||
89 | GET_SFC (sfc); | ||
90 | SET_SFC (FC_CONTROL); | ||
91 | GET_CONTROL_BYTE (AC_SEGMAP | (addr & SUN3_CONTROL_MASK), c); | ||
92 | SET_SFC (sfc); | ||
93 | entry = c; | ||
94 | |||
95 | return entry; | ||
96 | } | ||
97 | |||
98 | /* Write segmap to hardware MMU. */ | ||
99 | static inline void sun3_put_segmap(unsigned long addr, unsigned long entry) | ||
100 | { | ||
101 | unsigned char sfc; | ||
102 | |||
103 | GET_DFC (sfc); | ||
104 | SET_DFC (FC_CONTROL); | ||
105 | SET_CONTROL_BYTE (AC_SEGMAP | (addr & SUN3_CONTROL_MASK), entry); | ||
106 | SET_DFC (sfc); | ||
107 | |||
108 | return; | ||
109 | } | ||
110 | |||
111 | /* Read PTE from hardware MMU. */ | ||
112 | static inline unsigned long sun3_get_pte(unsigned long addr) | ||
113 | { | ||
114 | register unsigned long entry; | ||
115 | unsigned char sfc; | ||
116 | |||
117 | GET_SFC (sfc); | ||
118 | SET_SFC (FC_CONTROL); | ||
119 | GET_CONTROL_WORD (AC_PAGEMAP | (addr & SUN3_CONTROL_MASK), entry); | ||
120 | SET_SFC (sfc); | ||
121 | |||
122 | return entry; | ||
123 | } | ||
124 | |||
125 | /* Write PTE to hardware MMU. */ | ||
126 | static inline void sun3_put_pte(unsigned long addr, unsigned long entry) | ||
127 | { | ||
128 | unsigned char sfc; | ||
129 | |||
130 | GET_DFC (sfc); | ||
131 | SET_DFC (FC_CONTROL); | ||
132 | SET_CONTROL_WORD (AC_PAGEMAP | (addr & SUN3_CONTROL_MASK), entry); | ||
133 | SET_DFC (sfc); | ||
134 | |||
135 | return; | ||
136 | } | ||
137 | |||
138 | /* get current context */ | ||
139 | static inline unsigned char sun3_get_context(void) | ||
140 | { | ||
141 | unsigned char sfc, c; | ||
142 | |||
143 | GET_SFC(sfc); | ||
144 | SET_SFC(FC_CONTROL); | ||
145 | GET_CONTROL_BYTE(AC_CONTEXT, c); | ||
146 | SET_SFC(sfc); | ||
147 | |||
148 | return c; | ||
149 | } | ||
150 | |||
151 | /* set alternate context */ | ||
152 | static inline void sun3_put_context(unsigned char c) | ||
153 | { | ||
154 | unsigned char dfc; | ||
155 | GET_DFC(dfc); | ||
156 | SET_DFC(FC_CONTROL); | ||
157 | SET_CONTROL_BYTE(AC_CONTEXT, c); | ||
158 | SET_DFC(dfc); | ||
159 | |||
160 | return; | ||
161 | } | ||
162 | |||
163 | extern void *sun3_ioremap(unsigned long phys, unsigned long size, | ||
164 | unsigned long type); | ||
165 | |||
166 | extern int sun3_map_test(unsigned long addr, char *val); | ||
167 | |||
168 | #endif /* !__ASSEMBLY__ */ | ||
169 | |||
170 | #endif /* !__SUN3_MMU_H__ */ | ||
diff --git a/include/asm-m68k/sun3x.h b/include/asm-m68k/sun3x.h new file mode 100644 index 000000000000..f5691a1ed7cc --- /dev/null +++ b/include/asm-m68k/sun3x.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef SUN3X_H | ||
2 | #define SUN3X_H | ||
3 | |||
4 | /* hardware addresses */ | ||
5 | #define SUN3X_IOMMU 0x60000000 | ||
6 | #define SUN3X_ENAREG 0x61000000 | ||
7 | #define SUN3X_INTREG 0x61001400 | ||
8 | #define SUN3X_DIAGREG 0x61001800 | ||
9 | #define SUN3X_ZS1 0x62000000 | ||
10 | #define SUN3X_ZS2 0x62002000 | ||
11 | #define SUN3X_LANCE 0x65002000 | ||
12 | #define SUN3X_EEPROM 0x64000000 | ||
13 | #define SUN3X_IDPROM 0x640007d8 | ||
14 | #define SUN3X_VIDEO_BASE 0x50000000 | ||
15 | #define SUN3X_VIDEO_P4ID 0x50300000 | ||
16 | #define SUN3X_ESP_BASE 0x66000000 | ||
17 | #define SUN3X_ESP_DMA 0x66001000 | ||
18 | #define SUN3X_FDC 0x6e000000 | ||
19 | #define SUN3X_FDC_FCR 0x6e000400 | ||
20 | #define SUN3X_FDC_FVR 0x6e000800 | ||
21 | |||
22 | /* some NVRAM addresses */ | ||
23 | #define SUN3X_EEPROM_CONS (SUN3X_EEPROM + 0x1f) | ||
24 | #define SUN3X_EEPROM_PORTA (SUN3X_EEPROM + 0x58) | ||
25 | #define SUN3X_EEPROM_PORTB (SUN3X_EEPROM + 0x60) | ||
26 | |||
27 | #endif | ||
diff --git a/include/asm-m68k/sun3xflop.h b/include/asm-m68k/sun3xflop.h new file mode 100644 index 000000000000..1ed3b787ee05 --- /dev/null +++ b/include/asm-m68k/sun3xflop.h | |||
@@ -0,0 +1,265 @@ | |||
1 | /* sun3xflop.h: Sun3/80 specific parts of the floppy driver. | ||
2 | * | ||
3 | * Derived partially from asm-sparc/floppy.h, which is: | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | * | ||
6 | * Sun3x version 2/4/2000 Sam Creasey (sammy@sammy.net) | ||
7 | */ | ||
8 | |||
9 | #ifndef __ASM_SUN3X_FLOPPY_H | ||
10 | #define __ASM_SUN3X_FLOPPY_H | ||
11 | |||
12 | #include <asm/page.h> | ||
13 | #include <asm/pgtable.h> | ||
14 | #include <asm/system.h> | ||
15 | #include <asm/irq.h> | ||
16 | #include <asm/sun3x.h> | ||
17 | |||
18 | /* default interrupt vector */ | ||
19 | #define SUN3X_FDC_IRQ 0x40 | ||
20 | |||
21 | /* some constants */ | ||
22 | #define FCR_TC 0x1 | ||
23 | #define FCR_EJECT 0x2 | ||
24 | #define FCR_MTRON 0x4 | ||
25 | #define FCR_DSEL1 0x8 | ||
26 | #define FCR_DSEL0 0x10 | ||
27 | |||
28 | /* We don't need no stinkin' I/O port allocation crap. */ | ||
29 | #undef release_region | ||
30 | #undef check_region | ||
31 | #undef request_region | ||
32 | #define release_region(X, Y) do { } while(0) | ||
33 | #define check_region(X, Y) (0) | ||
34 | #define request_region(X, Y, Z) (1) | ||
35 | |||
36 | struct sun3xflop_private { | ||
37 | volatile unsigned char *status_r; | ||
38 | volatile unsigned char *data_r; | ||
39 | volatile unsigned char *fcr_r; | ||
40 | volatile unsigned char *fvr_r; | ||
41 | unsigned char fcr; | ||
42 | } sun3x_fdc; | ||
43 | |||
44 | /* Super paranoid... */ | ||
45 | #undef HAVE_DISABLE_HLT | ||
46 | |||
47 | /* Routines unique to each controller type on a Sun. */ | ||
48 | static unsigned char sun3x_82072_fd_inb(int port) | ||
49 | { | ||
50 | static int once = 0; | ||
51 | // udelay(5); | ||
52 | switch(port & 7) { | ||
53 | default: | ||
54 | printk("floppy: Asked to read unknown port %d\n", port); | ||
55 | panic("floppy: Port bolixed."); | ||
56 | case 4: /* FD_STATUS */ | ||
57 | return (*sun3x_fdc.status_r) & ~STATUS_DMA; | ||
58 | case 5: /* FD_DATA */ | ||
59 | return (*sun3x_fdc.data_r); | ||
60 | case 7: /* FD_DIR */ | ||
61 | /* ugly hack, I can't find a way to actually detect the disk */ | ||
62 | if(!once) { | ||
63 | once = 1; | ||
64 | return 0x80; | ||
65 | } | ||
66 | return 0; | ||
67 | }; | ||
68 | panic("sun_82072_fd_inb: How did I get here?"); | ||
69 | } | ||
70 | |||
71 | static void sun3x_82072_fd_outb(unsigned char value, int port) | ||
72 | { | ||
73 | // udelay(5); | ||
74 | switch(port & 7) { | ||
75 | default: | ||
76 | printk("floppy: Asked to write to unknown port %d\n", port); | ||
77 | panic("floppy: Port bolixed."); | ||
78 | case 2: /* FD_DOR */ | ||
79 | /* Oh geese, 82072 on the Sun has no DOR register, | ||
80 | * so we make do with taunting the FCR. | ||
81 | * | ||
82 | * ASSUMPTIONS: There will only ever be one floppy | ||
83 | * drive attached to a Sun controller | ||
84 | * and it will be at drive zero. | ||
85 | */ | ||
86 | |||
87 | { | ||
88 | unsigned char fcr = sun3x_fdc.fcr; | ||
89 | |||
90 | if(value & 0x10) { | ||
91 | fcr |= (FCR_DSEL0 | FCR_MTRON); | ||
92 | } else | ||
93 | fcr &= ~(FCR_DSEL0 | FCR_MTRON); | ||
94 | |||
95 | |||
96 | if(fcr != sun3x_fdc.fcr) { | ||
97 | *(sun3x_fdc.fcr_r) = fcr; | ||
98 | sun3x_fdc.fcr = fcr; | ||
99 | } | ||
100 | } | ||
101 | break; | ||
102 | case 5: /* FD_DATA */ | ||
103 | *(sun3x_fdc.data_r) = value; | ||
104 | break; | ||
105 | case 7: /* FD_DCR */ | ||
106 | *(sun3x_fdc.status_r) = value; | ||
107 | break; | ||
108 | case 4: /* FD_STATUS */ | ||
109 | *(sun3x_fdc.status_r) = value; | ||
110 | break; | ||
111 | }; | ||
112 | return; | ||
113 | } | ||
114 | |||
115 | |||
116 | asmlinkage irqreturn_t sun3xflop_hardint(int irq, void *dev_id, | ||
117 | struct pt_regs * regs) | ||
118 | { | ||
119 | register unsigned char st; | ||
120 | |||
121 | #undef TRACE_FLPY_INT | ||
122 | #define NO_FLOPPY_ASSEMBLER | ||
123 | |||
124 | #ifdef TRACE_FLPY_INT | ||
125 | static int calls=0; | ||
126 | static int bytes=0; | ||
127 | static int dma_wait=0; | ||
128 | #endif | ||
129 | if(!doing_pdma) { | ||
130 | floppy_interrupt(irq, dev_id, regs); | ||
131 | return IRQ_HANDLED; | ||
132 | } | ||
133 | |||
134 | // printk("doing pdma\n");// st %x\n", sun_fdc->status_82072); | ||
135 | |||
136 | #ifdef TRACE_FLPY_INT | ||
137 | if(!calls) | ||
138 | bytes = virtual_dma_count; | ||
139 | #endif | ||
140 | |||
141 | { | ||
142 | register int lcount; | ||
143 | register char *lptr; | ||
144 | |||
145 | for(lcount=virtual_dma_count, lptr=virtual_dma_addr; | ||
146 | lcount; lcount--, lptr++) { | ||
147 | /* st=fd_inb(virtual_dma_port+4) & 0x80 ; */ | ||
148 | st = *(sun3x_fdc.status_r); | ||
149 | /* if(st != 0xa0) */ | ||
150 | /* break; */ | ||
151 | |||
152 | if((st & 0x80) == 0) { | ||
153 | virtual_dma_count = lcount; | ||
154 | virtual_dma_addr = lptr; | ||
155 | return IRQ_HANDLED; | ||
156 | } | ||
157 | |||
158 | if((st & 0x20) == 0) | ||
159 | break; | ||
160 | |||
161 | if(virtual_dma_mode) | ||
162 | /* fd_outb(*lptr, virtual_dma_port+5); */ | ||
163 | *(sun3x_fdc.data_r) = *lptr; | ||
164 | else | ||
165 | /* *lptr = fd_inb(virtual_dma_port+5); */ | ||
166 | *lptr = *(sun3x_fdc.data_r); | ||
167 | } | ||
168 | |||
169 | virtual_dma_count = lcount; | ||
170 | virtual_dma_addr = lptr; | ||
171 | /* st = fd_inb(virtual_dma_port+4); */ | ||
172 | st = *(sun3x_fdc.status_r); | ||
173 | } | ||
174 | |||
175 | #ifdef TRACE_FLPY_INT | ||
176 | calls++; | ||
177 | #endif | ||
178 | // printk("st=%02x\n", st); | ||
179 | if(st == 0x20) | ||
180 | return IRQ_HANDLED; | ||
181 | if(!(st & 0x20)) { | ||
182 | virtual_dma_residue += virtual_dma_count; | ||
183 | virtual_dma_count=0; | ||
184 | doing_pdma = 0; | ||
185 | |||
186 | #ifdef TRACE_FLPY_INT | ||
187 | printk("count=%x, residue=%x calls=%d bytes=%x dma_wait=%d\n", | ||
188 | virtual_dma_count, virtual_dma_residue, calls, bytes, | ||
189 | dma_wait); | ||
190 | calls = 0; | ||
191 | dma_wait=0; | ||
192 | #endif | ||
193 | |||
194 | floppy_interrupt(irq, dev_id, regs); | ||
195 | return IRQ_HANDLED; | ||
196 | } | ||
197 | |||
198 | |||
199 | #ifdef TRACE_FLPY_INT | ||
200 | if(!virtual_dma_count) | ||
201 | dma_wait++; | ||
202 | #endif | ||
203 | return IRQ_HANDLED; | ||
204 | } | ||
205 | |||
206 | static int sun3xflop_request_irq(void) | ||
207 | { | ||
208 | static int once = 0; | ||
209 | int error; | ||
210 | |||
211 | if(!once) { | ||
212 | once = 1; | ||
213 | error = request_irq(FLOPPY_IRQ, sun3xflop_hardint, SA_INTERRUPT, "floppy", 0); | ||
214 | return ((error == 0) ? 0 : -1); | ||
215 | } else return 0; | ||
216 | } | ||
217 | |||
218 | static void __init floppy_set_flags(int *ints,int param, int param2); | ||
219 | |||
220 | static int sun3xflop_init(void) | ||
221 | { | ||
222 | if(FLOPPY_IRQ < 0x40) | ||
223 | FLOPPY_IRQ = SUN3X_FDC_IRQ; | ||
224 | |||
225 | sun3x_fdc.status_r = (volatile unsigned char *)SUN3X_FDC; | ||
226 | sun3x_fdc.data_r = (volatile unsigned char *)(SUN3X_FDC+1); | ||
227 | sun3x_fdc.fcr_r = (volatile unsigned char *)SUN3X_FDC_FCR; | ||
228 | sun3x_fdc.fvr_r = (volatile unsigned char *)SUN3X_FDC_FVR; | ||
229 | sun3x_fdc.fcr = 0; | ||
230 | |||
231 | /* Last minute sanity check... */ | ||
232 | if(*sun3x_fdc.status_r == 0xff) { | ||
233 | return -1; | ||
234 | } | ||
235 | |||
236 | *sun3x_fdc.fvr_r = FLOPPY_IRQ; | ||
237 | |||
238 | *sun3x_fdc.fcr_r = FCR_TC; | ||
239 | udelay(10); | ||
240 | *sun3x_fdc.fcr_r = 0; | ||
241 | |||
242 | /* Success... */ | ||
243 | floppy_set_flags(0, 1, FD_BROKEN_DCL); // I don't know how to detect this. | ||
244 | allowed_drive_mask = 0x01; | ||
245 | return (int) SUN3X_FDC; | ||
246 | } | ||
247 | |||
248 | /* I'm not precisely sure this eject routine works */ | ||
249 | static int sun3x_eject(void) | ||
250 | { | ||
251 | if(MACH_IS_SUN3X) { | ||
252 | |||
253 | sun3x_fdc.fcr |= (FCR_DSEL0 | FCR_EJECT); | ||
254 | *(sun3x_fdc.fcr_r) = sun3x_fdc.fcr; | ||
255 | udelay(10); | ||
256 | sun3x_fdc.fcr &= ~(FCR_DSEL0 | FCR_EJECT); | ||
257 | *(sun3x_fdc.fcr_r) = sun3x_fdc.fcr; | ||
258 | } | ||
259 | |||
260 | return 0; | ||
261 | } | ||
262 | |||
263 | #define fd_eject(drive) sun3x_eject() | ||
264 | |||
265 | #endif /* !(__ASM_SUN3X_FLOPPY_H) */ | ||
diff --git a/include/asm-m68k/sun3xprom.h b/include/asm-m68k/sun3xprom.h new file mode 100644 index 000000000000..6735efcf5f6d --- /dev/null +++ b/include/asm-m68k/sun3xprom.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* Useful PROM locations */ | ||
2 | |||
3 | #ifndef SUN3X_PROM_H | ||
4 | #define SUN3X_PROM_H | ||
5 | |||
6 | extern void (*sun3x_putchar)(int); | ||
7 | extern int (*sun3x_getchar)(void); | ||
8 | extern int (*sun3x_mayget)(void); | ||
9 | extern int (*sun3x_mayput)(int); | ||
10 | |||
11 | void sun3x_reboot(void); | ||
12 | void sun3x_abort(void); | ||
13 | void sun3x_prom_init(void); | ||
14 | unsigned long sun3x_prom_ptov(unsigned long pa, unsigned long size); | ||
15 | |||
16 | /* interesting hardware locations */ | ||
17 | #define SUN3X_IOMMU 0x60000000 | ||
18 | #define SUN3X_ENAREG 0x61000000 | ||
19 | #define SUN3X_INTREG 0x61001400 | ||
20 | #define SUN3X_DIAGREG 0x61001800 | ||
21 | #define SUN3X_ZS1 0x62000000 | ||
22 | #define SUN3X_ZS2 0x62002000 | ||
23 | #define SUN3X_LANCE 0x65002000 | ||
24 | #define SUN3X_EEPROM 0x64000000 | ||
25 | #define SUN3X_IDPROM 0x640007d8 | ||
26 | #define SUN3X_VIDEO_BASE 0x50400000 | ||
27 | #define SUN3X_VIDEO_REGS 0x50300000 | ||
28 | |||
29 | /* vector table */ | ||
30 | #define SUN3X_PROM_BASE 0xfefe0000 | ||
31 | #define SUN3X_P_GETCHAR (SUN3X_PROM_BASE + 20) | ||
32 | #define SUN3X_P_PUTCHAR (SUN3X_PROM_BASE + 24) | ||
33 | #define SUN3X_P_MAYGET (SUN3X_PROM_BASE + 28) | ||
34 | #define SUN3X_P_MAYPUT (SUN3X_PROM_BASE + 32) | ||
35 | #define SUN3X_P_REBOOT (SUN3X_PROM_BASE + 96) | ||
36 | #define SUN3X_P_SETLEDS (SUN3X_PROM_BASE + 144) | ||
37 | #define SUN3X_P_ABORT (SUN3X_PROM_BASE + 152) | ||
38 | |||
39 | /* mapped area */ | ||
40 | #define SUN3X_MAP_START 0xfee00000 | ||
41 | #define SUN3X_MAP_END 0xff000000 | ||
42 | |||
43 | #endif | ||
diff --git a/include/asm-m68k/suspend.h b/include/asm-m68k/suspend.h new file mode 100644 index 000000000000..57b3ddb4d269 --- /dev/null +++ b/include/asm-m68k/suspend.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _M68K_SUSPEND_H | ||
2 | #define _M68K_SUSPEND_H | ||
3 | |||
4 | /* Dummy include. */ | ||
5 | |||
6 | #endif /* _M68K_SUSPEND_H */ | ||
diff --git a/include/asm-m68k/swim_iop.h b/include/asm-m68k/swim_iop.h new file mode 100644 index 000000000000..f29b67876b01 --- /dev/null +++ b/include/asm-m68k/swim_iop.h | |||
@@ -0,0 +1,221 @@ | |||
1 | /* | ||
2 | * SWIM access through the IOP | ||
3 | * Written by Joshua M. Thompson | ||
4 | */ | ||
5 | |||
6 | /* IOP number and channel number for the SWIM */ | ||
7 | |||
8 | #define SWIM_IOP IOP_NUM_ISM | ||
9 | #define SWIM_CHAN 1 | ||
10 | |||
11 | /* Command code: */ | ||
12 | |||
13 | #define CMD_INIT 0x01 /* Initialize */ | ||
14 | #define CMD_SHUTDOWN 0x02 /* Shutdown */ | ||
15 | #define CMD_START_POLL 0x03 /* Start insert/eject polling */ | ||
16 | #define CMD_STOP_POLL 0x04 /* Stop insert/eject polling */ | ||
17 | #define CMD_SETHFSTAG 0x05 /* Set HFS tag buffer address */ | ||
18 | #define CMD_STATUS 0x06 /* Status */ | ||
19 | #define CMD_EJECT 0x07 /* Eject */ | ||
20 | #define CMD_FORMAT 0x08 /* Format */ | ||
21 | #define CMD_FORMAT_VERIFY 0x09 /* Format and Verify */ | ||
22 | #define CMD_WRITE 0x0A /* Write */ | ||
23 | #define CMD_READ 0x0B /* Read */ | ||
24 | #define CMD_READ_VERIFY 0x0C /* Read and Verify */ | ||
25 | #define CMD_CACHE_CTRL 0x0D /* Cache control */ | ||
26 | #define CMD_TAGBUFF_CTRL 0x0E /* Tag buffer control */ | ||
27 | #define CMD_GET_ICON 0x0F /* Get Icon */ | ||
28 | |||
29 | /* Drive types: */ | ||
30 | |||
31 | /* note: apple sez DRV_FDHD is 4, but I get back a type */ | ||
32 | /* of 5 when I do a drive status check on my FDHD */ | ||
33 | |||
34 | #define DRV_NONE 0 /* No drive */ | ||
35 | #define DRV_UNKNOWN 1 /* Unspecified drive */ | ||
36 | #define DRV_400K 2 /* 400K */ | ||
37 | #define DRV_800K 3 /* 400K/800K */ | ||
38 | #define DRV_FDHD 5 /* 400K/800K/720K/1440K */ | ||
39 | #define DRV_HD20 7 /* Apple HD20 */ | ||
40 | |||
41 | /* Format types: */ | ||
42 | |||
43 | #define FMT_HD20 0x0001 /* Apple HD20 */ | ||
44 | #define FMT_400K 0x0002 /* 400K (GCR) */ | ||
45 | #define FMT_800K 0x0004 /* 800K (GCR) */ | ||
46 | #define FMT_720K 0x0008 /* 720K (MFM) */ | ||
47 | #define FMT_1440K 0x0010 /* 1.44M (MFM) */ | ||
48 | |||
49 | #define FMD_KIND_400K 1 | ||
50 | #define FMD_KIND_800K 2 | ||
51 | #define FMD_KIND_720K 3 | ||
52 | #define FMD_KIND_1440K 1 | ||
53 | |||
54 | /* Icon Flags: */ | ||
55 | |||
56 | #define ICON_MEDIA 0x01 /* Have IOP supply media icon */ | ||
57 | #define ICON_DRIVE 0x01 /* Have IOP supply drive icon */ | ||
58 | |||
59 | /* Error codes: */ | ||
60 | |||
61 | #define gcrOnMFMErr -400 /* GCR (400/800K) on HD media */ | ||
62 | #define verErr -84 /* verify failed */ | ||
63 | #define fmt2Err -83 /* can't get enough sync during format */ | ||
64 | #define fmt1Err -82 /* can't find sector 0 after track format */ | ||
65 | #define sectNFErr -81 /* can't find sector */ | ||
66 | #define seekErr -80 /* drive error during seek */ | ||
67 | #define spdAdjErr -79 /* can't set drive speed */ | ||
68 | #define twoSideErr -78 /* drive is single-sided */ | ||
69 | #define initIWMErr -77 /* error during initialization */ | ||
70 | #define tk0badErr -76 /* track zero is bad */ | ||
71 | #define cantStepErr -75 /* drive error during step */ | ||
72 | #define wrUnderrun -74 /* write underrun occurred */ | ||
73 | #define badDBtSlp -73 /* bad data bitslip marks */ | ||
74 | #define badDCksum -72 /* bad data checksum */ | ||
75 | #define noDtaMkErr -71 /* can't find data mark */ | ||
76 | #define badBtSlpErr -70 /* bad address bitslip marks */ | ||
77 | #define badCksmErr -69 /* bad address-mark checksum */ | ||
78 | #define dataVerErr -68 /* read-verify failed */ | ||
79 | #define noAdrMkErr -67 /* can't find an address mark */ | ||
80 | #define noNybErr -66 /* no nybbles? disk is probably degaussed */ | ||
81 | #define offLinErr -65 /* no disk in drive */ | ||
82 | #define noDriveErr -64 /* drive isn't connected */ | ||
83 | #define nsDrvErr -56 /* no such drive */ | ||
84 | #define paramErr -50 /* bad positioning information */ | ||
85 | #define wPrErr -44 /* write protected */ | ||
86 | #define openErr -23 /* already initialized */ | ||
87 | |||
88 | #ifndef __ASSEMBLY__ | ||
89 | |||
90 | struct swim_drvstatus { | ||
91 | __u16 curr_track; /* Current track number */ | ||
92 | __u8 write_prot; /* 0x80 if disk is write protected */ | ||
93 | __u8 disk_in_drive; /* 0x01 or 0x02 if a disk is in the drive */ | ||
94 | __u8 installed; /* 0x01 if drive installed, 0xFF if not */ | ||
95 | __u8 num_sides; /* 0x80 if two-sided format supported */ | ||
96 | __u8 two_sided; /* 0xff if two-sided format diskette */ | ||
97 | __u8 new_interface; /* 0x00 if old 400K drive, 0xFF if newer */ | ||
98 | __u16 errors; /* Disk error count */ | ||
99 | struct { /* 32 bits */ | ||
100 | __u16 reserved; | ||
101 | __u16 :4; | ||
102 | __u16 external:1; /* Drive is external */ | ||
103 | __u16 scsi:1; /* Drive is a SCSI drive */ | ||
104 | __u16 fixed:1; /* Drive has fixed media */ | ||
105 | __u16 secondary:1; /* Drive is secondary drive */ | ||
106 | __u8 type; /* Drive type */ | ||
107 | } info; | ||
108 | __u8 mfm_drive; /* 0xFF if this is an FDHD drive */ | ||
109 | __u8 mfm_disk; /* 0xFF if 720K/1440K (MFM) disk */ | ||
110 | __u8 mfm_format; /* 0x00 if 720K, 0xFF if 1440K */ | ||
111 | __u8 ctlr_type; /* 0x00 if IWM, 0xFF if SWIM */ | ||
112 | __u16 curr_format; /* Current format type */ | ||
113 | __u16 allowed_fmt; /* Allowed format types */ | ||
114 | __u32 num_blocks; /* Number of blocks on disk */ | ||
115 | __u8 icon_flags; /* Icon flags */ | ||
116 | __u8 unusued; | ||
117 | }; | ||
118 | |||
119 | /* Commands issued from the host to the IOP: */ | ||
120 | |||
121 | struct swimcmd_init { | ||
122 | __u8 code; /* CMD_INIT */ | ||
123 | __u8 unusued; | ||
124 | __u16 error; | ||
125 | __u8 drives[28]; /* drive type list */ | ||
126 | }; | ||
127 | |||
128 | struct swimcmd_startpoll { | ||
129 | __u8 code; /* CMD_START_POLL */ | ||
130 | __u8 unusued; | ||
131 | __u16 error; | ||
132 | }; | ||
133 | |||
134 | struct swimcmd_sethfstag { | ||
135 | __u8 code; /* CMD_SETHFSTAG */ | ||
136 | __u8 unusued; | ||
137 | __u16 error; | ||
138 | caddr_t tagbuf; /* HFS tag buffer address */ | ||
139 | }; | ||
140 | |||
141 | struct swimcmd_status { | ||
142 | __u8 code; /* CMD_STATUS */ | ||
143 | __u8 drive_num; | ||
144 | __u16 error; | ||
145 | struct swim_drvstatus status; | ||
146 | }; | ||
147 | |||
148 | struct swimcmd_eject { | ||
149 | __u8 code; /* CMD_EJECT */ | ||
150 | __u8 drive_num; | ||
151 | __u16 error; | ||
152 | struct swim_drvstatus status; | ||
153 | }; | ||
154 | |||
155 | struct swimcmd_format { | ||
156 | __u8 code; /* CMD_FORMAT */ | ||
157 | __u8 drive_num; | ||
158 | __u16 error; | ||
159 | union { | ||
160 | struct { | ||
161 | __u16 fmt; /* format kind */ | ||
162 | __u8 hdrbyte; /* fmt byte for hdr (0=default) */ | ||
163 | __u8 interleave; /* interleave (0 = default) */ | ||
164 | caddr_t databuf; /* sector data buff (0=default */ | ||
165 | caddr_t tagbuf; /* tag data buffer (0=default) */ | ||
166 | } f; | ||
167 | struct swim_drvstatus status; | ||
168 | } p; | ||
169 | }; | ||
170 | |||
171 | struct swimcmd_fmtverify { | ||
172 | __u8 code; /* CMD_FORMAT_VERIFY */ | ||
173 | __u8 drive_num; | ||
174 | __u16 error; | ||
175 | }; | ||
176 | |||
177 | struct swimcmd_rw { | ||
178 | __u8 code; /* CMD_READ, CMD_WRITE or CMD_READ_VERIFY */ | ||
179 | __u8 drive_num; | ||
180 | __u16 error; | ||
181 | caddr_t buffer; /* R/W buffer address */ | ||
182 | __u32 first_block; /* Starting block */ | ||
183 | __u32 num_blocks; /* Number of blocks */ | ||
184 | __u8 tag[12]; /* tag data */ | ||
185 | }; | ||
186 | |||
187 | struct swimcmd_cachectl { | ||
188 | __u8 code; /* CMD_CACHE_CTRL */ | ||
189 | __u8 unused; | ||
190 | __u16 error; | ||
191 | __u8 enable; /* Nonzero to enable cache */ | ||
192 | __u8 install; /* +1 = install, -1 = remove, 0 = neither */ | ||
193 | }; | ||
194 | |||
195 | struct swimcmd_tagbufctl { | ||
196 | __u8 code; /* CMD_TAGBUFF_CTRL */ | ||
197 | __u8 unused; | ||
198 | __u16 error; | ||
199 | caddr_t buf; /* buffer address or 0 to disable */ | ||
200 | }; | ||
201 | |||
202 | struct swimcmd_geticon { | ||
203 | __u8 code; /* CMD_GET_ICON */ | ||
204 | __u8 drive_num; | ||
205 | __u16 error; | ||
206 | caddr_t buffer; /* Nuffer address */ | ||
207 | __u16 kind; /* 0 = media icon, 1 = drive icon */ | ||
208 | __u16 unused; | ||
209 | __u16 max_bytes; /* maximum byte count */ | ||
210 | }; | ||
211 | |||
212 | /* Messages from the SWIM IOP to the host CPU: */ | ||
213 | |||
214 | struct swimmsg_status { | ||
215 | __u8 code; /* 1 = insert, 2 = eject, 3 = status changed */ | ||
216 | __u8 drive_num; | ||
217 | __u16 error; | ||
218 | struct swim_drvstatus status; | ||
219 | }; | ||
220 | |||
221 | #endif /* __ASSEMBLY__ */ | ||
diff --git a/include/asm-m68k/system.h b/include/asm-m68k/system.h new file mode 100644 index 000000000000..64d3481df74c --- /dev/null +++ b/include/asm-m68k/system.h | |||
@@ -0,0 +1,201 @@ | |||
1 | #ifndef _M68K_SYSTEM_H | ||
2 | #define _M68K_SYSTEM_H | ||
3 | |||
4 | #include <linux/config.h> /* get configuration macros */ | ||
5 | #include <linux/linkage.h> | ||
6 | #include <linux/kernel.h> | ||
7 | #include <asm/segment.h> | ||
8 | #include <asm/entry.h> | ||
9 | |||
10 | #ifdef __KERNEL__ | ||
11 | |||
12 | /* | ||
13 | * switch_to(n) should switch tasks to task ptr, first checking that | ||
14 | * ptr isn't the current task, in which case it does nothing. This | ||
15 | * also clears the TS-flag if the task we switched to has used the | ||
16 | * math co-processor latest. | ||
17 | */ | ||
18 | /* | ||
19 | * switch_to() saves the extra registers, that are not saved | ||
20 | * automatically by SAVE_SWITCH_STACK in resume(), ie. d0-d5 and | ||
21 | * a0-a1. Some of these are used by schedule() and its predecessors | ||
22 | * and so we might get see unexpected behaviors when a task returns | ||
23 | * with unexpected register values. | ||
24 | * | ||
25 | * syscall stores these registers itself and none of them are used | ||
26 | * by syscall after the function in the syscall has been called. | ||
27 | * | ||
28 | * Beware that resume now expects *next to be in d1 and the offset of | ||
29 | * tss to be in a1. This saves a few instructions as we no longer have | ||
30 | * to push them onto the stack and read them back right after. | ||
31 | * | ||
32 | * 02/17/96 - Jes Sorensen (jds@kom.auc.dk) | ||
33 | * | ||
34 | * Changed 96/09/19 by Andreas Schwab | ||
35 | * pass prev in a0, next in a1 | ||
36 | */ | ||
37 | asmlinkage void resume(void); | ||
38 | #define switch_to(prev,next,last) do { \ | ||
39 | register void *_prev __asm__ ("a0") = (prev); \ | ||
40 | register void *_next __asm__ ("a1") = (next); \ | ||
41 | register void *_last __asm__ ("d1"); \ | ||
42 | __asm__ __volatile__("jbsr resume" \ | ||
43 | : "=a" (_prev), "=a" (_next), "=d" (_last) \ | ||
44 | : "0" (_prev), "1" (_next) \ | ||
45 | : "d0", "d2", "d3", "d4", "d5"); \ | ||
46 | (last) = _last; \ | ||
47 | } while (0) | ||
48 | |||
49 | |||
50 | /* interrupt control.. */ | ||
51 | #if 0 | ||
52 | #define local_irq_enable() asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory") | ||
53 | #else | ||
54 | #include <linux/hardirq.h> | ||
55 | #define local_irq_enable() ({ \ | ||
56 | if (MACH_IS_Q40 || !hardirq_count()) \ | ||
57 | asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory"); \ | ||
58 | }) | ||
59 | #endif | ||
60 | #define local_irq_disable() asm volatile ("oriw #0x0700,%%sr": : : "memory") | ||
61 | #define local_save_flags(x) asm volatile ("movew %%sr,%0":"=d" (x) : : "memory") | ||
62 | #define local_irq_restore(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory") | ||
63 | |||
64 | static inline int irqs_disabled(void) | ||
65 | { | ||
66 | unsigned long flags; | ||
67 | local_save_flags(flags); | ||
68 | return flags & ~ALLOWINT; | ||
69 | } | ||
70 | |||
71 | /* For spinlocks etc */ | ||
72 | #define local_irq_save(x) ({ local_save_flags(x); local_irq_disable(); }) | ||
73 | |||
74 | /* | ||
75 | * Force strict CPU ordering. | ||
76 | * Not really required on m68k... | ||
77 | */ | ||
78 | #define nop() do { asm volatile ("nop"); barrier(); } while (0) | ||
79 | #define mb() barrier() | ||
80 | #define rmb() barrier() | ||
81 | #define wmb() barrier() | ||
82 | #define read_barrier_depends() do { } while(0) | ||
83 | #define set_mb(var, value) do { xchg(&var, value); } while (0) | ||
84 | #define set_wmb(var, value) do { var = value; wmb(); } while (0) | ||
85 | |||
86 | #define smp_mb() barrier() | ||
87 | #define smp_rmb() barrier() | ||
88 | #define smp_wmb() barrier() | ||
89 | #define smp_read_barrier_depends() do { } while(0) | ||
90 | |||
91 | |||
92 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | ||
93 | #define tas(ptr) (xchg((ptr),1)) | ||
94 | |||
95 | struct __xchg_dummy { unsigned long a[100]; }; | ||
96 | #define __xg(x) ((volatile struct __xchg_dummy *)(x)) | ||
97 | |||
98 | #ifndef CONFIG_RMW_INSNS | ||
99 | static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) | ||
100 | { | ||
101 | unsigned long flags, tmp; | ||
102 | |||
103 | local_irq_save(flags); | ||
104 | |||
105 | switch (size) { | ||
106 | case 1: | ||
107 | tmp = *(u8 *)ptr; | ||
108 | *(u8 *)ptr = x; | ||
109 | x = tmp; | ||
110 | break; | ||
111 | case 2: | ||
112 | tmp = *(u16 *)ptr; | ||
113 | *(u16 *)ptr = x; | ||
114 | x = tmp; | ||
115 | break; | ||
116 | case 4: | ||
117 | tmp = *(u32 *)ptr; | ||
118 | *(u32 *)ptr = x; | ||
119 | x = tmp; | ||
120 | break; | ||
121 | default: | ||
122 | BUG(); | ||
123 | } | ||
124 | |||
125 | local_irq_restore(flags); | ||
126 | return x; | ||
127 | } | ||
128 | #else | ||
129 | static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) | ||
130 | { | ||
131 | switch (size) { | ||
132 | case 1: | ||
133 | __asm__ __volatile__ | ||
134 | ("moveb %2,%0\n\t" | ||
135 | "1:\n\t" | ||
136 | "casb %0,%1,%2\n\t" | ||
137 | "jne 1b" | ||
138 | : "=&d" (x) : "d" (x), "m" (*__xg(ptr)) : "memory"); | ||
139 | break; | ||
140 | case 2: | ||
141 | __asm__ __volatile__ | ||
142 | ("movew %2,%0\n\t" | ||
143 | "1:\n\t" | ||
144 | "casw %0,%1,%2\n\t" | ||
145 | "jne 1b" | ||
146 | : "=&d" (x) : "d" (x), "m" (*__xg(ptr)) : "memory"); | ||
147 | break; | ||
148 | case 4: | ||
149 | __asm__ __volatile__ | ||
150 | ("movel %2,%0\n\t" | ||
151 | "1:\n\t" | ||
152 | "casl %0,%1,%2\n\t" | ||
153 | "jne 1b" | ||
154 | : "=&d" (x) : "d" (x), "m" (*__xg(ptr)) : "memory"); | ||
155 | break; | ||
156 | } | ||
157 | return x; | ||
158 | } | ||
159 | #endif | ||
160 | |||
161 | /* | ||
162 | * Atomic compare and exchange. Compare OLD with MEM, if identical, | ||
163 | * store NEW in MEM. Return the initial value in MEM. Success is | ||
164 | * indicated by comparing RETURN with OLD. | ||
165 | */ | ||
166 | #ifdef CONFIG_RMW_INSNS | ||
167 | #define __HAVE_ARCH_CMPXCHG 1 | ||
168 | |||
169 | static inline unsigned long __cmpxchg(volatile void *p, unsigned long old, | ||
170 | unsigned long new, int size) | ||
171 | { | ||
172 | switch (size) { | ||
173 | case 1: | ||
174 | __asm__ __volatile__ ("casb %0,%2,%1" | ||
175 | : "=d" (old), "=m" (*(char *)p) | ||
176 | : "d" (new), "0" (old), "m" (*(char *)p)); | ||
177 | break; | ||
178 | case 2: | ||
179 | __asm__ __volatile__ ("casw %0,%2,%1" | ||
180 | : "=d" (old), "=m" (*(short *)p) | ||
181 | : "d" (new), "0" (old), "m" (*(short *)p)); | ||
182 | break; | ||
183 | case 4: | ||
184 | __asm__ __volatile__ ("casl %0,%2,%1" | ||
185 | : "=d" (old), "=m" (*(int *)p) | ||
186 | : "d" (new), "0" (old), "m" (*(int *)p)); | ||
187 | break; | ||
188 | } | ||
189 | return old; | ||
190 | } | ||
191 | |||
192 | #define cmpxchg(ptr,o,n)\ | ||
193 | ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ | ||
194 | (unsigned long)(n),sizeof(*(ptr)))) | ||
195 | #endif | ||
196 | |||
197 | #define arch_align_stack(x) (x) | ||
198 | |||
199 | #endif /* __KERNEL__ */ | ||
200 | |||
201 | #endif /* _M68K_SYSTEM_H */ | ||
diff --git a/include/asm-m68k/termbits.h b/include/asm-m68k/termbits.h new file mode 100644 index 000000000000..e9eec3eb0718 --- /dev/null +++ b/include/asm-m68k/termbits.h | |||
@@ -0,0 +1,175 @@ | |||
1 | #ifndef __ARCH_M68K_TERMBITS_H__ | ||
2 | #define __ARCH_M68K_TERMBITS_H__ | ||
3 | |||
4 | #include <linux/posix_types.h> | ||
5 | |||
6 | typedef unsigned char cc_t; | ||
7 | typedef unsigned int speed_t; | ||
8 | typedef unsigned int tcflag_t; | ||
9 | |||
10 | #define NCCS 19 | ||
11 | struct termios { | ||
12 | tcflag_t c_iflag; /* input mode flags */ | ||
13 | tcflag_t c_oflag; /* output mode flags */ | ||
14 | tcflag_t c_cflag; /* control mode flags */ | ||
15 | tcflag_t c_lflag; /* local mode flags */ | ||
16 | cc_t c_line; /* line discipline */ | ||
17 | cc_t c_cc[NCCS]; /* control characters */ | ||
18 | }; | ||
19 | |||
20 | /* c_cc characters */ | ||
21 | #define VINTR 0 | ||
22 | #define VQUIT 1 | ||
23 | #define VERASE 2 | ||
24 | #define VKILL 3 | ||
25 | #define VEOF 4 | ||
26 | #define VTIME 5 | ||
27 | #define VMIN 6 | ||
28 | #define VSWTC 7 | ||
29 | #define VSTART 8 | ||
30 | #define VSTOP 9 | ||
31 | #define VSUSP 10 | ||
32 | #define VEOL 11 | ||
33 | #define VREPRINT 12 | ||
34 | #define VDISCARD 13 | ||
35 | #define VWERASE 14 | ||
36 | #define VLNEXT 15 | ||
37 | #define VEOL2 16 | ||
38 | |||
39 | |||
40 | /* c_iflag bits */ | ||
41 | #define IGNBRK 0000001 | ||
42 | #define BRKINT 0000002 | ||
43 | #define IGNPAR 0000004 | ||
44 | #define PARMRK 0000010 | ||
45 | #define INPCK 0000020 | ||
46 | #define ISTRIP 0000040 | ||
47 | #define INLCR 0000100 | ||
48 | #define IGNCR 0000200 | ||
49 | #define ICRNL 0000400 | ||
50 | #define IUCLC 0001000 | ||
51 | #define IXON 0002000 | ||
52 | #define IXANY 0004000 | ||
53 | #define IXOFF 0010000 | ||
54 | #define IMAXBEL 0020000 | ||
55 | #define IUTF8 0040000 | ||
56 | |||
57 | /* c_oflag bits */ | ||
58 | #define OPOST 0000001 | ||
59 | #define OLCUC 0000002 | ||
60 | #define ONLCR 0000004 | ||
61 | #define OCRNL 0000010 | ||
62 | #define ONOCR 0000020 | ||
63 | #define ONLRET 0000040 | ||
64 | #define OFILL 0000100 | ||
65 | #define OFDEL 0000200 | ||
66 | #define NLDLY 0000400 | ||
67 | #define NL0 0000000 | ||
68 | #define NL1 0000400 | ||
69 | #define CRDLY 0003000 | ||
70 | #define CR0 0000000 | ||
71 | #define CR1 0001000 | ||
72 | #define CR2 0002000 | ||
73 | #define CR3 0003000 | ||
74 | #define TABDLY 0014000 | ||
75 | #define TAB0 0000000 | ||
76 | #define TAB1 0004000 | ||
77 | #define TAB2 0010000 | ||
78 | #define TAB3 0014000 | ||
79 | #define XTABS 0014000 | ||
80 | #define BSDLY 0020000 | ||
81 | #define BS0 0000000 | ||
82 | #define BS1 0020000 | ||
83 | #define VTDLY 0040000 | ||
84 | #define VT0 0000000 | ||
85 | #define VT1 0040000 | ||
86 | #define FFDLY 0100000 | ||
87 | #define FF0 0000000 | ||
88 | #define FF1 0100000 | ||
89 | |||
90 | /* c_cflag bit meaning */ | ||
91 | #define CBAUD 0010017 | ||
92 | #define B0 0000000 /* hang up */ | ||
93 | #define B50 0000001 | ||
94 | #define B75 0000002 | ||
95 | #define B110 0000003 | ||
96 | #define B134 0000004 | ||
97 | #define B150 0000005 | ||
98 | #define B200 0000006 | ||
99 | #define B300 0000007 | ||
100 | #define B600 0000010 | ||
101 | #define B1200 0000011 | ||
102 | #define B1800 0000012 | ||
103 | #define B2400 0000013 | ||
104 | #define B4800 0000014 | ||
105 | #define B9600 0000015 | ||
106 | #define B19200 0000016 | ||
107 | #define B38400 0000017 | ||
108 | #define EXTA B19200 | ||
109 | #define EXTB B38400 | ||
110 | #define CSIZE 0000060 | ||
111 | #define CS5 0000000 | ||
112 | #define CS6 0000020 | ||
113 | #define CS7 0000040 | ||
114 | #define CS8 0000060 | ||
115 | #define CSTOPB 0000100 | ||
116 | #define CREAD 0000200 | ||
117 | #define PARENB 0000400 | ||
118 | #define PARODD 0001000 | ||
119 | #define HUPCL 0002000 | ||
120 | #define CLOCAL 0004000 | ||
121 | #define CBAUDEX 0010000 | ||
122 | #define B57600 0010001 | ||
123 | #define B115200 0010002 | ||
124 | #define B230400 0010003 | ||
125 | #define B460800 0010004 | ||
126 | #define B500000 0010005 | ||
127 | #define B576000 0010006 | ||
128 | #define B921600 0010007 | ||
129 | #define B1000000 0010010 | ||
130 | #define B1152000 0010011 | ||
131 | #define B1500000 0010012 | ||
132 | #define B2000000 0010013 | ||
133 | #define B2500000 0010014 | ||
134 | #define B3000000 0010015 | ||
135 | #define B3500000 0010016 | ||
136 | #define B4000000 0010017 | ||
137 | #define CIBAUD 002003600000 /* input baud rate (not used) */ | ||
138 | #define CMSPAR 010000000000 /* mark or space (stick) parity */ | ||
139 | #define CRTSCTS 020000000000 /* flow control */ | ||
140 | |||
141 | /* c_lflag bits */ | ||
142 | #define ISIG 0000001 | ||
143 | #define ICANON 0000002 | ||
144 | #define XCASE 0000004 | ||
145 | #define ECHO 0000010 | ||
146 | #define ECHOE 0000020 | ||
147 | #define ECHOK 0000040 | ||
148 | #define ECHONL 0000100 | ||
149 | #define NOFLSH 0000200 | ||
150 | #define TOSTOP 0000400 | ||
151 | #define ECHOCTL 0001000 | ||
152 | #define ECHOPRT 0002000 | ||
153 | #define ECHOKE 0004000 | ||
154 | #define FLUSHO 0010000 | ||
155 | #define PENDIN 0040000 | ||
156 | #define IEXTEN 0100000 | ||
157 | |||
158 | |||
159 | /* tcflow() and TCXONC use these */ | ||
160 | #define TCOOFF 0 | ||
161 | #define TCOON 1 | ||
162 | #define TCIOFF 2 | ||
163 | #define TCION 3 | ||
164 | |||
165 | /* tcflush() and TCFLSH use these */ | ||
166 | #define TCIFLUSH 0 | ||
167 | #define TCOFLUSH 1 | ||
168 | #define TCIOFLUSH 2 | ||
169 | |||
170 | /* tcsetattr uses these */ | ||
171 | #define TCSANOW 0 | ||
172 | #define TCSADRAIN 1 | ||
173 | #define TCSAFLUSH 2 | ||
174 | |||
175 | #endif /* __ARCH_M68K_TERMBITS_H__ */ | ||
diff --git a/include/asm-m68k/termios.h b/include/asm-m68k/termios.h new file mode 100644 index 000000000000..857f0c9a9120 --- /dev/null +++ b/include/asm-m68k/termios.h | |||
@@ -0,0 +1,108 @@ | |||
1 | #ifndef _M68K_TERMIOS_H | ||
2 | #define _M68K_TERMIOS_H | ||
3 | |||
4 | #include <asm/termbits.h> | ||
5 | #include <asm/ioctls.h> | ||
6 | |||
7 | struct winsize { | ||
8 | unsigned short ws_row; | ||
9 | unsigned short ws_col; | ||
10 | unsigned short ws_xpixel; | ||
11 | unsigned short ws_ypixel; | ||
12 | }; | ||
13 | |||
14 | #define NCC 8 | ||
15 | struct termio { | ||
16 | unsigned short c_iflag; /* input mode flags */ | ||
17 | unsigned short c_oflag; /* output mode flags */ | ||
18 | unsigned short c_cflag; /* control mode flags */ | ||
19 | unsigned short c_lflag; /* local mode flags */ | ||
20 | unsigned char c_line; /* line discipline */ | ||
21 | unsigned char c_cc[NCC]; /* control characters */ | ||
22 | }; | ||
23 | |||
24 | #ifdef __KERNEL__ | ||
25 | /* intr=^C quit=^| erase=del kill=^U | ||
26 | eof=^D vtime=\0 vmin=\1 sxtc=\0 | ||
27 | start=^Q stop=^S susp=^Z eol=\0 | ||
28 | reprint=^R discard=^U werase=^W lnext=^V | ||
29 | eol2=\0 | ||
30 | */ | ||
31 | #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" | ||
32 | #endif | ||
33 | |||
34 | /* modem lines */ | ||
35 | #define TIOCM_LE 0x001 | ||
36 | #define TIOCM_DTR 0x002 | ||
37 | #define TIOCM_RTS 0x004 | ||
38 | #define TIOCM_ST 0x008 | ||
39 | #define TIOCM_SR 0x010 | ||
40 | #define TIOCM_CTS 0x020 | ||
41 | #define TIOCM_CAR 0x040 | ||
42 | #define TIOCM_RNG 0x080 | ||
43 | #define TIOCM_DSR 0x100 | ||
44 | #define TIOCM_CD TIOCM_CAR | ||
45 | #define TIOCM_RI TIOCM_RNG | ||
46 | #define TIOCM_OUT1 0x2000 | ||
47 | #define TIOCM_OUT2 0x4000 | ||
48 | #define TIOCM_LOOP 0x8000 | ||
49 | |||
50 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
51 | |||
52 | /* line disciplines */ | ||
53 | #define N_TTY 0 | ||
54 | #define N_SLIP 1 | ||
55 | #define N_MOUSE 2 | ||
56 | #define N_PPP 3 | ||
57 | #define N_STRIP 4 | ||
58 | #define N_AX25 5 | ||
59 | #define N_X25 6 /* X.25 async */ | ||
60 | #define N_6PACK 7 | ||
61 | #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ | ||
62 | #define N_R3964 9 /* Reserved for Simatic R3964 module */ | ||
63 | #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ | ||
64 | #define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */ | ||
65 | #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ | ||
66 | #define N_HDLC 13 /* synchronous HDLC */ | ||
67 | #define N_SYNC_PPP 14 | ||
68 | #define N_HCI 15 /* Bluetooth HCI UART */ | ||
69 | |||
70 | #ifdef __KERNEL__ | ||
71 | |||
72 | /* | ||
73 | * Translate a "termio" structure into a "termios". Ugh. | ||
74 | */ | ||
75 | #define user_termio_to_kernel_termios(termios, termio) \ | ||
76 | ({ \ | ||
77 | unsigned short tmp; \ | ||
78 | get_user(tmp, &(termio)->c_iflag); \ | ||
79 | (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \ | ||
80 | get_user(tmp, &(termio)->c_oflag); \ | ||
81 | (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \ | ||
82 | get_user(tmp, &(termio)->c_cflag); \ | ||
83 | (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \ | ||
84 | get_user(tmp, &(termio)->c_lflag); \ | ||
85 | (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \ | ||
86 | get_user((termios)->c_line, &(termio)->c_line); \ | ||
87 | copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ | ||
88 | }) | ||
89 | |||
90 | /* | ||
91 | * Translate a "termios" structure into a "termio". Ugh. | ||
92 | */ | ||
93 | #define kernel_termios_to_user_termio(termio, termios) \ | ||
94 | ({ \ | ||
95 | put_user((termios)->c_iflag, &(termio)->c_iflag); \ | ||
96 | put_user((termios)->c_oflag, &(termio)->c_oflag); \ | ||
97 | put_user((termios)->c_cflag, &(termio)->c_cflag); \ | ||
98 | put_user((termios)->c_lflag, &(termio)->c_lflag); \ | ||
99 | put_user((termios)->c_line, &(termio)->c_line); \ | ||
100 | copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ | ||
101 | }) | ||
102 | |||
103 | #define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) | ||
104 | #define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) | ||
105 | |||
106 | #endif /* __KERNEL__ */ | ||
107 | |||
108 | #endif /* _M68K_TERMIOS_H */ | ||
diff --git a/include/asm-m68k/thread_info.h b/include/asm-m68k/thread_info.h new file mode 100644 index 000000000000..5f58939c59db --- /dev/null +++ b/include/asm-m68k/thread_info.h | |||
@@ -0,0 +1,118 @@ | |||
1 | #ifndef _ASM_M68K_THREAD_INFO_H | ||
2 | #define _ASM_M68K_THREAD_INFO_H | ||
3 | |||
4 | #include <asm/types.h> | ||
5 | #include <asm/processor.h> | ||
6 | #include <asm/page.h> | ||
7 | |||
8 | struct thread_info { | ||
9 | struct task_struct *task; /* main task structure */ | ||
10 | struct exec_domain *exec_domain; /* execution domain */ | ||
11 | __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ | ||
12 | __u32 cpu; /* should always be 0 on m68k */ | ||
13 | struct restart_block restart_block; | ||
14 | |||
15 | __u8 supervisor_stack[0]; | ||
16 | }; | ||
17 | |||
18 | #define PREEMPT_ACTIVE 0x4000000 | ||
19 | |||
20 | #define INIT_THREAD_INFO(tsk) \ | ||
21 | { \ | ||
22 | .task = &tsk, \ | ||
23 | .exec_domain = &default_exec_domain, \ | ||
24 | .restart_block = { \ | ||
25 | .fn = do_no_restart_syscall, \ | ||
26 | }, \ | ||
27 | } | ||
28 | |||
29 | /* THREAD_SIZE should be 8k, so handle differently for 4k and 8k machines */ | ||
30 | #if PAGE_SHIFT == 13 /* 8k machines */ | ||
31 | #define alloc_thread_info(tsk) ((struct thread_info *)__get_free_pages(GFP_KERNEL,0)) | ||
32 | #define free_thread_info(ti) free_pages((unsigned long)(ti),0) | ||
33 | #else /* otherwise assume 4k pages */ | ||
34 | #define alloc_thread_info(tsk) ((struct thread_info *)__get_free_pages(GFP_KERNEL,1)) | ||
35 | #define free_thread_info(ti) free_pages((unsigned long)(ti),1) | ||
36 | #endif /* PAGE_SHIFT == 13 */ | ||
37 | |||
38 | //#define init_thread_info (init_task.thread.info) | ||
39 | #define init_stack (init_thread_union.stack) | ||
40 | |||
41 | #define current_thread_info() (current->thread_info) | ||
42 | |||
43 | |||
44 | #define __HAVE_THREAD_FUNCTIONS | ||
45 | |||
46 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
47 | #define TIF_DELAYED_TRACE 1 /* single step a syscall */ | ||
48 | #define TIF_NOTIFY_RESUME 2 /* resumption notification requested */ | ||
49 | #define TIF_SIGPENDING 3 /* signal pending */ | ||
50 | #define TIF_NEED_RESCHED 4 /* rescheduling necessary */ | ||
51 | #define TIF_MEMDIE 5 | ||
52 | |||
53 | extern int thread_flag_fixme(void); | ||
54 | |||
55 | /* | ||
56 | * flag set/clear/test wrappers | ||
57 | * - pass TIF_xxxx constants to these functions | ||
58 | */ | ||
59 | |||
60 | #define __set_tsk_thread_flag(tsk, flag, val) ({ \ | ||
61 | switch (flag) { \ | ||
62 | case TIF_SIGPENDING: \ | ||
63 | tsk->thread.work.sigpending = val; \ | ||
64 | break; \ | ||
65 | case TIF_NEED_RESCHED: \ | ||
66 | tsk->thread.work.need_resched = val; \ | ||
67 | break; \ | ||
68 | case TIF_SYSCALL_TRACE: \ | ||
69 | tsk->thread.work.syscall_trace = val; \ | ||
70 | break; \ | ||
71 | case TIF_MEMDIE: \ | ||
72 | tsk->thread.work.memdie = val; \ | ||
73 | break; \ | ||
74 | default: \ | ||
75 | thread_flag_fixme(); \ | ||
76 | } \ | ||
77 | }) | ||
78 | |||
79 | #define __get_tsk_thread_flag(tsk, flag) ({ \ | ||
80 | int ___res; \ | ||
81 | switch (flag) { \ | ||
82 | case TIF_SIGPENDING: \ | ||
83 | ___res = tsk->thread.work.sigpending; \ | ||
84 | break; \ | ||
85 | case TIF_NEED_RESCHED: \ | ||
86 | ___res = tsk->thread.work.need_resched; \ | ||
87 | break; \ | ||
88 | case TIF_SYSCALL_TRACE: \ | ||
89 | ___res = tsk->thread.work.syscall_trace;\ | ||
90 | break; \ | ||
91 | case TIF_MEMDIE: \ | ||
92 | ___res = tsk->thread.work.memdie;\ | ||
93 | break; \ | ||
94 | default: \ | ||
95 | ___res = thread_flag_fixme(); \ | ||
96 | } \ | ||
97 | ___res; \ | ||
98 | }) | ||
99 | |||
100 | #define __get_set_tsk_thread_flag(tsk, flag, val) ({ \ | ||
101 | int __res = __get_tsk_thread_flag(tsk, flag); \ | ||
102 | __set_tsk_thread_flag(tsk, flag, val); \ | ||
103 | __res; \ | ||
104 | }) | ||
105 | |||
106 | #define set_tsk_thread_flag(tsk, flag) __set_tsk_thread_flag(tsk, flag, ~0) | ||
107 | #define clear_tsk_thread_flag(tsk, flag) __set_tsk_thread_flag(tsk, flag, 0) | ||
108 | #define test_and_set_tsk_thread_flag(tsk, flag) __get_set_tsk_thread_flag(tsk, flag, ~0) | ||
109 | #define test_tsk_thread_flag(tsk, flag) __get_tsk_thread_flag(tsk, flag) | ||
110 | |||
111 | #define set_thread_flag(flag) set_tsk_thread_flag(current, flag) | ||
112 | #define clear_thread_flag(flag) clear_tsk_thread_flag(current, flag) | ||
113 | #define test_thread_flag(flag) test_tsk_thread_flag(current, flag) | ||
114 | |||
115 | #define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) | ||
116 | #define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) | ||
117 | |||
118 | #endif /* _ASM_M68K_THREAD_INFO_H */ | ||
diff --git a/include/asm-m68k/timex.h b/include/asm-m68k/timex.h new file mode 100644 index 000000000000..b87f2f278f67 --- /dev/null +++ b/include/asm-m68k/timex.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * linux/include/asm-m68k/timex.h | ||
3 | * | ||
4 | * m68k architecture timex specifications | ||
5 | */ | ||
6 | #ifndef _ASMm68k_TIMEX_H | ||
7 | #define _ASMm68k_TIMEX_H | ||
8 | |||
9 | #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ | ||
10 | |||
11 | typedef unsigned long cycles_t; | ||
12 | |||
13 | static inline cycles_t get_cycles(void) | ||
14 | { | ||
15 | return 0; | ||
16 | } | ||
17 | |||
18 | #endif | ||
diff --git a/include/asm-m68k/tlb.h b/include/asm-m68k/tlb.h new file mode 100644 index 000000000000..1785cff73449 --- /dev/null +++ b/include/asm-m68k/tlb.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef _M68K_TLB_H | ||
2 | #define _M68K_TLB_H | ||
3 | |||
4 | /* | ||
5 | * m68k doesn't need any special per-pte or | ||
6 | * per-vma handling.. | ||
7 | */ | ||
8 | #define tlb_start_vma(tlb, vma) do { } while (0) | ||
9 | #define tlb_end_vma(tlb, vma) do { } while (0) | ||
10 | #define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) | ||
11 | |||
12 | /* | ||
13 | * .. because we flush the whole mm when it | ||
14 | * fills up. | ||
15 | */ | ||
16 | #define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) | ||
17 | |||
18 | #include <asm-generic/tlb.h> | ||
19 | |||
20 | #endif /* _M68K_TLB_H */ | ||
diff --git a/include/asm-m68k/tlbflush.h b/include/asm-m68k/tlbflush.h new file mode 100644 index 000000000000..8e61ccffe13a --- /dev/null +++ b/include/asm-m68k/tlbflush.h | |||
@@ -0,0 +1,230 @@ | |||
1 | #ifndef _M68K_TLBFLUSH_H | ||
2 | #define _M68K_TLBFLUSH_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | |||
6 | #ifndef CONFIG_SUN3 | ||
7 | |||
8 | #include <asm/current.h> | ||
9 | |||
10 | static inline void flush_tlb_kernel_page(void *addr) | ||
11 | { | ||
12 | if (CPU_IS_040_OR_060) { | ||
13 | mm_segment_t old_fs = get_fs(); | ||
14 | set_fs(KERNEL_DS); | ||
15 | __asm__ __volatile__(".chip 68040\n\t" | ||
16 | "pflush (%0)\n\t" | ||
17 | ".chip 68k" | ||
18 | : : "a" (addr)); | ||
19 | set_fs(old_fs); | ||
20 | } else | ||
21 | __asm__ __volatile__("pflush #4,#4,(%0)" : : "a" (addr)); | ||
22 | } | ||
23 | |||
24 | /* | ||
25 | * flush all user-space atc entries. | ||
26 | */ | ||
27 | static inline void __flush_tlb(void) | ||
28 | { | ||
29 | if (CPU_IS_040_OR_060) | ||
30 | __asm__ __volatile__(".chip 68040\n\t" | ||
31 | "pflushan\n\t" | ||
32 | ".chip 68k"); | ||
33 | else | ||
34 | __asm__ __volatile__("pflush #0,#4"); | ||
35 | } | ||
36 | |||
37 | static inline void __flush_tlb040_one(unsigned long addr) | ||
38 | { | ||
39 | __asm__ __volatile__(".chip 68040\n\t" | ||
40 | "pflush (%0)\n\t" | ||
41 | ".chip 68k" | ||
42 | : : "a" (addr)); | ||
43 | } | ||
44 | |||
45 | static inline void __flush_tlb_one(unsigned long addr) | ||
46 | { | ||
47 | if (CPU_IS_040_OR_060) | ||
48 | __flush_tlb040_one(addr); | ||
49 | else | ||
50 | __asm__ __volatile__("pflush #0,#4,(%0)" : : "a" (addr)); | ||
51 | } | ||
52 | |||
53 | #define flush_tlb() __flush_tlb() | ||
54 | |||
55 | /* | ||
56 | * flush all atc entries (both kernel and user-space entries). | ||
57 | */ | ||
58 | static inline void flush_tlb_all(void) | ||
59 | { | ||
60 | if (CPU_IS_040_OR_060) | ||
61 | __asm__ __volatile__(".chip 68040\n\t" | ||
62 | "pflusha\n\t" | ||
63 | ".chip 68k"); | ||
64 | else | ||
65 | __asm__ __volatile__("pflusha"); | ||
66 | } | ||
67 | |||
68 | static inline void flush_tlb_mm(struct mm_struct *mm) | ||
69 | { | ||
70 | if (mm == current->active_mm) | ||
71 | __flush_tlb(); | ||
72 | } | ||
73 | |||
74 | static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr) | ||
75 | { | ||
76 | if (vma->vm_mm == current->active_mm) { | ||
77 | mm_segment_t old_fs = get_fs(); | ||
78 | set_fs(USER_DS); | ||
79 | __flush_tlb_one(addr); | ||
80 | set_fs(old_fs); | ||
81 | } | ||
82 | } | ||
83 | |||
84 | static inline void flush_tlb_range(struct vm_area_struct *vma, | ||
85 | unsigned long start, unsigned long end) | ||
86 | { | ||
87 | if (vma->vm_mm == current->active_mm) | ||
88 | __flush_tlb(); | ||
89 | } | ||
90 | |||
91 | static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end) | ||
92 | { | ||
93 | flush_tlb_all(); | ||
94 | } | ||
95 | |||
96 | static inline void flush_tlb_pgtables(struct mm_struct *mm, | ||
97 | unsigned long start, unsigned long end) | ||
98 | { | ||
99 | } | ||
100 | |||
101 | #else | ||
102 | |||
103 | |||
104 | /* Reserved PMEGs. */ | ||
105 | extern char sun3_reserved_pmeg[SUN3_PMEGS_NUM]; | ||
106 | extern unsigned long pmeg_vaddr[SUN3_PMEGS_NUM]; | ||
107 | extern unsigned char pmeg_alloc[SUN3_PMEGS_NUM]; | ||
108 | extern unsigned char pmeg_ctx[SUN3_PMEGS_NUM]; | ||
109 | |||
110 | /* Flush all userspace mappings one by one... (why no flush command, | ||
111 | sun?) */ | ||
112 | static inline void flush_tlb_all(void) | ||
113 | { | ||
114 | unsigned long addr; | ||
115 | unsigned char ctx, oldctx; | ||
116 | |||
117 | oldctx = sun3_get_context(); | ||
118 | for(addr = 0x00000000; addr < TASK_SIZE; addr += SUN3_PMEG_SIZE) { | ||
119 | for(ctx = 0; ctx < 8; ctx++) { | ||
120 | sun3_put_context(ctx); | ||
121 | sun3_put_segmap(addr, SUN3_INVALID_PMEG); | ||
122 | } | ||
123 | } | ||
124 | |||
125 | sun3_put_context(oldctx); | ||
126 | /* erase all of the userspace pmeg maps, we've clobbered them | ||
127 | all anyway */ | ||
128 | for(addr = 0; addr < SUN3_INVALID_PMEG; addr++) { | ||
129 | if(pmeg_alloc[addr] == 1) { | ||
130 | pmeg_alloc[addr] = 0; | ||
131 | pmeg_ctx[addr] = 0; | ||
132 | pmeg_vaddr[addr] = 0; | ||
133 | } | ||
134 | } | ||
135 | |||
136 | } | ||
137 | |||
138 | /* Clear user TLB entries within the context named in mm */ | ||
139 | static inline void flush_tlb_mm (struct mm_struct *mm) | ||
140 | { | ||
141 | unsigned char oldctx; | ||
142 | unsigned char seg; | ||
143 | unsigned long i; | ||
144 | |||
145 | oldctx = sun3_get_context(); | ||
146 | sun3_put_context(mm->context); | ||
147 | |||
148 | for(i = 0; i < TASK_SIZE; i += SUN3_PMEG_SIZE) { | ||
149 | seg = sun3_get_segmap(i); | ||
150 | if(seg == SUN3_INVALID_PMEG) | ||
151 | continue; | ||
152 | |||
153 | sun3_put_segmap(i, SUN3_INVALID_PMEG); | ||
154 | pmeg_alloc[seg] = 0; | ||
155 | pmeg_ctx[seg] = 0; | ||
156 | pmeg_vaddr[seg] = 0; | ||
157 | } | ||
158 | |||
159 | sun3_put_context(oldctx); | ||
160 | |||
161 | } | ||
162 | |||
163 | /* Flush a single TLB page. In this case, we're limited to flushing a | ||
164 | single PMEG */ | ||
165 | static inline void flush_tlb_page (struct vm_area_struct *vma, | ||
166 | unsigned long addr) | ||
167 | { | ||
168 | unsigned char oldctx; | ||
169 | unsigned char i; | ||
170 | |||
171 | oldctx = sun3_get_context(); | ||
172 | sun3_put_context(vma->vm_mm->context); | ||
173 | addr &= ~SUN3_PMEG_MASK; | ||
174 | if((i = sun3_get_segmap(addr)) != SUN3_INVALID_PMEG) | ||
175 | { | ||
176 | pmeg_alloc[i] = 0; | ||
177 | pmeg_ctx[i] = 0; | ||
178 | pmeg_vaddr[i] = 0; | ||
179 | sun3_put_segmap (addr, SUN3_INVALID_PMEG); | ||
180 | } | ||
181 | sun3_put_context(oldctx); | ||
182 | |||
183 | } | ||
184 | /* Flush a range of pages from TLB. */ | ||
185 | |||
186 | static inline void flush_tlb_range (struct vm_area_struct *vma, | ||
187 | unsigned long start, unsigned long end) | ||
188 | { | ||
189 | struct mm_struct *mm = vma->vm_mm; | ||
190 | unsigned char seg, oldctx; | ||
191 | |||
192 | start &= ~SUN3_PMEG_MASK; | ||
193 | |||
194 | oldctx = sun3_get_context(); | ||
195 | sun3_put_context(mm->context); | ||
196 | |||
197 | while(start < end) | ||
198 | { | ||
199 | if((seg = sun3_get_segmap(start)) == SUN3_INVALID_PMEG) | ||
200 | goto next; | ||
201 | if(pmeg_ctx[seg] == mm->context) { | ||
202 | pmeg_alloc[seg] = 0; | ||
203 | pmeg_ctx[seg] = 0; | ||
204 | pmeg_vaddr[seg] = 0; | ||
205 | } | ||
206 | sun3_put_segmap(start, SUN3_INVALID_PMEG); | ||
207 | next: | ||
208 | start += SUN3_PMEG_SIZE; | ||
209 | } | ||
210 | } | ||
211 | |||
212 | static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end) | ||
213 | { | ||
214 | flush_tlb_all(); | ||
215 | } | ||
216 | |||
217 | /* Flush kernel page from TLB. */ | ||
218 | static inline void flush_tlb_kernel_page (unsigned long addr) | ||
219 | { | ||
220 | sun3_put_segmap (addr & ~(SUN3_PMEG_SIZE - 1), SUN3_INVALID_PMEG); | ||
221 | } | ||
222 | |||
223 | static inline void flush_tlb_pgtables(struct mm_struct *mm, | ||
224 | unsigned long start, unsigned long end) | ||
225 | { | ||
226 | } | ||
227 | |||
228 | #endif | ||
229 | |||
230 | #endif /* _M68K_TLBFLUSH_H */ | ||
diff --git a/include/asm-m68k/topology.h b/include/asm-m68k/topology.h new file mode 100644 index 000000000000..ca173e9f26ff --- /dev/null +++ b/include/asm-m68k/topology.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_M68K_TOPOLOGY_H | ||
2 | #define _ASM_M68K_TOPOLOGY_H | ||
3 | |||
4 | #include <asm-generic/topology.h> | ||
5 | |||
6 | #endif /* _ASM_M68K_TOPOLOGY_H */ | ||
diff --git a/include/asm-m68k/traps.h b/include/asm-m68k/traps.h new file mode 100644 index 000000000000..475056191252 --- /dev/null +++ b/include/asm-m68k/traps.h | |||
@@ -0,0 +1,265 @@ | |||
1 | /* | ||
2 | * linux/include/asm/traps.h | ||
3 | * | ||
4 | * Copyright (C) 1993 Hamish Macdonald | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file COPYING in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #ifndef _M68K_TRAPS_H | ||
12 | #define _M68K_TRAPS_H | ||
13 | |||
14 | #ifndef __ASSEMBLY__ | ||
15 | |||
16 | typedef void (*e_vector)(void); | ||
17 | |||
18 | extern e_vector vectors[]; | ||
19 | |||
20 | #endif | ||
21 | |||
22 | #define VEC_RESETSP (0) | ||
23 | #define VEC_RESETPC (1) | ||
24 | #define VEC_BUSERR (2) | ||
25 | #define VEC_ADDRERR (3) | ||
26 | #define VEC_ILLEGAL (4) | ||
27 | #define VEC_ZERODIV (5) | ||
28 | #define VEC_CHK (6) | ||
29 | #define VEC_TRAP (7) | ||
30 | #define VEC_PRIV (8) | ||
31 | #define VEC_TRACE (9) | ||
32 | #define VEC_LINE10 (10) | ||
33 | #define VEC_LINE11 (11) | ||
34 | #define VEC_RESV12 (12) | ||
35 | #define VEC_COPROC (13) | ||
36 | #define VEC_FORMAT (14) | ||
37 | #define VEC_UNINT (15) | ||
38 | #define VEC_RESV16 (16) | ||
39 | #define VEC_RESV17 (17) | ||
40 | #define VEC_RESV18 (18) | ||
41 | #define VEC_RESV19 (19) | ||
42 | #define VEC_RESV20 (20) | ||
43 | #define VEC_RESV21 (21) | ||
44 | #define VEC_RESV22 (22) | ||
45 | #define VEC_RESV23 (23) | ||
46 | #define VEC_SPUR (24) | ||
47 | #define VEC_INT1 (25) | ||
48 | #define VEC_INT2 (26) | ||
49 | #define VEC_INT3 (27) | ||
50 | #define VEC_INT4 (28) | ||
51 | #define VEC_INT5 (29) | ||
52 | #define VEC_INT6 (30) | ||
53 | #define VEC_INT7 (31) | ||
54 | #define VEC_SYS (32) | ||
55 | #define VEC_TRAP1 (33) | ||
56 | #define VEC_TRAP2 (34) | ||
57 | #define VEC_TRAP3 (35) | ||
58 | #define VEC_TRAP4 (36) | ||
59 | #define VEC_TRAP5 (37) | ||
60 | #define VEC_TRAP6 (38) | ||
61 | #define VEC_TRAP7 (39) | ||
62 | #define VEC_TRAP8 (40) | ||
63 | #define VEC_TRAP9 (41) | ||
64 | #define VEC_TRAP10 (42) | ||
65 | #define VEC_TRAP11 (43) | ||
66 | #define VEC_TRAP12 (44) | ||
67 | #define VEC_TRAP13 (45) | ||
68 | #define VEC_TRAP14 (46) | ||
69 | #define VEC_TRAP15 (47) | ||
70 | #define VEC_FPBRUC (48) | ||
71 | #define VEC_FPIR (49) | ||
72 | #define VEC_FPDIVZ (50) | ||
73 | #define VEC_FPUNDER (51) | ||
74 | #define VEC_FPOE (52) | ||
75 | #define VEC_FPOVER (53) | ||
76 | #define VEC_FPNAN (54) | ||
77 | #define VEC_FPUNSUP (55) | ||
78 | #define VEC_MMUCFG (56) | ||
79 | #define VEC_MMUILL (57) | ||
80 | #define VEC_MMUACC (58) | ||
81 | #define VEC_RESV59 (59) | ||
82 | #define VEC_UNIMPEA (60) | ||
83 | #define VEC_UNIMPII (61) | ||
84 | #define VEC_RESV62 (62) | ||
85 | #define VEC_RESV63 (63) | ||
86 | #define VEC_USER (64) | ||
87 | |||
88 | #define VECOFF(vec) ((vec)<<2) | ||
89 | |||
90 | #ifndef __ASSEMBLY__ | ||
91 | |||
92 | /* Status register bits */ | ||
93 | #define PS_T (0x8000) | ||
94 | #define PS_S (0x2000) | ||
95 | #define PS_M (0x1000) | ||
96 | #define PS_C (0x0001) | ||
97 | |||
98 | /* bits for 68020/68030 special status word */ | ||
99 | |||
100 | #define FC (0x8000) | ||
101 | #define FB (0x4000) | ||
102 | #define RC (0x2000) | ||
103 | #define RB (0x1000) | ||
104 | #define DF (0x0100) | ||
105 | #define RM (0x0080) | ||
106 | #define RW (0x0040) | ||
107 | #define SZ (0x0030) | ||
108 | #define DFC (0x0007) | ||
109 | |||
110 | /* bits for 68030 MMU status register (mmusr,psr) */ | ||
111 | |||
112 | #define MMU_B (0x8000) /* bus error */ | ||
113 | #define MMU_L (0x4000) /* limit violation */ | ||
114 | #define MMU_S (0x2000) /* supervisor violation */ | ||
115 | #define MMU_WP (0x0800) /* write-protected */ | ||
116 | #define MMU_I (0x0400) /* invalid descriptor */ | ||
117 | #define MMU_M (0x0200) /* ATC entry modified */ | ||
118 | #define MMU_T (0x0040) /* transparent translation */ | ||
119 | #define MMU_NUM (0x0007) /* number of levels traversed */ | ||
120 | |||
121 | |||
122 | /* bits for 68040 special status word */ | ||
123 | #define CP_040 (0x8000) | ||
124 | #define CU_040 (0x4000) | ||
125 | #define CT_040 (0x2000) | ||
126 | #define CM_040 (0x1000) | ||
127 | #define MA_040 (0x0800) | ||
128 | #define ATC_040 (0x0400) | ||
129 | #define LK_040 (0x0200) | ||
130 | #define RW_040 (0x0100) | ||
131 | #define SIZ_040 (0x0060) | ||
132 | #define TT_040 (0x0018) | ||
133 | #define TM_040 (0x0007) | ||
134 | |||
135 | /* bits for 68040 write back status word */ | ||
136 | #define WBV_040 (0x80) | ||
137 | #define WBSIZ_040 (0x60) | ||
138 | #define WBBYT_040 (0x20) | ||
139 | #define WBWRD_040 (0x40) | ||
140 | #define WBLNG_040 (0x00) | ||
141 | #define WBTT_040 (0x18) | ||
142 | #define WBTM_040 (0x07) | ||
143 | |||
144 | /* bus access size codes */ | ||
145 | #define BA_SIZE_BYTE (0x20) | ||
146 | #define BA_SIZE_WORD (0x40) | ||
147 | #define BA_SIZE_LONG (0x00) | ||
148 | #define BA_SIZE_LINE (0x60) | ||
149 | |||
150 | /* bus access transfer type codes */ | ||
151 | #define BA_TT_MOVE16 (0x08) | ||
152 | |||
153 | /* bits for 68040 MMU status register (mmusr) */ | ||
154 | #define MMU_B_040 (0x0800) | ||
155 | #define MMU_G_040 (0x0400) | ||
156 | #define MMU_S_040 (0x0080) | ||
157 | #define MMU_CM_040 (0x0060) | ||
158 | #define MMU_M_040 (0x0010) | ||
159 | #define MMU_WP_040 (0x0004) | ||
160 | #define MMU_T_040 (0x0002) | ||
161 | #define MMU_R_040 (0x0001) | ||
162 | |||
163 | /* bits in the 68060 fault status long word (FSLW) */ | ||
164 | #define MMU060_MA (0x08000000) /* misaligned */ | ||
165 | #define MMU060_LK (0x02000000) /* locked transfer */ | ||
166 | #define MMU060_RW (0x01800000) /* read/write */ | ||
167 | # define MMU060_RW_W (0x00800000) /* write */ | ||
168 | # define MMU060_RW_R (0x01000000) /* read */ | ||
169 | # define MMU060_RW_RMW (0x01800000) /* read/modify/write */ | ||
170 | # define MMU060_W (0x00800000) /* general write, includes rmw */ | ||
171 | #define MMU060_SIZ (0x00600000) /* transfer size */ | ||
172 | #define MMU060_TT (0x00180000) /* transfer type (TT) bits */ | ||
173 | #define MMU060_TM (0x00070000) /* transfer modifier (TM) bits */ | ||
174 | #define MMU060_IO (0x00008000) /* instruction or operand */ | ||
175 | #define MMU060_PBE (0x00004000) /* push buffer bus error */ | ||
176 | #define MMU060_SBE (0x00002000) /* store buffer bus error */ | ||
177 | #define MMU060_PTA (0x00001000) /* pointer A fault */ | ||
178 | #define MMU060_PTB (0x00000800) /* pointer B fault */ | ||
179 | #define MMU060_IL (0x00000400) /* double indirect descr fault */ | ||
180 | #define MMU060_PF (0x00000200) /* page fault (invalid descr) */ | ||
181 | #define MMU060_SP (0x00000100) /* supervisor protection */ | ||
182 | #define MMU060_WP (0x00000080) /* write protection */ | ||
183 | #define MMU060_TWE (0x00000040) /* bus error on table search */ | ||
184 | #define MMU060_RE (0x00000020) /* bus error on read */ | ||
185 | #define MMU060_WE (0x00000010) /* bus error on write */ | ||
186 | #define MMU060_TTR (0x00000008) /* error caused by TTR translation */ | ||
187 | #define MMU060_BPE (0x00000004) /* branch prediction error */ | ||
188 | #define MMU060_SEE (0x00000001) /* software emulated error */ | ||
189 | |||
190 | /* cases of missing or invalid descriptors */ | ||
191 | #define MMU060_DESC_ERR (MMU060_PTA | MMU060_PTB | \ | ||
192 | MMU060_IL | MMU060_PF) | ||
193 | /* bits that indicate real errors */ | ||
194 | #define MMU060_ERR_BITS (MMU060_PBE | MMU060_SBE | MMU060_DESC_ERR | MMU060_SP | \ | ||
195 | MMU060_WP | MMU060_TWE | MMU060_RE | MMU060_WE) | ||
196 | |||
197 | /* structure for stack frames */ | ||
198 | |||
199 | struct frame { | ||
200 | struct pt_regs ptregs; | ||
201 | union { | ||
202 | struct { | ||
203 | unsigned long iaddr; /* instruction address */ | ||
204 | } fmt2; | ||
205 | struct { | ||
206 | unsigned long effaddr; /* effective address */ | ||
207 | } fmt3; | ||
208 | struct { | ||
209 | unsigned long effaddr; /* effective address */ | ||
210 | unsigned long pc; /* pc of faulted instr */ | ||
211 | } fmt4; | ||
212 | struct { | ||
213 | unsigned long effaddr; /* effective address */ | ||
214 | unsigned short ssw; /* special status word */ | ||
215 | unsigned short wb3s; /* write back 3 status */ | ||
216 | unsigned short wb2s; /* write back 2 status */ | ||
217 | unsigned short wb1s; /* write back 1 status */ | ||
218 | unsigned long faddr; /* fault address */ | ||
219 | unsigned long wb3a; /* write back 3 address */ | ||
220 | unsigned long wb3d; /* write back 3 data */ | ||
221 | unsigned long wb2a; /* write back 2 address */ | ||
222 | unsigned long wb2d; /* write back 2 data */ | ||
223 | unsigned long wb1a; /* write back 1 address */ | ||
224 | unsigned long wb1dpd0; /* write back 1 data/push data 0*/ | ||
225 | unsigned long pd1; /* push data 1*/ | ||
226 | unsigned long pd2; /* push data 2*/ | ||
227 | unsigned long pd3; /* push data 3*/ | ||
228 | } fmt7; | ||
229 | struct { | ||
230 | unsigned long iaddr; /* instruction address */ | ||
231 | unsigned short int1[4]; /* internal registers */ | ||
232 | } fmt9; | ||
233 | struct { | ||
234 | unsigned short int1; | ||
235 | unsigned short ssw; /* special status word */ | ||
236 | unsigned short isc; /* instruction stage c */ | ||
237 | unsigned short isb; /* instruction stage b */ | ||
238 | unsigned long daddr; /* data cycle fault address */ | ||
239 | unsigned short int2[2]; | ||
240 | unsigned long dobuf; /* data cycle output buffer */ | ||
241 | unsigned short int3[2]; | ||
242 | } fmta; | ||
243 | struct { | ||
244 | unsigned short int1; | ||
245 | unsigned short ssw; /* special status word */ | ||
246 | unsigned short isc; /* instruction stage c */ | ||
247 | unsigned short isb; /* instruction stage b */ | ||
248 | unsigned long daddr; /* data cycle fault address */ | ||
249 | unsigned short int2[2]; | ||
250 | unsigned long dobuf; /* data cycle output buffer */ | ||
251 | unsigned short int3[4]; | ||
252 | unsigned long baddr; /* stage B address */ | ||
253 | unsigned short int4[2]; | ||
254 | unsigned long dibuf; /* data cycle input buffer */ | ||
255 | unsigned short int5[3]; | ||
256 | unsigned ver : 4; /* stack frame version # */ | ||
257 | unsigned int6:12; | ||
258 | unsigned short int7[18]; | ||
259 | } fmtb; | ||
260 | } un; | ||
261 | }; | ||
262 | |||
263 | #endif /* __ASSEMBLY__ */ | ||
264 | |||
265 | #endif /* _M68K_TRAPS_H */ | ||
diff --git a/include/asm-m68k/types.h b/include/asm-m68k/types.h new file mode 100644 index 000000000000..f391cbe39b96 --- /dev/null +++ b/include/asm-m68k/types.h | |||
@@ -0,0 +1,69 @@ | |||
1 | #ifndef _M68K_TYPES_H | ||
2 | #define _M68K_TYPES_H | ||
3 | |||
4 | /* | ||
5 | * This file is never included by application software unless | ||
6 | * explicitly requested (e.g., via linux/types.h) in which case the | ||
7 | * application is Linux specific so (user-) name space pollution is | ||
8 | * not a major issue. However, for interoperability, libraries still | ||
9 | * need to be careful to avoid a name clashes. | ||
10 | */ | ||
11 | |||
12 | #ifndef __ASSEMBLY__ | ||
13 | |||
14 | typedef unsigned short umode_t; | ||
15 | |||
16 | /* | ||
17 | * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the | ||
18 | * header files exported to user space | ||
19 | */ | ||
20 | |||
21 | typedef __signed__ char __s8; | ||
22 | typedef unsigned char __u8; | ||
23 | |||
24 | typedef __signed__ short __s16; | ||
25 | typedef unsigned short __u16; | ||
26 | |||
27 | typedef __signed__ int __s32; | ||
28 | typedef unsigned int __u32; | ||
29 | |||
30 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) | ||
31 | typedef __signed__ long long __s64; | ||
32 | typedef unsigned long long __u64; | ||
33 | #endif | ||
34 | |||
35 | #endif /* __ASSEMBLY__ */ | ||
36 | |||
37 | /* | ||
38 | * These aren't exported outside the kernel to avoid name space clashes | ||
39 | */ | ||
40 | #ifdef __KERNEL__ | ||
41 | |||
42 | #define BITS_PER_LONG 32 | ||
43 | |||
44 | #ifndef __ASSEMBLY__ | ||
45 | |||
46 | typedef signed char s8; | ||
47 | typedef unsigned char u8; | ||
48 | |||
49 | typedef signed short s16; | ||
50 | typedef unsigned short u16; | ||
51 | |||
52 | typedef signed int s32; | ||
53 | typedef unsigned int u32; | ||
54 | |||
55 | typedef signed long long s64; | ||
56 | typedef unsigned long long u64; | ||
57 | |||
58 | /* DMA addresses are always 32-bits wide */ | ||
59 | |||
60 | typedef u32 dma_addr_t; | ||
61 | typedef u32 dma64_addr_t; | ||
62 | |||
63 | typedef unsigned short kmem_bufctl_t; | ||
64 | |||
65 | #endif /* __ASSEMBLY__ */ | ||
66 | |||
67 | #endif /* __KERNEL__ */ | ||
68 | |||
69 | #endif /* _M68K_TYPES_H */ | ||
diff --git a/include/asm-m68k/uaccess.h b/include/asm-m68k/uaccess.h new file mode 100644 index 000000000000..605e6cb811f8 --- /dev/null +++ b/include/asm-m68k/uaccess.h | |||
@@ -0,0 +1,893 @@ | |||
1 | #ifndef __M68K_UACCESS_H | ||
2 | #define __M68K_UACCESS_H | ||
3 | |||
4 | /* | ||
5 | * User space memory access functions | ||
6 | */ | ||
7 | #include <linux/errno.h> | ||
8 | #include <linux/sched.h> | ||
9 | #include <asm/segment.h> | ||
10 | |||
11 | #define VERIFY_READ 0 | ||
12 | #define VERIFY_WRITE 1 | ||
13 | |||
14 | /* We let the MMU do all checking */ | ||
15 | #define access_ok(type,addr,size) 1 | ||
16 | |||
17 | /* this function will go away soon - use access_ok() instead */ | ||
18 | static inline int __deprecated verify_area(int type, const void *addr, unsigned long size) | ||
19 | { | ||
20 | return access_ok(type,addr,size) ? 0 : -EFAULT; | ||
21 | } | ||
22 | |||
23 | /* | ||
24 | * The exception table consists of pairs of addresses: the first is the | ||
25 | * address of an instruction that is allowed to fault, and the second is | ||
26 | * the address at which the program should continue. No registers are | ||
27 | * modified, so it is entirely up to the continuation code to figure out | ||
28 | * what to do. | ||
29 | * | ||
30 | * All the routines below use bits of fixup code that are out of line | ||
31 | * with the main instruction path. This means when everything is well, | ||
32 | * we don't even have to jump over them. Further, they do not intrude | ||
33 | * on our cache or tlb entries. | ||
34 | */ | ||
35 | |||
36 | struct exception_table_entry | ||
37 | { | ||
38 | unsigned long insn, fixup; | ||
39 | }; | ||
40 | |||
41 | |||
42 | /* | ||
43 | * These are the main single-value transfer routines. They automatically | ||
44 | * use the right size if we just have the right pointer type. | ||
45 | */ | ||
46 | |||
47 | #define put_user(x, ptr) \ | ||
48 | ({ \ | ||
49 | int __pu_err; \ | ||
50 | typeof(*(ptr)) __pu_val = (x); \ | ||
51 | switch (sizeof (*(ptr))) { \ | ||
52 | case 1: \ | ||
53 | __put_user_asm(__pu_err, __pu_val, ptr, b); \ | ||
54 | break; \ | ||
55 | case 2: \ | ||
56 | __put_user_asm(__pu_err, __pu_val, ptr, w); \ | ||
57 | break; \ | ||
58 | case 4: \ | ||
59 | __put_user_asm(__pu_err, __pu_val, ptr, l); \ | ||
60 | break; \ | ||
61 | case 8: \ | ||
62 | __pu_err = __constant_copy_to_user(ptr, &__pu_val, 8); \ | ||
63 | break; \ | ||
64 | default: \ | ||
65 | __pu_err = __put_user_bad(); \ | ||
66 | break; \ | ||
67 | } \ | ||
68 | __pu_err; \ | ||
69 | }) | ||
70 | #define __put_user(x, ptr) put_user(x, ptr) | ||
71 | |||
72 | extern int __put_user_bad(void); | ||
73 | |||
74 | /* | ||
75 | * Tell gcc we read from memory instead of writing: this is because | ||
76 | * we do not write to any memory gcc knows about, so there are no | ||
77 | * aliasing issues. | ||
78 | */ | ||
79 | #define __put_user_asm(err,x,ptr,bwl) \ | ||
80 | __asm__ __volatile__ \ | ||
81 | ("21:moves" #bwl " %2,%1\n" \ | ||
82 | "1:\n" \ | ||
83 | ".section .fixup,\"ax\"\n" \ | ||
84 | " .even\n" \ | ||
85 | "2: movel %3,%0\n" \ | ||
86 | " jra 1b\n" \ | ||
87 | ".previous\n" \ | ||
88 | ".section __ex_table,\"a\"\n" \ | ||
89 | " .align 4\n" \ | ||
90 | " .long 21b,2b\n" \ | ||
91 | " .long 1b,2b\n" \ | ||
92 | ".previous" \ | ||
93 | : "=d"(err) \ | ||
94 | : "m"(*(ptr)), "r"(x), "i"(-EFAULT), "0"(0)) | ||
95 | |||
96 | #define get_user(x, ptr) \ | ||
97 | ({ \ | ||
98 | int __gu_err; \ | ||
99 | typeof(*(ptr)) __gu_val; \ | ||
100 | switch (sizeof(*(ptr))) { \ | ||
101 | case 1: \ | ||
102 | __get_user_asm(__gu_err, __gu_val, ptr, b, "=d"); \ | ||
103 | break; \ | ||
104 | case 2: \ | ||
105 | __get_user_asm(__gu_err, __gu_val, ptr, w, "=r"); \ | ||
106 | break; \ | ||
107 | case 4: \ | ||
108 | __get_user_asm(__gu_err, __gu_val, ptr, l, "=r"); \ | ||
109 | break; \ | ||
110 | case 8: \ | ||
111 | __gu_err = __constant_copy_from_user(&__gu_val, ptr, 8); \ | ||
112 | break; \ | ||
113 | default: \ | ||
114 | __gu_val = 0; \ | ||
115 | __gu_err = __get_user_bad(); \ | ||
116 | break; \ | ||
117 | } \ | ||
118 | (x) = __gu_val; \ | ||
119 | __gu_err; \ | ||
120 | }) | ||
121 | #define __get_user(x, ptr) get_user(x, ptr) | ||
122 | |||
123 | extern int __get_user_bad(void); | ||
124 | |||
125 | #define __get_user_asm(err,x,ptr,bwl,reg) \ | ||
126 | __asm__ __volatile__ \ | ||
127 | ("1: moves" #bwl " %2,%1\n" \ | ||
128 | "2:\n" \ | ||
129 | ".section .fixup,\"ax\"\n" \ | ||
130 | " .even\n" \ | ||
131 | "3: movel %3,%0\n" \ | ||
132 | " sub" #bwl " %1,%1\n" \ | ||
133 | " jra 2b\n" \ | ||
134 | ".previous\n" \ | ||
135 | ".section __ex_table,\"a\"\n" \ | ||
136 | " .align 4\n" \ | ||
137 | " .long 1b,3b\n" \ | ||
138 | ".previous" \ | ||
139 | : "=d"(err), reg(x) \ | ||
140 | : "m"(*(ptr)), "i" (-EFAULT), "0"(0)) | ||
141 | |||
142 | static inline unsigned long | ||
143 | __generic_copy_from_user(void *to, const void *from, unsigned long n) | ||
144 | { | ||
145 | unsigned long tmp; | ||
146 | __asm__ __volatile__ | ||
147 | (" tstl %2\n" | ||
148 | " jeq 2f\n" | ||
149 | "1: movesl (%1)+,%3\n" | ||
150 | " movel %3,(%0)+\n" | ||
151 | " subql #1,%2\n" | ||
152 | " jne 1b\n" | ||
153 | "2: movel %4,%2\n" | ||
154 | " bclr #1,%2\n" | ||
155 | " jeq 4f\n" | ||
156 | "3: movesw (%1)+,%3\n" | ||
157 | " movew %3,(%0)+\n" | ||
158 | "4: bclr #0,%2\n" | ||
159 | " jeq 6f\n" | ||
160 | "5: movesb (%1)+,%3\n" | ||
161 | " moveb %3,(%0)+\n" | ||
162 | "6:\n" | ||
163 | ".section .fixup,\"ax\"\n" | ||
164 | " .even\n" | ||
165 | "7: movel %2,%%d0\n" | ||
166 | "71:clrl (%0)+\n" | ||
167 | " subql #1,%%d0\n" | ||
168 | " jne 71b\n" | ||
169 | " lsll #2,%2\n" | ||
170 | " addl %4,%2\n" | ||
171 | " btst #1,%4\n" | ||
172 | " jne 81f\n" | ||
173 | " btst #0,%4\n" | ||
174 | " jne 91f\n" | ||
175 | " jra 6b\n" | ||
176 | "8: addql #2,%2\n" | ||
177 | "81:clrw (%0)+\n" | ||
178 | " btst #0,%4\n" | ||
179 | " jne 91f\n" | ||
180 | " jra 6b\n" | ||
181 | "9: addql #1,%2\n" | ||
182 | "91:clrb (%0)+\n" | ||
183 | " jra 6b\n" | ||
184 | ".previous\n" | ||
185 | ".section __ex_table,\"a\"\n" | ||
186 | " .align 4\n" | ||
187 | " .long 1b,7b\n" | ||
188 | " .long 3b,8b\n" | ||
189 | " .long 5b,9b\n" | ||
190 | ".previous" | ||
191 | : "=a"(to), "=a"(from), "=d"(n), "=&d"(tmp) | ||
192 | : "d"(n & 3), "0"(to), "1"(from), "2"(n/4) | ||
193 | : "d0", "memory"); | ||
194 | return n; | ||
195 | } | ||
196 | |||
197 | static inline unsigned long | ||
198 | __generic_copy_to_user(void *to, const void *from, unsigned long n) | ||
199 | { | ||
200 | unsigned long tmp; | ||
201 | __asm__ __volatile__ | ||
202 | (" tstl %2\n" | ||
203 | " jeq 3f\n" | ||
204 | "1: movel (%1)+,%3\n" | ||
205 | "22:movesl %3,(%0)+\n" | ||
206 | "2: subql #1,%2\n" | ||
207 | " jne 1b\n" | ||
208 | "3: movel %4,%2\n" | ||
209 | " bclr #1,%2\n" | ||
210 | " jeq 4f\n" | ||
211 | " movew (%1)+,%3\n" | ||
212 | "24:movesw %3,(%0)+\n" | ||
213 | "4: bclr #0,%2\n" | ||
214 | " jeq 5f\n" | ||
215 | " moveb (%1)+,%3\n" | ||
216 | "25:movesb %3,(%0)+\n" | ||
217 | "5:\n" | ||
218 | ".section .fixup,\"ax\"\n" | ||
219 | " .even\n" | ||
220 | "60:addql #1,%2\n" | ||
221 | "6: lsll #2,%2\n" | ||
222 | " addl %4,%2\n" | ||
223 | " jra 5b\n" | ||
224 | "7: addql #2,%2\n" | ||
225 | " jra 5b\n" | ||
226 | "8: addql #1,%2\n" | ||
227 | " jra 5b\n" | ||
228 | ".previous\n" | ||
229 | ".section __ex_table,\"a\"\n" | ||
230 | " .align 4\n" | ||
231 | " .long 1b,60b\n" | ||
232 | " .long 22b,6b\n" | ||
233 | " .long 2b,6b\n" | ||
234 | " .long 24b,7b\n" | ||
235 | " .long 3b,60b\n" | ||
236 | " .long 4b,7b\n" | ||
237 | " .long 25b,8b\n" | ||
238 | " .long 5b,8b\n" | ||
239 | ".previous" | ||
240 | : "=a"(to), "=a"(from), "=d"(n), "=&d"(tmp) | ||
241 | : "r"(n & 3), "0"(to), "1"(from), "2"(n / 4) | ||
242 | : "memory"); | ||
243 | return n; | ||
244 | } | ||
245 | |||
246 | #define __copy_from_user_big(to, from, n, fixup, copy) \ | ||
247 | __asm__ __volatile__ \ | ||
248 | ("10: movesl (%1)+,%%d0\n" \ | ||
249 | " movel %%d0,(%0)+\n" \ | ||
250 | " subql #1,%2\n" \ | ||
251 | " jne 10b\n" \ | ||
252 | ".section .fixup,\"ax\"\n" \ | ||
253 | " .even\n" \ | ||
254 | "11: movel %2,%%d0\n" \ | ||
255 | "13: clrl (%0)+\n" \ | ||
256 | " subql #1,%%d0\n" \ | ||
257 | " jne 13b\n" \ | ||
258 | " lsll #2,%2\n" \ | ||
259 | fixup "\n" \ | ||
260 | " jra 12f\n" \ | ||
261 | ".previous\n" \ | ||
262 | ".section __ex_table,\"a\"\n" \ | ||
263 | " .align 4\n" \ | ||
264 | " .long 10b,11b\n" \ | ||
265 | ".previous\n" \ | ||
266 | copy "\n" \ | ||
267 | "12:" \ | ||
268 | : "=a"(to), "=a"(from), "=d"(n) \ | ||
269 | : "0"(to), "1"(from), "2"(n/4) \ | ||
270 | : "d0", "memory") | ||
271 | |||
272 | static inline unsigned long | ||
273 | __constant_copy_from_user(void *to, const void *from, unsigned long n) | ||
274 | { | ||
275 | switch (n) { | ||
276 | case 0: | ||
277 | break; | ||
278 | case 1: | ||
279 | __asm__ __volatile__ | ||
280 | ("1: movesb (%1)+,%%d0\n" | ||
281 | " moveb %%d0,(%0)+\n" | ||
282 | "2:\n" | ||
283 | ".section .fixup,\"ax\"\n" | ||
284 | " .even\n" | ||
285 | "3: addql #1,%2\n" | ||
286 | " clrb (%0)+\n" | ||
287 | " jra 2b\n" | ||
288 | ".previous\n" | ||
289 | ".section __ex_table,\"a\"\n" | ||
290 | " .align 4\n" | ||
291 | " .long 1b,3b\n" | ||
292 | ".previous" | ||
293 | : "=a"(to), "=a"(from), "=d"(n) | ||
294 | : "0"(to), "1"(from), "2"(0) | ||
295 | : "d0", "memory"); | ||
296 | break; | ||
297 | case 2: | ||
298 | __asm__ __volatile__ | ||
299 | ("1: movesw (%1)+,%%d0\n" | ||
300 | " movew %%d0,(%0)+\n" | ||
301 | "2:\n" | ||
302 | ".section .fixup,\"ax\"\n" | ||
303 | " .even\n" | ||
304 | "3: addql #2,%2\n" | ||
305 | " clrw (%0)+\n" | ||
306 | " jra 2b\n" | ||
307 | ".previous\n" | ||
308 | ".section __ex_table,\"a\"\n" | ||
309 | " .align 4\n" | ||
310 | " .long 1b,3b\n" | ||
311 | ".previous" | ||
312 | : "=a"(to), "=a"(from), "=d"(n) | ||
313 | : "0"(to), "1"(from), "2"(0) | ||
314 | : "d0", "memory"); | ||
315 | break; | ||
316 | case 3: | ||
317 | __asm__ __volatile__ | ||
318 | ("1: movesw (%1)+,%%d0\n" | ||
319 | " movew %%d0,(%0)+\n" | ||
320 | "2: movesb (%1)+,%%d0\n" | ||
321 | " moveb %%d0,(%0)+\n" | ||
322 | "3:" | ||
323 | ".section .fixup,\"ax\"\n" | ||
324 | " .even\n" | ||
325 | "4: addql #2,%2\n" | ||
326 | " clrw (%0)+\n" | ||
327 | "5: addql #1,%2\n" | ||
328 | " clrb (%0)+\n" | ||
329 | " jra 3b\n" | ||
330 | ".previous\n" | ||
331 | ".section __ex_table,\"a\"\n" | ||
332 | " .align 4\n" | ||
333 | " .long 1b,4b\n" | ||
334 | " .long 2b,5b\n" | ||
335 | ".previous" | ||
336 | : "=a"(to), "=a"(from), "=d"(n) | ||
337 | : "0"(to), "1"(from), "2"(0) | ||
338 | : "d0", "memory"); | ||
339 | break; | ||
340 | case 4: | ||
341 | __asm__ __volatile__ | ||
342 | ("1: movesl (%1)+,%%d0\n" | ||
343 | " movel %%d0,(%0)+\n" | ||
344 | "2:" | ||
345 | ".section .fixup,\"ax\"\n" | ||
346 | " .even\n" | ||
347 | "3: addql #4,%2\n" | ||
348 | " clrl (%0)+\n" | ||
349 | " jra 2b\n" | ||
350 | ".previous\n" | ||
351 | ".section __ex_table,\"a\"\n" | ||
352 | " .align 4\n" | ||
353 | " .long 1b,3b\n" | ||
354 | ".previous" | ||
355 | : "=a"(to), "=a"(from), "=d"(n) | ||
356 | : "0"(to), "1"(from), "2"(0) | ||
357 | : "d0", "memory"); | ||
358 | break; | ||
359 | case 8: | ||
360 | __asm__ __volatile__ | ||
361 | ("1: movesl (%1)+,%%d0\n" | ||
362 | " movel %%d0,(%0)+\n" | ||
363 | "2: movesl (%1)+,%%d0\n" | ||
364 | " movel %%d0,(%0)+\n" | ||
365 | "3:" | ||
366 | ".section .fixup,\"ax\"\n" | ||
367 | " .even\n" | ||
368 | "4: addql #4,%2\n" | ||
369 | " clrl (%0)+\n" | ||
370 | "5: addql #4,%2\n" | ||
371 | " clrl (%0)+\n" | ||
372 | " jra 3b\n" | ||
373 | ".previous\n" | ||
374 | ".section __ex_table,\"a\"\n" | ||
375 | " .align 4\n" | ||
376 | " .long 1b,4b\n" | ||
377 | " .long 2b,5b\n" | ||
378 | ".previous" | ||
379 | : "=a"(to), "=a"(from), "=d"(n) | ||
380 | : "0"(to), "1"(from), "2"(0) | ||
381 | : "d0", "memory"); | ||
382 | break; | ||
383 | case 12: | ||
384 | __asm__ __volatile__ | ||
385 | ("1: movesl (%1)+,%%d0\n" | ||
386 | " movel %%d0,(%0)+\n" | ||
387 | "2: movesl (%1)+,%%d0\n" | ||
388 | " movel %%d0,(%0)+\n" | ||
389 | "3: movesl (%1)+,%%d0\n" | ||
390 | " movel %%d0,(%0)+\n" | ||
391 | "4:" | ||
392 | ".section .fixup,\"ax\"\n" | ||
393 | " .even\n" | ||
394 | "5: addql #4,%2\n" | ||
395 | " clrl (%0)+\n" | ||
396 | "6: addql #4,%2\n" | ||
397 | " clrl (%0)+\n" | ||
398 | "7: addql #4,%2\n" | ||
399 | " clrl (%0)+\n" | ||
400 | " jra 4b\n" | ||
401 | ".previous\n" | ||
402 | ".section __ex_table,\"a\"\n" | ||
403 | " .align 4\n" | ||
404 | " .long 1b,5b\n" | ||
405 | " .long 2b,6b\n" | ||
406 | " .long 3b,7b\n" | ||
407 | ".previous" | ||
408 | : "=a"(to), "=a"(from), "=d"(n) | ||
409 | : "0"(to), "1"(from), "2"(0) | ||
410 | : "d0", "memory"); | ||
411 | break; | ||
412 | case 16: | ||
413 | __asm__ __volatile__ | ||
414 | ("1: movesl (%1)+,%%d0\n" | ||
415 | " movel %%d0,(%0)+\n" | ||
416 | "2: movesl (%1)+,%%d0\n" | ||
417 | " movel %%d0,(%0)+\n" | ||
418 | "3: movesl (%1)+,%%d0\n" | ||
419 | " movel %%d0,(%0)+\n" | ||
420 | "4: movesl (%1)+,%%d0\n" | ||
421 | " movel %%d0,(%0)+\n" | ||
422 | "5:" | ||
423 | ".section .fixup,\"ax\"\n" | ||
424 | " .even\n" | ||
425 | "6: addql #4,%2\n" | ||
426 | " clrl (%0)+\n" | ||
427 | "7: addql #4,%2\n" | ||
428 | " clrl (%0)+\n" | ||
429 | "8: addql #4,%2\n" | ||
430 | " clrl (%0)+\n" | ||
431 | "9: addql #4,%2\n" | ||
432 | " clrl (%0)+\n" | ||
433 | " jra 5b\n" | ||
434 | ".previous\n" | ||
435 | ".section __ex_table,\"a\"\n" | ||
436 | " .align 4\n" | ||
437 | " .long 1b,6b\n" | ||
438 | " .long 2b,7b\n" | ||
439 | " .long 3b,8b\n" | ||
440 | " .long 4b,9b\n" | ||
441 | ".previous" | ||
442 | : "=a"(to), "=a"(from), "=d"(n) | ||
443 | : "0"(to), "1"(from), "2"(0) | ||
444 | : "d0", "memory"); | ||
445 | break; | ||
446 | default: | ||
447 | switch (n & 3) { | ||
448 | case 0: | ||
449 | __copy_from_user_big(to, from, n, "", ""); | ||
450 | break; | ||
451 | case 1: | ||
452 | __copy_from_user_big(to, from, n, | ||
453 | /* fixup */ | ||
454 | "1: addql #1,%2\n" | ||
455 | " clrb (%0)+", | ||
456 | /* copy */ | ||
457 | "2: movesb (%1)+,%%d0\n" | ||
458 | " moveb %%d0,(%0)+\n" | ||
459 | ".section __ex_table,\"a\"\n" | ||
460 | " .long 2b,1b\n" | ||
461 | ".previous"); | ||
462 | break; | ||
463 | case 2: | ||
464 | __copy_from_user_big(to, from, n, | ||
465 | /* fixup */ | ||
466 | "1: addql #2,%2\n" | ||
467 | " clrw (%0)+", | ||
468 | /* copy */ | ||
469 | "2: movesw (%1)+,%%d0\n" | ||
470 | " movew %%d0,(%0)+\n" | ||
471 | ".section __ex_table,\"a\"\n" | ||
472 | " .long 2b,1b\n" | ||
473 | ".previous"); | ||
474 | break; | ||
475 | case 3: | ||
476 | __copy_from_user_big(to, from, n, | ||
477 | /* fixup */ | ||
478 | "1: addql #2,%2\n" | ||
479 | " clrw (%0)+\n" | ||
480 | "2: addql #1,%2\n" | ||
481 | " clrb (%0)+", | ||
482 | /* copy */ | ||
483 | "3: movesw (%1)+,%%d0\n" | ||
484 | " movew %%d0,(%0)+\n" | ||
485 | "4: movesb (%1)+,%%d0\n" | ||
486 | " moveb %%d0,(%0)+\n" | ||
487 | ".section __ex_table,\"a\"\n" | ||
488 | " .long 3b,1b\n" | ||
489 | " .long 4b,2b\n" | ||
490 | ".previous"); | ||
491 | break; | ||
492 | } | ||
493 | break; | ||
494 | } | ||
495 | return n; | ||
496 | } | ||
497 | |||
498 | #define __copy_to_user_big(to, from, n, fixup, copy) \ | ||
499 | __asm__ __volatile__ \ | ||
500 | ("10: movel (%1)+,%%d0\n" \ | ||
501 | "31: movesl %%d0,(%0)+\n" \ | ||
502 | "11: subql #1,%2\n" \ | ||
503 | " jne 10b\n" \ | ||
504 | "41:\n" \ | ||
505 | ".section .fixup,\"ax\"\n" \ | ||
506 | " .even\n" \ | ||
507 | "22: addql #1,%2\n" \ | ||
508 | "12: lsll #2,%2\n" \ | ||
509 | fixup "\n" \ | ||
510 | " jra 13f\n" \ | ||
511 | ".previous\n" \ | ||
512 | ".section __ex_table,\"a\"\n" \ | ||
513 | " .align 4\n" \ | ||
514 | " .long 10b,22b\n" \ | ||
515 | " .long 31b,12b\n" \ | ||
516 | " .long 11b,12b\n" \ | ||
517 | " .long 41b,22b\n" \ | ||
518 | ".previous\n" \ | ||
519 | copy "\n" \ | ||
520 | "13:" \ | ||
521 | : "=a"(to), "=a"(from), "=d"(n) \ | ||
522 | : "0"(to), "1"(from), "2"(n/4) \ | ||
523 | : "d0", "memory") | ||
524 | |||
525 | #define __copy_to_user_inatomic __copy_to_user | ||
526 | #define __copy_from_user_inatomic __copy_from_user | ||
527 | |||
528 | static inline unsigned long | ||
529 | __constant_copy_to_user(void *to, const void *from, unsigned long n) | ||
530 | { | ||
531 | switch (n) { | ||
532 | case 0: | ||
533 | break; | ||
534 | case 1: | ||
535 | __asm__ __volatile__ | ||
536 | (" moveb (%1)+,%%d0\n" | ||
537 | "21:movesb %%d0,(%0)+\n" | ||
538 | "1:\n" | ||
539 | ".section .fixup,\"ax\"\n" | ||
540 | " .even\n" | ||
541 | "2: addql #1,%2\n" | ||
542 | " jra 1b\n" | ||
543 | ".previous\n" | ||
544 | ".section __ex_table,\"a\"\n" | ||
545 | " .align 4\n " | ||
546 | " .long 21b,2b\n" | ||
547 | " .long 1b,2b\n" | ||
548 | ".previous" | ||
549 | : "=a"(to), "=a"(from), "=d"(n) | ||
550 | : "0"(to), "1"(from), "2"(0) | ||
551 | : "d0", "memory"); | ||
552 | break; | ||
553 | case 2: | ||
554 | __asm__ __volatile__ | ||
555 | (" movew (%1)+,%%d0\n" | ||
556 | "21:movesw %%d0,(%0)+\n" | ||
557 | "1:\n" | ||
558 | ".section .fixup,\"ax\"\n" | ||
559 | " .even\n" | ||
560 | "2: addql #2,%2\n" | ||
561 | " jra 1b\n" | ||
562 | ".previous\n" | ||
563 | ".section __ex_table,\"a\"\n" | ||
564 | " .align 4\n" | ||
565 | " .long 21b,2b\n" | ||
566 | " .long 1b,2b\n" | ||
567 | ".previous" | ||
568 | : "=a"(to), "=a"(from), "=d"(n) | ||
569 | : "0"(to), "1"(from), "2"(0) | ||
570 | : "d0", "memory"); | ||
571 | break; | ||
572 | case 3: | ||
573 | __asm__ __volatile__ | ||
574 | (" movew (%1)+,%%d0\n" | ||
575 | "21:movesw %%d0,(%0)+\n" | ||
576 | "1: moveb (%1)+,%%d0\n" | ||
577 | "22:movesb %%d0,(%0)+\n" | ||
578 | "2:\n" | ||
579 | ".section .fixup,\"ax\"\n" | ||
580 | " .even\n" | ||
581 | "3: addql #2,%2\n" | ||
582 | "4: addql #1,%2\n" | ||
583 | " jra 2b\n" | ||
584 | ".previous\n" | ||
585 | ".section __ex_table,\"a\"\n" | ||
586 | " .align 4\n" | ||
587 | " .long 21b,3b\n" | ||
588 | " .long 1b,3b\n" | ||
589 | " .long 22b,4b\n" | ||
590 | " .long 2b,4b\n" | ||
591 | ".previous" | ||
592 | : "=a"(to), "=a"(from), "=d"(n) | ||
593 | : "0"(to), "1"(from), "2"(0) | ||
594 | : "d0", "memory"); | ||
595 | break; | ||
596 | case 4: | ||
597 | __asm__ __volatile__ | ||
598 | (" movel (%1)+,%%d0\n" | ||
599 | "21:movesl %%d0,(%0)+\n" | ||
600 | "1:\n" | ||
601 | ".section .fixup,\"ax\"\n" | ||
602 | " .even\n" | ||
603 | "2: addql #4,%2\n" | ||
604 | " jra 1b\n" | ||
605 | ".previous\n" | ||
606 | ".section __ex_table,\"a\"\n" | ||
607 | " .align 4\n" | ||
608 | " .long 21b,2b\n" | ||
609 | " .long 1b,2b\n" | ||
610 | ".previous" | ||
611 | : "=a"(to), "=a"(from), "=d"(n) | ||
612 | : "0"(to), "1"(from), "2"(0) | ||
613 | : "d0", "memory"); | ||
614 | break; | ||
615 | case 8: | ||
616 | __asm__ __volatile__ | ||
617 | (" movel (%1)+,%%d0\n" | ||
618 | "21:movesl %%d0,(%0)+\n" | ||
619 | "1: movel (%1)+,%%d0\n" | ||
620 | "22:movesl %%d0,(%0)+\n" | ||
621 | "2:\n" | ||
622 | ".section .fixup,\"ax\"\n" | ||
623 | " .even\n" | ||
624 | "3: addql #4,%2\n" | ||
625 | "4: addql #4,%2\n" | ||
626 | " jra 2b\n" | ||
627 | ".previous\n" | ||
628 | ".section __ex_table,\"a\"\n" | ||
629 | " .align 4\n" | ||
630 | " .long 21b,3b\n" | ||
631 | " .long 1b,3b\n" | ||
632 | " .long 22b,4b\n" | ||
633 | " .long 2b,4b\n" | ||
634 | ".previous" | ||
635 | : "=a"(to), "=a"(from), "=d"(n) | ||
636 | : "0"(to), "1"(from), "2"(0) | ||
637 | : "d0", "memory"); | ||
638 | break; | ||
639 | case 12: | ||
640 | __asm__ __volatile__ | ||
641 | (" movel (%1)+,%%d0\n" | ||
642 | "21:movesl %%d0,(%0)+\n" | ||
643 | "1: movel (%1)+,%%d0\n" | ||
644 | "22:movesl %%d0,(%0)+\n" | ||
645 | "2: movel (%1)+,%%d0\n" | ||
646 | "23:movesl %%d0,(%0)+\n" | ||
647 | "3:\n" | ||
648 | ".section .fixup,\"ax\"\n" | ||
649 | " .even\n" | ||
650 | "4: addql #4,%2\n" | ||
651 | "5: addql #4,%2\n" | ||
652 | "6: addql #4,%2\n" | ||
653 | " jra 3b\n" | ||
654 | ".previous\n" | ||
655 | ".section __ex_table,\"a\"\n" | ||
656 | " .align 4\n" | ||
657 | " .long 21b,4b\n" | ||
658 | " .long 1b,4b\n" | ||
659 | " .long 22b,5b\n" | ||
660 | " .long 2b,5b\n" | ||
661 | " .long 23b,6b\n" | ||
662 | " .long 3b,6b\n" | ||
663 | ".previous" | ||
664 | : "=a"(to), "=a"(from), "=d"(n) | ||
665 | : "0"(to), "1"(from), "2"(0) | ||
666 | : "d0", "memory"); | ||
667 | break; | ||
668 | case 16: | ||
669 | __asm__ __volatile__ | ||
670 | (" movel (%1)+,%%d0\n" | ||
671 | "21:movesl %%d0,(%0)+\n" | ||
672 | "1: movel (%1)+,%%d0\n" | ||
673 | "22:movesl %%d0,(%0)+\n" | ||
674 | "2: movel (%1)+,%%d0\n" | ||
675 | "23:movesl %%d0,(%0)+\n" | ||
676 | "3: movel (%1)+,%%d0\n" | ||
677 | "24:movesl %%d0,(%0)+\n" | ||
678 | "4:" | ||
679 | ".section .fixup,\"ax\"\n" | ||
680 | " .even\n" | ||
681 | "5: addql #4,%2\n" | ||
682 | "6: addql #4,%2\n" | ||
683 | "7: addql #4,%2\n" | ||
684 | "8: addql #4,%2\n" | ||
685 | " jra 4b\n" | ||
686 | ".previous\n" | ||
687 | ".section __ex_table,\"a\"\n" | ||
688 | " .align 4\n" | ||
689 | " .long 21b,5b\n" | ||
690 | " .long 1b,5b\n" | ||
691 | " .long 22b,6b\n" | ||
692 | " .long 2b,6b\n" | ||
693 | " .long 23b,7b\n" | ||
694 | " .long 3b,7b\n" | ||
695 | " .long 24b,8b\n" | ||
696 | " .long 4b,8b\n" | ||
697 | ".previous" | ||
698 | : "=a"(to), "=a"(from), "=d"(n) | ||
699 | : "0"(to), "1"(from), "2"(0) | ||
700 | : "d0", "memory"); | ||
701 | break; | ||
702 | default: | ||
703 | switch (n & 3) { | ||
704 | case 0: | ||
705 | __copy_to_user_big(to, from, n, "", ""); | ||
706 | break; | ||
707 | case 1: | ||
708 | __copy_to_user_big(to, from, n, | ||
709 | /* fixup */ | ||
710 | "1: addql #1,%2", | ||
711 | /* copy */ | ||
712 | " moveb (%1)+,%%d0\n" | ||
713 | "22:movesb %%d0,(%0)+\n" | ||
714 | "2:" | ||
715 | ".section __ex_table,\"a\"\n" | ||
716 | " .long 22b,1b\n" | ||
717 | " .long 2b,1b\n" | ||
718 | ".previous"); | ||
719 | break; | ||
720 | case 2: | ||
721 | __copy_to_user_big(to, from, n, | ||
722 | /* fixup */ | ||
723 | "1: addql #2,%2", | ||
724 | /* copy */ | ||
725 | " movew (%1)+,%%d0\n" | ||
726 | "22:movesw %%d0,(%0)+\n" | ||
727 | "2:" | ||
728 | ".section __ex_table,\"a\"\n" | ||
729 | " .long 22b,1b\n" | ||
730 | " .long 2b,1b\n" | ||
731 | ".previous"); | ||
732 | break; | ||
733 | case 3: | ||
734 | __copy_to_user_big(to, from, n, | ||
735 | /* fixup */ | ||
736 | "1: addql #2,%2\n" | ||
737 | "2: addql #1,%2", | ||
738 | /* copy */ | ||
739 | " movew (%1)+,%%d0\n" | ||
740 | "23:movesw %%d0,(%0)+\n" | ||
741 | "3: moveb (%1)+,%%d0\n" | ||
742 | "24:movesb %%d0,(%0)+\n" | ||
743 | "4:" | ||
744 | ".section __ex_table,\"a\"\n" | ||
745 | " .long 23b,1b\n" | ||
746 | " .long 3b,1b\n" | ||
747 | " .long 24b,2b\n" | ||
748 | " .long 4b,2b\n" | ||
749 | ".previous"); | ||
750 | break; | ||
751 | } | ||
752 | break; | ||
753 | } | ||
754 | return n; | ||
755 | } | ||
756 | |||
757 | #define copy_from_user(to, from, n) \ | ||
758 | (__builtin_constant_p(n) ? \ | ||
759 | __constant_copy_from_user(to, from, n) : \ | ||
760 | __generic_copy_from_user(to, from, n)) | ||
761 | |||
762 | #define copy_to_user(to, from, n) \ | ||
763 | (__builtin_constant_p(n) ? \ | ||
764 | __constant_copy_to_user(to, from, n) : \ | ||
765 | __generic_copy_to_user(to, from, n)) | ||
766 | |||
767 | #define __copy_from_user(to, from, n) copy_from_user(to, from, n) | ||
768 | #define __copy_to_user(to, from, n) copy_to_user(to, from, n) | ||
769 | |||
770 | /* | ||
771 | * Copy a null terminated string from userspace. | ||
772 | */ | ||
773 | |||
774 | static inline long | ||
775 | strncpy_from_user(char *dst, const char *src, long count) | ||
776 | { | ||
777 | long res; | ||
778 | if (count == 0) return count; | ||
779 | __asm__ __volatile__ | ||
780 | ("1: movesb (%2)+,%%d0\n" | ||
781 | "12:moveb %%d0,(%1)+\n" | ||
782 | " jeq 2f\n" | ||
783 | " subql #1,%3\n" | ||
784 | " jne 1b\n" | ||
785 | "2: subl %3,%0\n" | ||
786 | "3:\n" | ||
787 | ".section .fixup,\"ax\"\n" | ||
788 | " .even\n" | ||
789 | "4: movel %4,%0\n" | ||
790 | " jra 3b\n" | ||
791 | ".previous\n" | ||
792 | ".section __ex_table,\"a\"\n" | ||
793 | " .align 4\n" | ||
794 | " .long 1b,4b\n" | ||
795 | " .long 12b,4b\n" | ||
796 | ".previous" | ||
797 | : "=d"(res), "=a"(dst), "=a"(src), "=d"(count) | ||
798 | : "i"(-EFAULT), "0"(count), "1"(dst), "2"(src), "3"(count) | ||
799 | : "d0", "memory"); | ||
800 | return res; | ||
801 | } | ||
802 | |||
803 | /* | ||
804 | * Return the size of a string (including the ending 0) | ||
805 | * | ||
806 | * Return 0 on exception, a value greater than N if too long | ||
807 | */ | ||
808 | static inline long strnlen_user(const char *src, long n) | ||
809 | { | ||
810 | long res; | ||
811 | |||
812 | res = -(long)src; | ||
813 | __asm__ __volatile__ | ||
814 | ("1:\n" | ||
815 | " tstl %2\n" | ||
816 | " jeq 3f\n" | ||
817 | "2: movesb (%1)+,%%d0\n" | ||
818 | "22:\n" | ||
819 | " subql #1,%2\n" | ||
820 | " tstb %%d0\n" | ||
821 | " jne 1b\n" | ||
822 | " jra 4f\n" | ||
823 | "3:\n" | ||
824 | " addql #1,%0\n" | ||
825 | "4:\n" | ||
826 | " addl %1,%0\n" | ||
827 | "5:\n" | ||
828 | ".section .fixup,\"ax\"\n" | ||
829 | " .even\n" | ||
830 | "6: moveq %3,%0\n" | ||
831 | " jra 5b\n" | ||
832 | ".previous\n" | ||
833 | ".section __ex_table,\"a\"\n" | ||
834 | " .align 4\n" | ||
835 | " .long 2b,6b\n" | ||
836 | " .long 22b,6b\n" | ||
837 | ".previous" | ||
838 | : "=d"(res), "=a"(src), "=d"(n) | ||
839 | : "i"(0), "0"(res), "1"(src), "2"(n) | ||
840 | : "d0"); | ||
841 | return res; | ||
842 | } | ||
843 | |||
844 | #define strlen_user(str) strnlen_user(str, 32767) | ||
845 | |||
846 | /* | ||
847 | * Zero Userspace | ||
848 | */ | ||
849 | |||
850 | static inline unsigned long | ||
851 | clear_user(void *to, unsigned long n) | ||
852 | { | ||
853 | __asm__ __volatile__ | ||
854 | (" tstl %1\n" | ||
855 | " jeq 3f\n" | ||
856 | "1: movesl %3,(%0)+\n" | ||
857 | "2: subql #1,%1\n" | ||
858 | " jne 1b\n" | ||
859 | "3: movel %2,%1\n" | ||
860 | " bclr #1,%1\n" | ||
861 | " jeq 4f\n" | ||
862 | "24:movesw %3,(%0)+\n" | ||
863 | "4: bclr #0,%1\n" | ||
864 | " jeq 5f\n" | ||
865 | "25:movesb %3,(%0)+\n" | ||
866 | "5:\n" | ||
867 | ".section .fixup,\"ax\"\n" | ||
868 | " .even\n" | ||
869 | "61:addql #1,%1\n" | ||
870 | "6: lsll #2,%1\n" | ||
871 | " addl %2,%1\n" | ||
872 | " jra 5b\n" | ||
873 | "7: addql #2,%1\n" | ||
874 | " jra 5b\n" | ||
875 | "8: addql #1,%1\n" | ||
876 | " jra 5b\n" | ||
877 | ".previous\n" | ||
878 | ".section __ex_table,\"a\"\n" | ||
879 | " .align 4\n" | ||
880 | " .long 1b,61b\n" | ||
881 | " .long 2b,6b\n" | ||
882 | " .long 3b,61b\n" | ||
883 | " .long 24b,7b\n" | ||
884 | " .long 4b,7b\n" | ||
885 | " .long 25b,8b\n" | ||
886 | " .long 5b,8b\n" | ||
887 | ".previous" | ||
888 | : "=a"(to), "=d"(n) | ||
889 | : "r"(n & 3), "r"(0), "0"(to), "1"(n/4)); | ||
890 | return n; | ||
891 | } | ||
892 | |||
893 | #endif /* _M68K_UACCESS_H */ | ||
diff --git a/include/asm-m68k/ucontext.h b/include/asm-m68k/ucontext.h new file mode 100644 index 000000000000..e4e22669edc0 --- /dev/null +++ b/include/asm-m68k/ucontext.h | |||
@@ -0,0 +1,30 @@ | |||
1 | #ifndef _M68K_UCONTEXT_H | ||
2 | #define _M68K_UCONTEXT_H | ||
3 | |||
4 | typedef int greg_t; | ||
5 | #define NGREG 18 | ||
6 | typedef greg_t gregset_t[NGREG]; | ||
7 | |||
8 | typedef struct fpregset { | ||
9 | int f_fpcntl[3]; | ||
10 | int f_fpregs[8*3]; | ||
11 | } fpregset_t; | ||
12 | |||
13 | struct mcontext { | ||
14 | int version; | ||
15 | gregset_t gregs; | ||
16 | fpregset_t fpregs; | ||
17 | }; | ||
18 | |||
19 | #define MCONTEXT_VERSION 2 | ||
20 | |||
21 | struct ucontext { | ||
22 | unsigned long uc_flags; | ||
23 | struct ucontext *uc_link; | ||
24 | stack_t uc_stack; | ||
25 | struct mcontext uc_mcontext; | ||
26 | unsigned long uc_filler[80]; | ||
27 | sigset_t uc_sigmask; /* mask last for extensibility */ | ||
28 | }; | ||
29 | |||
30 | #endif | ||
diff --git a/include/asm-m68k/unaligned.h b/include/asm-m68k/unaligned.h new file mode 100644 index 000000000000..804cb3f888fe --- /dev/null +++ b/include/asm-m68k/unaligned.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef __M68K_UNALIGNED_H | ||
2 | #define __M68K_UNALIGNED_H | ||
3 | |||
4 | /* | ||
5 | * The m68k can do unaligned accesses itself. | ||
6 | * | ||
7 | * The strange macros are there to make sure these can't | ||
8 | * be misused in a way that makes them not work on other | ||
9 | * architectures where unaligned accesses aren't as simple. | ||
10 | */ | ||
11 | |||
12 | #define get_unaligned(ptr) (*(ptr)) | ||
13 | |||
14 | #define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) | ||
15 | |||
16 | #endif | ||
diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h new file mode 100644 index 000000000000..cbabde4f8a45 --- /dev/null +++ b/include/asm-m68k/unistd.h | |||
@@ -0,0 +1,465 @@ | |||
1 | #ifndef _ASM_M68K_UNISTD_H_ | ||
2 | #define _ASM_M68K_UNISTD_H_ | ||
3 | |||
4 | /* | ||
5 | * This file contains the system call numbers. | ||
6 | */ | ||
7 | |||
8 | #define __NR_exit 1 | ||
9 | #define __NR_fork 2 | ||
10 | #define __NR_read 3 | ||
11 | #define __NR_write 4 | ||
12 | #define __NR_open 5 | ||
13 | #define __NR_close 6 | ||
14 | #define __NR_waitpid 7 | ||
15 | #define __NR_creat 8 | ||
16 | #define __NR_link 9 | ||
17 | #define __NR_unlink 10 | ||
18 | #define __NR_execve 11 | ||
19 | #define __NR_chdir 12 | ||
20 | #define __NR_time 13 | ||
21 | #define __NR_mknod 14 | ||
22 | #define __NR_chmod 15 | ||
23 | #define __NR_chown 16 | ||
24 | #define __NR_break 17 | ||
25 | #define __NR_oldstat 18 | ||
26 | #define __NR_lseek 19 | ||
27 | #define __NR_getpid 20 | ||
28 | #define __NR_mount 21 | ||
29 | #define __NR_umount 22 | ||
30 | #define __NR_setuid 23 | ||
31 | #define __NR_getuid 24 | ||
32 | #define __NR_stime 25 | ||
33 | #define __NR_ptrace 26 | ||
34 | #define __NR_alarm 27 | ||
35 | #define __NR_oldfstat 28 | ||
36 | #define __NR_pause 29 | ||
37 | #define __NR_utime 30 | ||
38 | #define __NR_stty 31 | ||
39 | #define __NR_gtty 32 | ||
40 | #define __NR_access 33 | ||
41 | #define __NR_nice 34 | ||
42 | #define __NR_ftime 35 | ||
43 | #define __NR_sync 36 | ||
44 | #define __NR_kill 37 | ||
45 | #define __NR_rename 38 | ||
46 | #define __NR_mkdir 39 | ||
47 | #define __NR_rmdir 40 | ||
48 | #define __NR_dup 41 | ||
49 | #define __NR_pipe 42 | ||
50 | #define __NR_times 43 | ||
51 | #define __NR_prof 44 | ||
52 | #define __NR_brk 45 | ||
53 | #define __NR_setgid 46 | ||
54 | #define __NR_getgid 47 | ||
55 | #define __NR_signal 48 | ||
56 | #define __NR_geteuid 49 | ||
57 | #define __NR_getegid 50 | ||
58 | #define __NR_acct 51 | ||
59 | #define __NR_umount2 52 | ||
60 | #define __NR_lock 53 | ||
61 | #define __NR_ioctl 54 | ||
62 | #define __NR_fcntl 55 | ||
63 | #define __NR_mpx 56 | ||
64 | #define __NR_setpgid 57 | ||
65 | #define __NR_ulimit 58 | ||
66 | #define __NR_oldolduname 59 | ||
67 | #define __NR_umask 60 | ||
68 | #define __NR_chroot 61 | ||
69 | #define __NR_ustat 62 | ||
70 | #define __NR_dup2 63 | ||
71 | #define __NR_getppid 64 | ||
72 | #define __NR_getpgrp 65 | ||
73 | #define __NR_setsid 66 | ||
74 | #define __NR_sigaction 67 | ||
75 | #define __NR_sgetmask 68 | ||
76 | #define __NR_ssetmask 69 | ||
77 | #define __NR_setreuid 70 | ||
78 | #define __NR_setregid 71 | ||
79 | #define __NR_sigsuspend 72 | ||
80 | #define __NR_sigpending 73 | ||
81 | #define __NR_sethostname 74 | ||
82 | #define __NR_setrlimit 75 | ||
83 | #define __NR_getrlimit 76 | ||
84 | #define __NR_getrusage 77 | ||
85 | #define __NR_gettimeofday 78 | ||
86 | #define __NR_settimeofday 79 | ||
87 | #define __NR_getgroups 80 | ||
88 | #define __NR_setgroups 81 | ||
89 | #define __NR_select 82 | ||
90 | #define __NR_symlink 83 | ||
91 | #define __NR_oldlstat 84 | ||
92 | #define __NR_readlink 85 | ||
93 | #define __NR_uselib 86 | ||
94 | #define __NR_swapon 87 | ||
95 | #define __NR_reboot 88 | ||
96 | #define __NR_readdir 89 | ||
97 | #define __NR_mmap 90 | ||
98 | #define __NR_munmap 91 | ||
99 | #define __NR_truncate 92 | ||
100 | #define __NR_ftruncate 93 | ||
101 | #define __NR_fchmod 94 | ||
102 | #define __NR_fchown 95 | ||
103 | #define __NR_getpriority 96 | ||
104 | #define __NR_setpriority 97 | ||
105 | #define __NR_profil 98 | ||
106 | #define __NR_statfs 99 | ||
107 | #define __NR_fstatfs 100 | ||
108 | #define __NR_ioperm 101 | ||
109 | #define __NR_socketcall 102 | ||
110 | #define __NR_syslog 103 | ||
111 | #define __NR_setitimer 104 | ||
112 | #define __NR_getitimer 105 | ||
113 | #define __NR_stat 106 | ||
114 | #define __NR_lstat 107 | ||
115 | #define __NR_fstat 108 | ||
116 | #define __NR_olduname 109 | ||
117 | #define __NR_iopl /* 110 */ not supported | ||
118 | #define __NR_vhangup 111 | ||
119 | #define __NR_idle /* 112 */ Obsolete | ||
120 | #define __NR_vm86 /* 113 */ not supported | ||
121 | #define __NR_wait4 114 | ||
122 | #define __NR_swapoff 115 | ||
123 | #define __NR_sysinfo 116 | ||
124 | #define __NR_ipc 117 | ||
125 | #define __NR_fsync 118 | ||
126 | #define __NR_sigreturn 119 | ||
127 | #define __NR_clone 120 | ||
128 | #define __NR_setdomainname 121 | ||
129 | #define __NR_uname 122 | ||
130 | #define __NR_cacheflush 123 | ||
131 | #define __NR_adjtimex 124 | ||
132 | #define __NR_mprotect 125 | ||
133 | #define __NR_sigprocmask 126 | ||
134 | #define __NR_create_module 127 | ||
135 | #define __NR_init_module 128 | ||
136 | #define __NR_delete_module 129 | ||
137 | #define __NR_get_kernel_syms 130 | ||
138 | #define __NR_quotactl 131 | ||
139 | #define __NR_getpgid 132 | ||
140 | #define __NR_fchdir 133 | ||
141 | #define __NR_bdflush 134 | ||
142 | #define __NR_sysfs 135 | ||
143 | #define __NR_personality 136 | ||
144 | #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ | ||
145 | #define __NR_setfsuid 138 | ||
146 | #define __NR_setfsgid 139 | ||
147 | #define __NR__llseek 140 | ||
148 | #define __NR_getdents 141 | ||
149 | #define __NR__newselect 142 | ||
150 | #define __NR_flock 143 | ||
151 | #define __NR_msync 144 | ||
152 | #define __NR_readv 145 | ||
153 | #define __NR_writev 146 | ||
154 | #define __NR_getsid 147 | ||
155 | #define __NR_fdatasync 148 | ||
156 | #define __NR__sysctl 149 | ||
157 | #define __NR_mlock 150 | ||
158 | #define __NR_munlock 151 | ||
159 | #define __NR_mlockall 152 | ||
160 | #define __NR_munlockall 153 | ||
161 | #define __NR_sched_setparam 154 | ||
162 | #define __NR_sched_getparam 155 | ||
163 | #define __NR_sched_setscheduler 156 | ||
164 | #define __NR_sched_getscheduler 157 | ||
165 | #define __NR_sched_yield 158 | ||
166 | #define __NR_sched_get_priority_max 159 | ||
167 | #define __NR_sched_get_priority_min 160 | ||
168 | #define __NR_sched_rr_get_interval 161 | ||
169 | #define __NR_nanosleep 162 | ||
170 | #define __NR_mremap 163 | ||
171 | #define __NR_setresuid 164 | ||
172 | #define __NR_getresuid 165 | ||
173 | #define __NR_getpagesize 166 | ||
174 | #define __NR_query_module 167 | ||
175 | #define __NR_poll 168 | ||
176 | #define __NR_nfsservctl 169 | ||
177 | #define __NR_setresgid 170 | ||
178 | #define __NR_getresgid 171 | ||
179 | #define __NR_prctl 172 | ||
180 | #define __NR_rt_sigreturn 173 | ||
181 | #define __NR_rt_sigaction 174 | ||
182 | #define __NR_rt_sigprocmask 175 | ||
183 | #define __NR_rt_sigpending 176 | ||
184 | #define __NR_rt_sigtimedwait 177 | ||
185 | #define __NR_rt_sigqueueinfo 178 | ||
186 | #define __NR_rt_sigsuspend 179 | ||
187 | #define __NR_pread64 180 | ||
188 | #define __NR_pwrite64 181 | ||
189 | #define __NR_lchown 182 | ||
190 | #define __NR_getcwd 183 | ||
191 | #define __NR_capget 184 | ||
192 | #define __NR_capset 185 | ||
193 | #define __NR_sigaltstack 186 | ||
194 | #define __NR_sendfile 187 | ||
195 | #define __NR_getpmsg 188 /* some people actually want streams */ | ||
196 | #define __NR_putpmsg 189 /* some people actually want streams */ | ||
197 | #define __NR_vfork 190 | ||
198 | #define __NR_ugetrlimit 191 | ||
199 | #define __NR_mmap2 192 | ||
200 | #define __NR_truncate64 193 | ||
201 | #define __NR_ftruncate64 194 | ||
202 | #define __NR_stat64 195 | ||
203 | #define __NR_lstat64 196 | ||
204 | #define __NR_fstat64 197 | ||
205 | #define __NR_chown32 198 | ||
206 | #define __NR_getuid32 199 | ||
207 | #define __NR_getgid32 200 | ||
208 | #define __NR_geteuid32 201 | ||
209 | #define __NR_getegid32 202 | ||
210 | #define __NR_setreuid32 203 | ||
211 | #define __NR_setregid32 204 | ||
212 | #define __NR_getgroups32 205 | ||
213 | #define __NR_setgroups32 206 | ||
214 | #define __NR_fchown32 207 | ||
215 | #define __NR_setresuid32 208 | ||
216 | #define __NR_getresuid32 209 | ||
217 | #define __NR_setresgid32 210 | ||
218 | #define __NR_getresgid32 211 | ||
219 | #define __NR_lchown32 212 | ||
220 | #define __NR_setuid32 213 | ||
221 | #define __NR_setgid32 214 | ||
222 | #define __NR_setfsuid32 215 | ||
223 | #define __NR_setfsgid32 216 | ||
224 | #define __NR_pivot_root 217 | ||
225 | #define __NR_getdents64 220 | ||
226 | #define __NR_gettid 221 | ||
227 | #define __NR_tkill 222 | ||
228 | #define __NR_setxattr 223 | ||
229 | #define __NR_lsetxattr 224 | ||
230 | #define __NR_fsetxattr 225 | ||
231 | #define __NR_getxattr 226 | ||
232 | #define __NR_lgetxattr 227 | ||
233 | #define __NR_fgetxattr 228 | ||
234 | #define __NR_listxattr 229 | ||
235 | #define __NR_llistxattr 230 | ||
236 | #define __NR_flistxattr 231 | ||
237 | #define __NR_removexattr 232 | ||
238 | #define __NR_lremovexattr 233 | ||
239 | #define __NR_fremovexattr 234 | ||
240 | #define __NR_futex 235 | ||
241 | #define __NR_sendfile64 236 | ||
242 | #define __NR_mincore 237 | ||
243 | #define __NR_madvise 238 | ||
244 | #define __NR_fcntl64 239 | ||
245 | #define __NR_readahead 240 | ||
246 | #define __NR_io_setup 241 | ||
247 | #define __NR_io_destroy 242 | ||
248 | #define __NR_io_getevents 243 | ||
249 | #define __NR_io_submit 244 | ||
250 | #define __NR_io_cancel 245 | ||
251 | #define __NR_fadvise64 246 | ||
252 | #define __NR_exit_group 247 | ||
253 | #define __NR_lookup_dcookie 248 | ||
254 | #define __NR_epoll_create 249 | ||
255 | #define __NR_epoll_ctl 250 | ||
256 | #define __NR_epoll_wait 251 | ||
257 | #define __NR_remap_file_pages 252 | ||
258 | #define __NR_set_tid_address 253 | ||
259 | #define __NR_timer_create 254 | ||
260 | #define __NR_timer_settime 255 | ||
261 | #define __NR_timer_gettime 256 | ||
262 | #define __NR_timer_getoverrun 257 | ||
263 | #define __NR_timer_delete 258 | ||
264 | #define __NR_clock_settime 259 | ||
265 | #define __NR_clock_gettime 260 | ||
266 | #define __NR_clock_getres 261 | ||
267 | #define __NR_clock_nanosleep 262 | ||
268 | #define __NR_statfs64 263 | ||
269 | #define __NR_fstatfs64 264 | ||
270 | #define __NR_tgkill 265 | ||
271 | #define __NR_utimes 266 | ||
272 | #define __NR_fadvise64_64 267 | ||
273 | #define __NR_mbind 268 | ||
274 | #define __NR_get_mempolicy 269 | ||
275 | #define __NR_set_mempolicy 270 | ||
276 | #define __NR_mq_open 271 | ||
277 | #define __NR_mq_unlink 272 | ||
278 | #define __NR_mq_timedsend 273 | ||
279 | #define __NR_mq_timedreceive 274 | ||
280 | #define __NR_mq_notify 275 | ||
281 | #define __NR_mq_getsetattr 276 | ||
282 | #define __NR_waitid 277 | ||
283 | #define __NR_vserver 278 | ||
284 | #define __NR_add_key 279 | ||
285 | #define __NR_request_key 280 | ||
286 | #define __NR_keyctl 281 | ||
287 | |||
288 | #define NR_syscalls 282 | ||
289 | |||
290 | /* user-visible error numbers are in the range -1 - -124: see | ||
291 | <asm-m68k/errno.h> */ | ||
292 | |||
293 | #define __syscall_return(type, res) \ | ||
294 | do { \ | ||
295 | if ((unsigned long)(res) >= (unsigned long)(-125)) { \ | ||
296 | /* avoid using res which is declared to be in register d0; \ | ||
297 | errno might expand to a function call and clobber it. */ \ | ||
298 | int __err = -(res); \ | ||
299 | errno = __err; \ | ||
300 | res = -1; \ | ||
301 | } \ | ||
302 | return (type) (res); \ | ||
303 | } while (0) | ||
304 | |||
305 | #define _syscall0(type,name) \ | ||
306 | type name(void) \ | ||
307 | { \ | ||
308 | register long __res __asm__ ("%d0") = __NR_##name; \ | ||
309 | __asm__ __volatile__ ("trap #0" \ | ||
310 | : "+d" (__res) ); \ | ||
311 | __syscall_return(type,__res); \ | ||
312 | } | ||
313 | |||
314 | #define _syscall1(type,name,atype,a) \ | ||
315 | type name(atype a) \ | ||
316 | { \ | ||
317 | register long __res __asm__ ("%d0") = __NR_##name; \ | ||
318 | register long __a __asm__ ("%d1") = (long)(a); \ | ||
319 | __asm__ __volatile__ ("trap #0" \ | ||
320 | : "+d" (__res) \ | ||
321 | : "d" (__a) ); \ | ||
322 | __syscall_return(type,__res); \ | ||
323 | } | ||
324 | |||
325 | #define _syscall2(type,name,atype,a,btype,b) \ | ||
326 | type name(atype a,btype b) \ | ||
327 | { \ | ||
328 | register long __res __asm__ ("%d0") = __NR_##name; \ | ||
329 | register long __a __asm__ ("%d1") = (long)(a); \ | ||
330 | register long __b __asm__ ("%d2") = (long)(b); \ | ||
331 | __asm__ __volatile__ ("trap #0" \ | ||
332 | : "+d" (__res) \ | ||
333 | : "d" (__a), "d" (__b) \ | ||
334 | ); \ | ||
335 | __syscall_return(type,__res); \ | ||
336 | } | ||
337 | |||
338 | #define _syscall3(type,name,atype,a,btype,b,ctype,c) \ | ||
339 | type name(atype a,btype b,ctype c) \ | ||
340 | { \ | ||
341 | register long __res __asm__ ("%d0") = __NR_##name; \ | ||
342 | register long __a __asm__ ("%d1") = (long)(a); \ | ||
343 | register long __b __asm__ ("%d2") = (long)(b); \ | ||
344 | register long __c __asm__ ("%d3") = (long)(c); \ | ||
345 | __asm__ __volatile__ ("trap #0" \ | ||
346 | : "+d" (__res) \ | ||
347 | : "d" (__a), "d" (__b), \ | ||
348 | "d" (__c) \ | ||
349 | ); \ | ||
350 | __syscall_return(type,__res); \ | ||
351 | } | ||
352 | |||
353 | #define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \ | ||
354 | type name (atype a, btype b, ctype c, dtype d) \ | ||
355 | { \ | ||
356 | register long __res __asm__ ("%d0") = __NR_##name; \ | ||
357 | register long __a __asm__ ("%d1") = (long)(a); \ | ||
358 | register long __b __asm__ ("%d2") = (long)(b); \ | ||
359 | register long __c __asm__ ("%d3") = (long)(c); \ | ||
360 | register long __d __asm__ ("%d4") = (long)(d); \ | ||
361 | __asm__ __volatile__ ("trap #0" \ | ||
362 | : "+d" (__res) \ | ||
363 | : "d" (__a), "d" (__b), \ | ||
364 | "d" (__c), "d" (__d) \ | ||
365 | ); \ | ||
366 | __syscall_return(type,__res); \ | ||
367 | } | ||
368 | |||
369 | #define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \ | ||
370 | type name (atype a,btype b,ctype c,dtype d,etype e) \ | ||
371 | { \ | ||
372 | register long __res __asm__ ("%d0") = __NR_##name; \ | ||
373 | register long __a __asm__ ("%d1") = (long)(a); \ | ||
374 | register long __b __asm__ ("%d2") = (long)(b); \ | ||
375 | register long __c __asm__ ("%d3") = (long)(c); \ | ||
376 | register long __d __asm__ ("%d4") = (long)(d); \ | ||
377 | register long __e __asm__ ("%d5") = (long)(e); \ | ||
378 | __asm__ __volatile__ ("trap #0" \ | ||
379 | : "+d" (__res) \ | ||
380 | : "d" (__a), "d" (__b), \ | ||
381 | "d" (__c), "d" (__d), "d" (__e) \ | ||
382 | ); \ | ||
383 | __syscall_return(type,__res); \ | ||
384 | } | ||
385 | |||
386 | #ifdef __KERNEL__ | ||
387 | #define __ARCH_WANT_IPC_PARSE_VERSION | ||
388 | #define __ARCH_WANT_OLD_READDIR | ||
389 | #define __ARCH_WANT_OLD_STAT | ||
390 | #define __ARCH_WANT_STAT64 | ||
391 | #define __ARCH_WANT_SYS_ALARM | ||
392 | #define __ARCH_WANT_SYS_GETHOSTNAME | ||
393 | #define __ARCH_WANT_SYS_PAUSE | ||
394 | #define __ARCH_WANT_SYS_SGETMASK | ||
395 | #define __ARCH_WANT_SYS_SIGNAL | ||
396 | #define __ARCH_WANT_SYS_TIME | ||
397 | #define __ARCH_WANT_SYS_UTIME | ||
398 | #define __ARCH_WANT_SYS_WAITPID | ||
399 | #define __ARCH_WANT_SYS_SOCKETCALL | ||
400 | #define __ARCH_WANT_SYS_FADVISE64 | ||
401 | #define __ARCH_WANT_SYS_GETPGRP | ||
402 | #define __ARCH_WANT_SYS_LLSEEK | ||
403 | #define __ARCH_WANT_SYS_NICE | ||
404 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | ||
405 | #define __ARCH_WANT_SYS_OLDUMOUNT | ||
406 | #define __ARCH_WANT_SYS_SIGPENDING | ||
407 | #define __ARCH_WANT_SYS_SIGPROCMASK | ||
408 | #define __ARCH_WANT_SYS_RT_SIGACTION | ||
409 | #endif | ||
410 | |||
411 | #ifdef __KERNEL_SYSCALLS__ | ||
412 | |||
413 | #include <linux/compiler.h> | ||
414 | #include <linux/interrupt.h> | ||
415 | #include <linux/types.h> | ||
416 | |||
417 | /* | ||
418 | * we need this inline - forking from kernel space will result | ||
419 | * in NO COPY ON WRITE (!!!), until an execve is executed. This | ||
420 | * is no problem, but for the stack. This is handled by not letting | ||
421 | * main() use the stack at all after fork(). Thus, no function | ||
422 | * calls - which means inline code for fork too, as otherwise we | ||
423 | * would use the stack upon exit from 'fork()'. | ||
424 | * | ||
425 | * Actually only pause and fork are needed inline, so that there | ||
426 | * won't be any messing with the stack from main(), but we define | ||
427 | * some others too. | ||
428 | */ | ||
429 | #define __NR__exit __NR_exit | ||
430 | static inline _syscall0(pid_t,setsid) | ||
431 | static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) | ||
432 | static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) | ||
433 | static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) | ||
434 | static inline _syscall1(int,dup,int,fd) | ||
435 | static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) | ||
436 | static inline _syscall3(int,open,const char *,file,int,flag,int,mode) | ||
437 | static inline _syscall1(int,close,int,fd) | ||
438 | static inline _syscall1(int,_exit,int,exitcode) | ||
439 | static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) | ||
440 | |||
441 | asmlinkage long sys_mmap2( | ||
442 | unsigned long addr, unsigned long len, | ||
443 | unsigned long prot, unsigned long flags, | ||
444 | unsigned long fd, unsigned long pgoff); | ||
445 | asmlinkage int sys_execve(char *name, char **argv, char **envp); | ||
446 | asmlinkage int sys_pipe(unsigned long *fildes); | ||
447 | asmlinkage int sys_ptrace(long request, long pid, long addr, long data); | ||
448 | struct pt_regs; | ||
449 | struct sigaction; | ||
450 | asmlinkage long sys_rt_sigaction(int sig, | ||
451 | const struct sigaction __user *act, | ||
452 | struct sigaction __user *oact, | ||
453 | size_t sigsetsize); | ||
454 | |||
455 | #endif | ||
456 | |||
457 | /* | ||
458 | * "Conditional" syscalls | ||
459 | * | ||
460 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), | ||
461 | * but it doesn't work on all toolchains, so we just do it by hand | ||
462 | */ | ||
463 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") | ||
464 | |||
465 | #endif /* _ASM_M68K_UNISTD_H_ */ | ||
diff --git a/include/asm-m68k/user.h b/include/asm-m68k/user.h new file mode 100644 index 000000000000..e8d5a64c7e79 --- /dev/null +++ b/include/asm-m68k/user.h | |||
@@ -0,0 +1,89 @@ | |||
1 | #ifndef _M68K_USER_H | ||
2 | #define _M68K_USER_H | ||
3 | |||
4 | #include <asm/page.h> | ||
5 | |||
6 | /* Core file format: The core file is written in such a way that gdb | ||
7 | can understand it and provide useful information to the user (under | ||
8 | linux we use the 'trad-core' bfd). There are quite a number of | ||
9 | obstacles to being able to view the contents of the floating point | ||
10 | registers, and until these are solved you will not be able to view the | ||
11 | contents of them. Actually, you can read in the core file and look at | ||
12 | the contents of the user struct to find out what the floating point | ||
13 | registers contain. | ||
14 | The actual file contents are as follows: | ||
15 | UPAGE: 1 page consisting of a user struct that tells gdb what is present | ||
16 | in the file. Directly after this is a copy of the task_struct, which | ||
17 | is currently not used by gdb, but it may come in useful at some point. | ||
18 | All of the registers are stored as part of the upage. The upage should | ||
19 | always be only one page. | ||
20 | DATA: The data area is stored. We use current->end_text to | ||
21 | current->brk to pick up all of the user variables, plus any memory | ||
22 | that may have been malloced. No attempt is made to determine if a page | ||
23 | is demand-zero or if a page is totally unused, we just cover the entire | ||
24 | range. All of the addresses are rounded in such a way that an integral | ||
25 | number of pages is written. | ||
26 | STACK: We need the stack information in order to get a meaningful | ||
27 | backtrace. We need to write the data from (esp) to | ||
28 | current->start_stack, so we round each of these off in order to be able | ||
29 | to write an integer number of pages. | ||
30 | The minimum core file size is 3 pages, or 12288 bytes. | ||
31 | */ | ||
32 | |||
33 | struct user_m68kfp_struct { | ||
34 | unsigned long fpregs[8*3]; /* fp0-fp7 registers */ | ||
35 | unsigned long fpcntl[3]; /* fp control regs */ | ||
36 | }; | ||
37 | |||
38 | /* This is the old layout of "struct pt_regs" as of Linux 1.x, and | ||
39 | is still the layout used by user (the new pt_regs doesn't have | ||
40 | all registers). */ | ||
41 | struct user_regs_struct { | ||
42 | long d1,d2,d3,d4,d5,d6,d7; | ||
43 | long a0,a1,a2,a3,a4,a5,a6; | ||
44 | long d0; | ||
45 | long usp; | ||
46 | long orig_d0; | ||
47 | short stkadj; | ||
48 | short sr; | ||
49 | long pc; | ||
50 | short fmtvec; | ||
51 | short __fill; | ||
52 | }; | ||
53 | |||
54 | |||
55 | /* When the kernel dumps core, it starts by dumping the user struct - | ||
56 | this will be used by gdb to figure out where the data and stack segments | ||
57 | are within the file, and what virtual addresses to use. */ | ||
58 | struct user{ | ||
59 | /* We start with the registers, to mimic the way that "memory" is returned | ||
60 | from the ptrace(3,...) function. */ | ||
61 | struct user_regs_struct regs; /* Where the registers are actually stored */ | ||
62 | /* ptrace does not yet supply these. Someday.... */ | ||
63 | int u_fpvalid; /* True if math co-processor being used. */ | ||
64 | /* for this mess. Not yet used. */ | ||
65 | struct user_m68kfp_struct m68kfp; /* Math Co-processor registers. */ | ||
66 | /* The rest of this junk is to help gdb figure out what goes where */ | ||
67 | unsigned long int u_tsize; /* Text segment size (pages). */ | ||
68 | unsigned long int u_dsize; /* Data segment size (pages). */ | ||
69 | unsigned long int u_ssize; /* Stack segment size (pages). */ | ||
70 | unsigned long start_code; /* Starting virtual address of text. */ | ||
71 | unsigned long start_stack; /* Starting virtual address of stack area. | ||
72 | This is actually the bottom of the stack, | ||
73 | the top of the stack is always found in the | ||
74 | esp register. */ | ||
75 | long int signal; /* Signal that caused the core dump. */ | ||
76 | int reserved; /* No longer used */ | ||
77 | struct user_regs_struct *u_ar0; | ||
78 | /* Used by gdb to help find the values for */ | ||
79 | /* the registers. */ | ||
80 | struct user_m68kfp_struct* u_fpstate; /* Math Co-processor pointer. */ | ||
81 | unsigned long magic; /* To uniquely identify a core file */ | ||
82 | char u_comm[32]; /* User command that was responsible */ | ||
83 | }; | ||
84 | #define NBPG PAGE_SIZE | ||
85 | #define UPAGES 1 | ||
86 | #define HOST_TEXT_START_ADDR (u.start_code) | ||
87 | #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) | ||
88 | |||
89 | #endif | ||
diff --git a/include/asm-m68k/virtconvert.h b/include/asm-m68k/virtconvert.h new file mode 100644 index 000000000000..8c4e8037b898 --- /dev/null +++ b/include/asm-m68k/virtconvert.h | |||
@@ -0,0 +1,76 @@ | |||
1 | #ifndef __VIRT_CONVERT__ | ||
2 | #define __VIRT_CONVERT__ | ||
3 | |||
4 | /* | ||
5 | * Macros used for converting between virtual and physical mappings. | ||
6 | */ | ||
7 | |||
8 | #ifdef __KERNEL__ | ||
9 | |||
10 | #include <linux/config.h> | ||
11 | #include <linux/compiler.h> | ||
12 | #include <asm/setup.h> | ||
13 | #include <asm/page.h> | ||
14 | |||
15 | #ifdef CONFIG_AMIGA | ||
16 | #include <asm/amigahw.h> | ||
17 | #endif | ||
18 | |||
19 | /* | ||
20 | * Change virtual addresses to physical addresses and vv. | ||
21 | */ | ||
22 | #ifndef CONFIG_SUN3 | ||
23 | extern unsigned long mm_vtop(unsigned long addr) __attribute_const__; | ||
24 | extern unsigned long mm_ptov(unsigned long addr) __attribute_const__; | ||
25 | #else | ||
26 | static inline unsigned long mm_vtop(unsigned long vaddr) | ||
27 | { | ||
28 | return __pa(vaddr); | ||
29 | } | ||
30 | |||
31 | static inline unsigned long mm_ptov(unsigned long paddr) | ||
32 | { | ||
33 | return (unsigned long)__va(paddr); | ||
34 | } | ||
35 | #endif | ||
36 | |||
37 | #ifdef CONFIG_SINGLE_MEMORY_CHUNK | ||
38 | static inline unsigned long virt_to_phys(void *vaddr) | ||
39 | { | ||
40 | return (unsigned long)vaddr - PAGE_OFFSET + m68k_memory[0].addr; | ||
41 | } | ||
42 | |||
43 | static inline void * phys_to_virt(unsigned long paddr) | ||
44 | { | ||
45 | return (void *)(paddr - m68k_memory[0].addr + PAGE_OFFSET); | ||
46 | } | ||
47 | #else | ||
48 | static inline unsigned long virt_to_phys(void *address) | ||
49 | { | ||
50 | return mm_vtop((unsigned long)address); | ||
51 | } | ||
52 | |||
53 | static inline void *phys_to_virt(unsigned long address) | ||
54 | { | ||
55 | return (void *) mm_ptov(address); | ||
56 | } | ||
57 | #endif | ||
58 | |||
59 | /* Permanent address of a page. */ | ||
60 | #define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) | ||
61 | #define page_to_phys(page) virt_to_phys((void *)__page_address(page)) | ||
62 | |||
63 | /* | ||
64 | * IO bus memory addresses are 1:1 with the physical address, | ||
65 | * except on the PCI bus of the Hades. | ||
66 | */ | ||
67 | #ifdef CONFIG_HADES | ||
68 | #define virt_to_bus(a) (virt_to_phys(a) + (MACH_IS_HADES ? 0x80000000 : 0)) | ||
69 | #define bus_to_virt(a) (phys_to_virt((a) - (MACH_IS_HADES ? 0x80000000 : 0))) | ||
70 | #else | ||
71 | #define virt_to_bus virt_to_phys | ||
72 | #define bus_to_virt phys_to_virt | ||
73 | #endif | ||
74 | |||
75 | #endif | ||
76 | #endif | ||
diff --git a/include/asm-m68k/vuid_event.h b/include/asm-m68k/vuid_event.h new file mode 100644 index 000000000000..52ecb521a395 --- /dev/null +++ b/include/asm-m68k/vuid_event.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef _M68K_VUID_EVENT_H | ||
2 | #define _M68K_VUID_EVENT_H | ||
3 | #include <asm-sparc/vuid_event.h> | ||
4 | #endif | ||
diff --git a/include/asm-m68k/xor.h b/include/asm-m68k/xor.h new file mode 100644 index 000000000000..c82eb12a5b18 --- /dev/null +++ b/include/asm-m68k/xor.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/xor.h> | |||
diff --git a/include/asm-m68k/zorro.h b/include/asm-m68k/zorro.h new file mode 100644 index 000000000000..cf816588bedb --- /dev/null +++ b/include/asm-m68k/zorro.h | |||
@@ -0,0 +1,45 @@ | |||
1 | #ifndef _ASM_M68K_ZORRO_H | ||
2 | #define _ASM_M68K_ZORRO_H | ||
3 | |||
4 | #include <asm/raw_io.h> | ||
5 | |||
6 | #define z_readb raw_inb | ||
7 | #define z_readw raw_inw | ||
8 | #define z_readl raw_inl | ||
9 | |||
10 | #define z_writeb raw_outb | ||
11 | #define z_writew raw_outw | ||
12 | #define z_writel raw_outl | ||
13 | |||
14 | #define z_memset_io(a,b,c) memset((void *)(a),(b),(c)) | ||
15 | #define z_memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) | ||
16 | #define z_memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) | ||
17 | |||
18 | static inline void *z_remap_nocache_ser(unsigned long physaddr, | ||
19 | unsigned long size) | ||
20 | { | ||
21 | return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); | ||
22 | } | ||
23 | |||
24 | static inline void *z_remap_nocache_nonser(unsigned long physaddr, | ||
25 | unsigned long size) | ||
26 | { | ||
27 | return __ioremap(physaddr, size, IOMAP_NOCACHE_NONSER); | ||
28 | } | ||
29 | |||
30 | static inline void *z_remap_writethrough(unsigned long physaddr, | ||
31 | unsigned long size) | ||
32 | { | ||
33 | return __ioremap(physaddr, size, IOMAP_WRITETHROUGH); | ||
34 | } | ||
35 | static inline void *z_remap_fullcache(unsigned long physaddr, | ||
36 | unsigned long size) | ||
37 | { | ||
38 | return __ioremap(physaddr, size, IOMAP_FULL_CACHING); | ||
39 | } | ||
40 | |||
41 | #define z_unmap iounmap | ||
42 | #define z_iounmap iounmap | ||
43 | #define z_ioremap z_remap_nocache_ser | ||
44 | |||
45 | #endif /* _ASM_M68K_ZORRO_H */ | ||