aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/amiga
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2007-05-01 16:32:43 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-04 20:59:06 -0400
commit6ff5801acbb643e81d3420ac0f37c96089309063 (patch)
tree2406744e75f7cd06e96d8cd62ba82970a0f79922 /arch/m68k/amiga
parentb3e2fd9cebcf4e82d0306fe7e796eeca5aac0614 (diff)
m68k: reformat various m68k files
Reformat various m68k files, so they actually look like Linux sources. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/m68k/amiga')
-rw-r--r--arch/m68k/amiga/config.c1076
1 files changed, 536 insertions, 540 deletions
diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
index 3204f412cad8..c3b69b1b0cef 100644
--- a/arch/m68k/amiga/config.c
+++ b/arch/m68k/amiga/config.c
@@ -22,9 +22,7 @@
22#include <linux/vt_kern.h> 22#include <linux/vt_kern.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#ifdef CONFIG_ZORRO
26#include <linux/zorro.h> 25#include <linux/zorro.h>
27#endif
28 26
29#include <asm/bootinfo.h> 27#include <asm/bootinfo.h>
30#include <asm/setup.h> 28#include <asm/setup.h>
@@ -62,21 +60,21 @@ static char s_cdtv[] __initdata = "CDTV";
62static char s_cd32[] __initdata = "CD32"; 60static char s_cd32[] __initdata = "CD32";
63static char s_draco[] __initdata = "Draco"; 61static char s_draco[] __initdata = "Draco";
64static char *amiga_models[] __initdata = { 62static char *amiga_models[] __initdata = {
65 [AMI_500-AMI_500] = s_a500, 63 [AMI_500-AMI_500] = s_a500,
66 [AMI_500PLUS-AMI_500] = s_a500p, 64 [AMI_500PLUS-AMI_500] = s_a500p,
67 [AMI_600-AMI_500] = s_a600, 65 [AMI_600-AMI_500] = s_a600,
68 [AMI_1000-AMI_500] = s_a1000, 66 [AMI_1000-AMI_500] = s_a1000,
69 [AMI_1200-AMI_500] = s_a1200, 67 [AMI_1200-AMI_500] = s_a1200,
70 [AMI_2000-AMI_500] = s_a2000, 68 [AMI_2000-AMI_500] = s_a2000,
71 [AMI_2500-AMI_500] = s_a2500, 69 [AMI_2500-AMI_500] = s_a2500,
72 [AMI_3000-AMI_500] = s_a3000, 70 [AMI_3000-AMI_500] = s_a3000,
73 [AMI_3000T-AMI_500] = s_a3000t, 71 [AMI_3000T-AMI_500] = s_a3000t,
74 [AMI_3000PLUS-AMI_500] = s_a3000p, 72 [AMI_3000PLUS-AMI_500] = s_a3000p,
75 [AMI_4000-AMI_500] = s_a4000, 73 [AMI_4000-AMI_500] = s_a4000,
76 [AMI_4000T-AMI_500] = s_a4000t, 74 [AMI_4000T-AMI_500] = s_a4000t,
77 [AMI_CDTV-AMI_500] = s_cdtv, 75 [AMI_CDTV-AMI_500] = s_cdtv,
78 [AMI_CD32-AMI_500] = s_cd32, 76 [AMI_CD32-AMI_500] = s_cd32,
79 [AMI_DRACO-AMI_500] = s_draco, 77 [AMI_DRACO-AMI_500] = s_draco,
80}; 78};
81 79
82static char amiga_model_name[13] = "Amiga "; 80static char amiga_model_name[13] = "Amiga ";
@@ -85,17 +83,17 @@ extern char m68k_debug_device[];
85 83
86static void amiga_sched_init(irq_handler_t handler); 84static void amiga_sched_init(irq_handler_t handler);
87/* amiga specific irq functions */ 85/* amiga specific irq functions */
88extern void amiga_init_IRQ (void); 86extern void amiga_init_IRQ(void);
89static void amiga_get_model(char *model); 87static void amiga_get_model(char *model);
90static int amiga_get_hardware_list(char *buffer); 88static int amiga_get_hardware_list(char *buffer);
91/* amiga specific timer functions */ 89/* amiga specific timer functions */
92static unsigned long amiga_gettimeoffset (void); 90static unsigned long amiga_gettimeoffset(void);
93static int a3000_hwclk (int, struct rtc_time *); 91static int a3000_hwclk(int, struct rtc_time *);
94static int a2000_hwclk (int, struct rtc_time *); 92static int a2000_hwclk(int, struct rtc_time *);
95static int amiga_set_clock_mmss (unsigned long); 93static int amiga_set_clock_mmss(unsigned long);
96static unsigned int amiga_get_ss (void); 94static unsigned int amiga_get_ss(void);
97extern void amiga_mksound( unsigned int count, unsigned int ticks ); 95extern void amiga_mksound(unsigned int count, unsigned int ticks);
98static void amiga_reset (void); 96static void amiga_reset(void);
99extern void amiga_init_sound(void); 97extern void amiga_init_sound(void);
100static void amiga_savekmsg_init(void); 98static void amiga_savekmsg_init(void);
101static void amiga_mem_console_write(struct console *co, const char *b, 99static void amiga_mem_console_write(struct console *co, const char *b,
@@ -108,9 +106,9 @@ static void amiga_heartbeat(int on);
108#endif 106#endif
109 107
110static struct console amiga_console_driver = { 108static struct console amiga_console_driver = {
111 .name = "debug", 109 .name = "debug",
112 .flags = CON_PRINTBUFFER, 110 .flags = CON_PRINTBUFFER,
113 .index = -1, 111 .index = -1,
114}; 112};
115 113
116 114
@@ -119,24 +117,24 @@ static struct console amiga_console_driver = {
119 */ 117 */
120 118
121static struct { 119static struct {
122 struct resource _ciab, _ciaa, _custom, _kickstart; 120 struct resource _ciab, _ciaa, _custom, _kickstart;
123} mb_resources = { 121} mb_resources = {
124 ._ciab = { 122 ._ciab = {
125 .name = "CIA B", .start = 0x00bfd000, .end = 0x00bfdfff 123 .name = "CIA B", .start = 0x00bfd000, .end = 0x00bfdfff
126 }, 124 },
127 ._ciaa = { 125 ._ciaa = {
128 .name = "CIA A", .start = 0x00bfe000, .end = 0x00bfefff 126 .name = "CIA A", .start = 0x00bfe000, .end = 0x00bfefff
129 }, 127 },
130 ._custom = { 128 ._custom = {
131 .name = "Custom I/O", .start = 0x00dff000, .end = 0x00dfffff 129 .name = "Custom I/O", .start = 0x00dff000, .end = 0x00dfffff
132 }, 130 },
133 ._kickstart = { 131 ._kickstart = {
134 .name = "Kickstart ROM", .start = 0x00f80000, .end = 0x00ffffff 132 .name = "Kickstart ROM", .start = 0x00f80000, .end = 0x00ffffff
135 } 133 }
136}; 134};
137 135
138static struct resource rtc_resource = { 136static struct resource rtc_resource = {
139 .start = 0x00dc0000, .end = 0x00dcffff 137 .start = 0x00dc0000, .end = 0x00dcffff
140}; 138};
141 139
142static struct resource ram_resource[NUM_MEMINFO]; 140static struct resource ram_resource[NUM_MEMINFO];
@@ -148,57 +146,57 @@ static struct resource ram_resource[NUM_MEMINFO];
148 146
149int amiga_parse_bootinfo(const struct bi_record *record) 147int amiga_parse_bootinfo(const struct bi_record *record)
150{ 148{
151 int unknown = 0; 149 int unknown = 0;
152 const unsigned long *data = record->data; 150 const unsigned long *data = record->data;
153 151
154 switch (record->tag) { 152 switch (record->tag) {
155 case BI_AMIGA_MODEL: 153 case BI_AMIGA_MODEL:
156 amiga_model = *data; 154 amiga_model = *data;
157 break; 155 break;
158 156
159 case BI_AMIGA_ECLOCK: 157 case BI_AMIGA_ECLOCK:
160 amiga_eclock = *data; 158 amiga_eclock = *data;
161 break; 159 break;
162 160
163 case BI_AMIGA_CHIPSET: 161 case BI_AMIGA_CHIPSET:
164 amiga_chipset = *data; 162 amiga_chipset = *data;
165 break; 163 break;
166 164
167 case BI_AMIGA_CHIP_SIZE: 165 case BI_AMIGA_CHIP_SIZE:
168 amiga_chip_size = *(const int *)data; 166 amiga_chip_size = *(const int *)data;
169 break; 167 break;
170 168
171 case BI_AMIGA_VBLANK: 169 case BI_AMIGA_VBLANK:
172 amiga_vblank = *(const unsigned char *)data; 170 amiga_vblank = *(const unsigned char *)data;
173 break; 171 break;
174 172
175 case BI_AMIGA_PSFREQ: 173 case BI_AMIGA_PSFREQ:
176 amiga_psfreq = *(const unsigned char *)data; 174 amiga_psfreq = *(const unsigned char *)data;
177 break; 175 break;
178 176
179 case BI_AMIGA_AUTOCON: 177 case BI_AMIGA_AUTOCON:
180#ifdef CONFIG_ZORRO 178#ifdef CONFIG_ZORRO
181 if (zorro_num_autocon < ZORRO_NUM_AUTO) { 179 if (zorro_num_autocon < ZORRO_NUM_AUTO) {
182 const struct ConfigDev *cd = (struct ConfigDev *)data; 180 const struct ConfigDev *cd = (struct ConfigDev *)data;
183 struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++]; 181 struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++];
184 dev->rom = cd->cd_Rom; 182 dev->rom = cd->cd_Rom;
185 dev->slotaddr = cd->cd_SlotAddr; 183 dev->slotaddr = cd->cd_SlotAddr;
186 dev->slotsize = cd->cd_SlotSize; 184 dev->slotsize = cd->cd_SlotSize;
187 dev->resource.start = (unsigned long)cd->cd_BoardAddr; 185 dev->resource.start = (unsigned long)cd->cd_BoardAddr;
188 dev->resource.end = dev->resource.start+cd->cd_BoardSize-1; 186 dev->resource.end = dev->resource.start + cd->cd_BoardSize - 1;
189 } else 187 } else
190 printk("amiga_parse_bootinfo: too many AutoConfig devices\n"); 188 printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
191#endif /* CONFIG_ZORRO */ 189#endif /* CONFIG_ZORRO */
192 break; 190 break;
193 191
194 case BI_AMIGA_SERPER: 192 case BI_AMIGA_SERPER:
195 /* serial port period: ignored here */ 193 /* serial port period: ignored here */
196 break; 194 break;
197 195
198 default: 196 default:
199 unknown = 1; 197 unknown = 1;
200 } 198 }
201 return(unknown); 199 return unknown;
202} 200}
203 201
204 /* 202 /*
@@ -207,159 +205,159 @@ int amiga_parse_bootinfo(const struct bi_record *record)
207 205
208static void __init amiga_identify(void) 206static void __init amiga_identify(void)
209{ 207{
210 /* Fill in some default values, if necessary */ 208 /* Fill in some default values, if necessary */
211 if (amiga_eclock == 0) 209 if (amiga_eclock == 0)
212 amiga_eclock = 709379; 210 amiga_eclock = 709379;
213
214 memset(&amiga_hw_present, 0, sizeof(amiga_hw_present));
215
216 printk("Amiga hardware found: ");
217 if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO) {
218 printk("[%s] ", amiga_models[amiga_model-AMI_500]);
219 strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]);
220 }
221
222 switch(amiga_model) {
223 case AMI_UNKNOWN:
224 goto Generic;
225
226 case AMI_600:
227 case AMI_1200:
228 AMIGAHW_SET(A1200_IDE);
229 AMIGAHW_SET(PCMCIA);
230 case AMI_500:
231 case AMI_500PLUS:
232 case AMI_1000:
233 case AMI_2000:
234 case AMI_2500:
235 AMIGAHW_SET(A2000_CLK); /* Is this correct for all models? */
236 goto Generic;
237
238 case AMI_3000:
239 case AMI_3000T:
240 AMIGAHW_SET(AMBER_FF);
241 AMIGAHW_SET(MAGIC_REKICK);
242 /* fall through */
243 case AMI_3000PLUS:
244 AMIGAHW_SET(A3000_SCSI);
245 AMIGAHW_SET(A3000_CLK);
246 AMIGAHW_SET(ZORRO3);
247 goto Generic;
248
249 case AMI_4000T:
250 AMIGAHW_SET(A4000_SCSI);
251 /* fall through */
252 case AMI_4000:
253 AMIGAHW_SET(A4000_IDE);
254 AMIGAHW_SET(A3000_CLK);
255 AMIGAHW_SET(ZORRO3);
256 goto Generic;
257
258 case AMI_CDTV:
259 case AMI_CD32:
260 AMIGAHW_SET(CD_ROM);
261 AMIGAHW_SET(A2000_CLK); /* Is this correct? */
262 goto Generic;
263
264 Generic:
265 AMIGAHW_SET(AMI_VIDEO);
266 AMIGAHW_SET(AMI_BLITTER);
267 AMIGAHW_SET(AMI_AUDIO);
268 AMIGAHW_SET(AMI_FLOPPY);
269 AMIGAHW_SET(AMI_KEYBOARD);
270 AMIGAHW_SET(AMI_MOUSE);
271 AMIGAHW_SET(AMI_SERIAL);
272 AMIGAHW_SET(AMI_PARALLEL);
273 AMIGAHW_SET(CHIP_RAM);
274 AMIGAHW_SET(PAULA);
275
276 switch(amiga_chipset) {
277 case CS_OCS:
278 case CS_ECS:
279 case CS_AGA:
280 switch (amiga_custom.deniseid & 0xf) {
281 case 0x0c:
282 AMIGAHW_SET(DENISE_HR);
283 break;
284 case 0x08:
285 AMIGAHW_SET(LISA);
286 break;
287 }
288 break;
289 default:
290 AMIGAHW_SET(DENISE);
291 break;
292 }
293 switch ((amiga_custom.vposr>>8) & 0x7f) {
294 case 0x00:
295 AMIGAHW_SET(AGNUS_PAL);
296 break;
297 case 0x10:
298 AMIGAHW_SET(AGNUS_NTSC);
299 break;
300 case 0x20:
301 case 0x21:
302 AMIGAHW_SET(AGNUS_HR_PAL);
303 break;
304 case 0x30:
305 case 0x31:
306 AMIGAHW_SET(AGNUS_HR_NTSC);
307 break;
308 case 0x22:
309 case 0x23:
310 AMIGAHW_SET(ALICE_PAL);
311 break;
312 case 0x32:
313 case 0x33:
314 AMIGAHW_SET(ALICE_NTSC);
315 break;
316 }
317 AMIGAHW_SET(ZORRO);
318 break;
319
320 case AMI_DRACO:
321 panic("No support for Draco yet");
322
323 default:
324 panic("Unknown Amiga Model");
325 }
326 211
327#define AMIGAHW_ANNOUNCE(name, str) \ 212 memset(&amiga_hw_present, 0, sizeof(amiga_hw_present));
328 if (AMIGAHW_PRESENT(name)) \ 213
329 printk(str) 214 printk("Amiga hardware found: ");
330 215 if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO) {
331 AMIGAHW_ANNOUNCE(AMI_VIDEO, "VIDEO "); 216 printk("[%s] ", amiga_models[amiga_model-AMI_500]);
332 AMIGAHW_ANNOUNCE(AMI_BLITTER, "BLITTER "); 217 strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]);
333 AMIGAHW_ANNOUNCE(AMBER_FF, "AMBER_FF "); 218 }
334 AMIGAHW_ANNOUNCE(AMI_AUDIO, "AUDIO "); 219
335 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "FLOPPY "); 220 switch (amiga_model) {
336 AMIGAHW_ANNOUNCE(A3000_SCSI, "A3000_SCSI "); 221 case AMI_UNKNOWN:
337 AMIGAHW_ANNOUNCE(A4000_SCSI, "A4000_SCSI "); 222 goto Generic;
338 AMIGAHW_ANNOUNCE(A1200_IDE, "A1200_IDE "); 223
339 AMIGAHW_ANNOUNCE(A4000_IDE, "A4000_IDE "); 224 case AMI_600:
340 AMIGAHW_ANNOUNCE(CD_ROM, "CD_ROM "); 225 case AMI_1200:
341 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "KEYBOARD "); 226 AMIGAHW_SET(A1200_IDE);
342 AMIGAHW_ANNOUNCE(AMI_MOUSE, "MOUSE "); 227 AMIGAHW_SET(PCMCIA);
343 AMIGAHW_ANNOUNCE(AMI_SERIAL, "SERIAL "); 228 case AMI_500:
344 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "PARALLEL "); 229 case AMI_500PLUS:
345 AMIGAHW_ANNOUNCE(A2000_CLK, "A2000_CLK "); 230 case AMI_1000:
346 AMIGAHW_ANNOUNCE(A3000_CLK, "A3000_CLK "); 231 case AMI_2000:
347 AMIGAHW_ANNOUNCE(CHIP_RAM, "CHIP_RAM "); 232 case AMI_2500:
348 AMIGAHW_ANNOUNCE(PAULA, "PAULA "); 233 AMIGAHW_SET(A2000_CLK); /* Is this correct for all models? */
349 AMIGAHW_ANNOUNCE(DENISE, "DENISE "); 234 goto Generic;
350 AMIGAHW_ANNOUNCE(DENISE_HR, "DENISE_HR "); 235
351 AMIGAHW_ANNOUNCE(LISA, "LISA "); 236 case AMI_3000:
352 AMIGAHW_ANNOUNCE(AGNUS_PAL, "AGNUS_PAL "); 237 case AMI_3000T:
353 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "AGNUS_NTSC "); 238 AMIGAHW_SET(AMBER_FF);
354 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "AGNUS_HR_PAL "); 239 AMIGAHW_SET(MAGIC_REKICK);
355 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "AGNUS_HR_NTSC "); 240 /* fall through */
356 AMIGAHW_ANNOUNCE(ALICE_PAL, "ALICE_PAL "); 241 case AMI_3000PLUS:
357 AMIGAHW_ANNOUNCE(ALICE_NTSC, "ALICE_NTSC "); 242 AMIGAHW_SET(A3000_SCSI);
358 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "MAGIC_REKICK "); 243 AMIGAHW_SET(A3000_CLK);
359 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA "); 244 AMIGAHW_SET(ZORRO3);
360 if (AMIGAHW_PRESENT(ZORRO)) 245 goto Generic;
361 printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3) ? "3" : ""); 246
362 printk("\n"); 247 case AMI_4000T:
248 AMIGAHW_SET(A4000_SCSI);
249 /* fall through */
250 case AMI_4000:
251 AMIGAHW_SET(A4000_IDE);
252 AMIGAHW_SET(A3000_CLK);
253 AMIGAHW_SET(ZORRO3);
254 goto Generic;
255
256 case AMI_CDTV:
257 case AMI_CD32:
258 AMIGAHW_SET(CD_ROM);
259 AMIGAHW_SET(A2000_CLK); /* Is this correct? */
260 goto Generic;
261
262 Generic:
263 AMIGAHW_SET(AMI_VIDEO);
264 AMIGAHW_SET(AMI_BLITTER);
265 AMIGAHW_SET(AMI_AUDIO);
266 AMIGAHW_SET(AMI_FLOPPY);
267 AMIGAHW_SET(AMI_KEYBOARD);
268 AMIGAHW_SET(AMI_MOUSE);
269 AMIGAHW_SET(AMI_SERIAL);
270 AMIGAHW_SET(AMI_PARALLEL);
271 AMIGAHW_SET(CHIP_RAM);
272 AMIGAHW_SET(PAULA);
273
274 switch (amiga_chipset) {
275 case CS_OCS:
276 case CS_ECS:
277 case CS_AGA:
278 switch (amiga_custom.deniseid & 0xf) {
279 case 0x0c:
280 AMIGAHW_SET(DENISE_HR);
281 break;
282 case 0x08:
283 AMIGAHW_SET(LISA);
284 break;
285 }
286 break;
287 default:
288 AMIGAHW_SET(DENISE);
289 break;
290 }
291 switch ((amiga_custom.vposr>>8) & 0x7f) {
292 case 0x00:
293 AMIGAHW_SET(AGNUS_PAL);
294 break;
295 case 0x10:
296 AMIGAHW_SET(AGNUS_NTSC);
297 break;
298 case 0x20:
299 case 0x21:
300 AMIGAHW_SET(AGNUS_HR_PAL);
301 break;
302 case 0x30:
303 case 0x31:
304 AMIGAHW_SET(AGNUS_HR_NTSC);
305 break;
306 case 0x22:
307 case 0x23:
308 AMIGAHW_SET(ALICE_PAL);
309 break;
310 case 0x32:
311 case 0x33:
312 AMIGAHW_SET(ALICE_NTSC);
313 break;
314 }
315 AMIGAHW_SET(ZORRO);
316 break;
317
318 case AMI_DRACO:
319 panic("No support for Draco yet");
320
321 default:
322 panic("Unknown Amiga Model");
323 }
324
325#define AMIGAHW_ANNOUNCE(name, str) \
326 if (AMIGAHW_PRESENT(name)) \
327 printk(str)
328
329 AMIGAHW_ANNOUNCE(AMI_VIDEO, "VIDEO ");
330 AMIGAHW_ANNOUNCE(AMI_BLITTER, "BLITTER ");
331 AMIGAHW_ANNOUNCE(AMBER_FF, "AMBER_FF ");
332 AMIGAHW_ANNOUNCE(AMI_AUDIO, "AUDIO ");
333 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "FLOPPY ");
334 AMIGAHW_ANNOUNCE(A3000_SCSI, "A3000_SCSI ");
335 AMIGAHW_ANNOUNCE(A4000_SCSI, "A4000_SCSI ");
336 AMIGAHW_ANNOUNCE(A1200_IDE, "A1200_IDE ");
337 AMIGAHW_ANNOUNCE(A4000_IDE, "A4000_IDE ");
338 AMIGAHW_ANNOUNCE(CD_ROM, "CD_ROM ");
339 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "KEYBOARD ");
340 AMIGAHW_ANNOUNCE(AMI_MOUSE, "MOUSE ");
341 AMIGAHW_ANNOUNCE(AMI_SERIAL, "SERIAL ");
342 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "PARALLEL ");
343 AMIGAHW_ANNOUNCE(A2000_CLK, "A2000_CLK ");
344 AMIGAHW_ANNOUNCE(A3000_CLK, "A3000_CLK ");
345 AMIGAHW_ANNOUNCE(CHIP_RAM, "CHIP_RAM ");
346 AMIGAHW_ANNOUNCE(PAULA, "PAULA ");
347 AMIGAHW_ANNOUNCE(DENISE, "DENISE ");
348 AMIGAHW_ANNOUNCE(DENISE_HR, "DENISE_HR ");
349 AMIGAHW_ANNOUNCE(LISA, "LISA ");
350 AMIGAHW_ANNOUNCE(AGNUS_PAL, "AGNUS_PAL ");
351 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "AGNUS_NTSC ");
352 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "AGNUS_HR_PAL ");
353 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "AGNUS_HR_NTSC ");
354 AMIGAHW_ANNOUNCE(ALICE_PAL, "ALICE_PAL ");
355 AMIGAHW_ANNOUNCE(ALICE_NTSC, "ALICE_NTSC ");
356 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "MAGIC_REKICK ");
357 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA ");
358 if (AMIGAHW_PRESENT(ZORRO))
359 printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3) ? "3" : "");
360 printk("\n");
363 361
364#undef AMIGAHW_ANNOUNCE 362#undef AMIGAHW_ANNOUNCE
365} 363}
@@ -370,119 +368,117 @@ static void __init amiga_identify(void)
370 368
371void __init config_amiga(void) 369void __init config_amiga(void)
372{ 370{
373 int i; 371 int i;
374 372
375 amiga_debug_init(); 373 amiga_debug_init();
376 amiga_identify(); 374 amiga_identify();
377 375
378 /* Yuk, we don't have PCI memory */ 376 /* Yuk, we don't have PCI memory */
379 iomem_resource.name = "Memory"; 377 iomem_resource.name = "Memory";
380 for (i = 0; i < 4; i++) 378 for (i = 0; i < 4; i++)
381 request_resource(&iomem_resource, &((struct resource *)&mb_resources)[i]); 379 request_resource(&iomem_resource, &((struct resource *)&mb_resources)[i]);
382 380
383 mach_sched_init = amiga_sched_init; 381 mach_sched_init = amiga_sched_init;
384 mach_init_IRQ = amiga_init_IRQ; 382 mach_init_IRQ = amiga_init_IRQ;
385 mach_get_model = amiga_get_model; 383 mach_get_model = amiga_get_model;
386 mach_get_hardware_list = amiga_get_hardware_list; 384 mach_get_hardware_list = amiga_get_hardware_list;
387 mach_gettimeoffset = amiga_gettimeoffset; 385 mach_gettimeoffset = amiga_gettimeoffset;
388 if (AMIGAHW_PRESENT(A3000_CLK)){ 386 if (AMIGAHW_PRESENT(A3000_CLK)) {
389 mach_hwclk = a3000_hwclk; 387 mach_hwclk = a3000_hwclk;
390 rtc_resource.name = "A3000 RTC"; 388 rtc_resource.name = "A3000 RTC";
391 request_resource(&iomem_resource, &rtc_resource); 389 request_resource(&iomem_resource, &rtc_resource);
392 } 390 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
393 else{ /* if (AMIGAHW_PRESENT(A2000_CLK)) */ 391 mach_hwclk = a2000_hwclk;
394 mach_hwclk = a2000_hwclk; 392 rtc_resource.name = "A2000 RTC";
395 rtc_resource.name = "A2000 RTC"; 393 request_resource(&iomem_resource, &rtc_resource);
396 request_resource(&iomem_resource, &rtc_resource); 394 }
397 } 395
398 396 /*
399 mach_max_dma_address = 0xffffffff; /* 397 * default MAX_DMA=0xffffffff on all machines. If we don't do so, the SCSI
400 * default MAX_DMA=0xffffffff 398 * code will not be able to allocate any mem for transfers, unless we are
401 * on all machines. If we don't 399 * dealing with a Z2 mem only system. /Jes
402 * do so, the SCSI code will not 400 */
403 * be able to allocate any mem 401 mach_max_dma_address = 0xffffffff;
404 * for transfers, unless we are 402
405 * dealing with a Z2 mem only 403 mach_set_clock_mmss = amiga_set_clock_mmss;
406 * system. /Jes 404 mach_get_ss = amiga_get_ss;
407 */ 405 mach_reset = amiga_reset;
408
409 mach_set_clock_mmss = amiga_set_clock_mmss;
410 mach_get_ss = amiga_get_ss;
411 mach_reset = amiga_reset;
412#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) 406#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
413 mach_beep = amiga_mksound; 407 mach_beep = amiga_mksound;
414#endif 408#endif
415 409
416#ifdef CONFIG_HEARTBEAT 410#ifdef CONFIG_HEARTBEAT
417 mach_heartbeat = amiga_heartbeat; 411 mach_heartbeat = amiga_heartbeat;
418#endif 412#endif
419 413
420 /* Fill in the clock values (based on the 700 kHz E-Clock) */ 414 /* Fill in the clock values (based on the 700 kHz E-Clock) */
421 amiga_masterclock = 40*amiga_eclock; /* 28 MHz */ 415 amiga_masterclock = 40*amiga_eclock; /* 28 MHz */
422 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */ 416 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */
423 417
424 /* clear all DMA bits */ 418 /* clear all DMA bits */
425 amiga_custom.dmacon = DMAF_ALL; 419 amiga_custom.dmacon = DMAF_ALL;
426 /* ensure that the DMA master bit is set */ 420 /* ensure that the DMA master bit is set */
427 amiga_custom.dmacon = DMAF_SETCLR | DMAF_MASTER; 421 amiga_custom.dmacon = DMAF_SETCLR | DMAF_MASTER;
428 422
429 /* don't use Z2 RAM as system memory on Z3 capable machines */ 423 /* don't use Z2 RAM as system memory on Z3 capable machines */
430 if (AMIGAHW_PRESENT(ZORRO3)) { 424 if (AMIGAHW_PRESENT(ZORRO3)) {
431 int i, j; 425 int i, j;
432 u32 disabled_z2mem = 0; 426 u32 disabled_z2mem = 0;
433 for (i = 0; i < m68k_num_memory; i++) 427
434 if (m68k_memory[i].addr < 16*1024*1024) { 428 for (i = 0; i < m68k_num_memory; i++) {
435 if (i == 0) { 429 if (m68k_memory[i].addr < 16*1024*1024) {
436 /* don't cut off the branch we're sitting on */ 430 if (i == 0) {
437 printk("Warning: kernel runs in Zorro II memory\n"); 431 /* don't cut off the branch we're sitting on */
438 continue; 432 printk("Warning: kernel runs in Zorro II memory\n");
433 continue;
434 }
435 disabled_z2mem += m68k_memory[i].size;
436 m68k_num_memory--;
437 for (j = i; j < m68k_num_memory; j++)
438 m68k_memory[j] = m68k_memory[j+1];
439 i--;
440 }
441 }
442 if (disabled_z2mem)
443 printk("%dK of Zorro II memory will not be used as system memory\n",
444 disabled_z2mem>>10);
445 }
446
447 /* request all RAM */
448 for (i = 0; i < m68k_num_memory; i++) {
449 ram_resource[i].name =
450 (m68k_memory[i].addr >= 0x01000000) ? "32-bit Fast RAM" :
451 (m68k_memory[i].addr < 0x00c00000) ? "16-bit Fast RAM" :
452 "16-bit Slow RAM";
453 ram_resource[i].start = m68k_memory[i].addr;
454 ram_resource[i].end = m68k_memory[i].addr+m68k_memory[i].size-1;
455 request_resource(&iomem_resource, &ram_resource[i]);
456 }
457
458 /* initialize chipram allocator */
459 amiga_chip_init();
460
461 /* debugging using chipram */
462 if (!strcmp(m68k_debug_device, "mem")) {
463 if (!AMIGAHW_PRESENT(CHIP_RAM))
464 printk("Warning: no chipram present for debugging\n");
465 else {
466 amiga_savekmsg_init();
467 amiga_console_driver.write = amiga_mem_console_write;
468 register_console(&amiga_console_driver);
469 }
439 } 470 }
440 disabled_z2mem += m68k_memory[i].size; 471
441 m68k_num_memory--; 472 /* our beloved beeper */
442 for (j = i; j < m68k_num_memory; j++) 473 if (AMIGAHW_PRESENT(AMI_AUDIO))
443 m68k_memory[j] = m68k_memory[j+1]; 474 amiga_init_sound();
444 i--; 475
445 } 476 /*
446 if (disabled_z2mem) 477 * if it is an A3000, set the magic bit that forces
447 printk("%dK of Zorro II memory will not be used as system memory\n", 478 * a hard rekick
448 disabled_z2mem>>10); 479 */
449 } 480 if (AMIGAHW_PRESENT(MAGIC_REKICK))
450 481 *(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
451 /* request all RAM */
452 for (i = 0; i < m68k_num_memory; i++) {
453 ram_resource[i].name =
454 (m68k_memory[i].addr >= 0x01000000) ? "32-bit Fast RAM" :
455 (m68k_memory[i].addr < 0x00c00000) ? "16-bit Fast RAM" :
456 "16-bit Slow RAM";
457 ram_resource[i].start = m68k_memory[i].addr;
458 ram_resource[i].end = m68k_memory[i].addr+m68k_memory[i].size-1;
459 request_resource(&iomem_resource, &ram_resource[i]);
460 }
461
462 /* initialize chipram allocator */
463 amiga_chip_init ();
464
465 /* debugging using chipram */
466 if (!strcmp( m68k_debug_device, "mem" )){
467 if (!AMIGAHW_PRESENT(CHIP_RAM))
468 printk("Warning: no chipram present for debugging\n");
469 else {
470 amiga_savekmsg_init();
471 amiga_console_driver.write = amiga_mem_console_write;
472 register_console(&amiga_console_driver);
473 }
474 }
475
476 /* our beloved beeper */
477 if (AMIGAHW_PRESENT(AMI_AUDIO))
478 amiga_init_sound();
479
480 /*
481 * if it is an A3000, set the magic bit that forces
482 * a hard rekick
483 */
484 if (AMIGAHW_PRESENT(MAGIC_REKICK))
485 *(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
486} 482}
487 483
488static unsigned short jiffy_ticks; 484static unsigned short jiffy_ticks;
@@ -490,12 +486,12 @@ static unsigned short jiffy_ticks;
490static void __init amiga_sched_init(irq_handler_t timer_routine) 486static void __init amiga_sched_init(irq_handler_t timer_routine)
491{ 487{
492 static struct resource sched_res = { 488 static struct resource sched_res = {
493 .name = "timer", .start = 0x00bfd400, .end = 0x00bfd5ff, 489 .name = "timer", .start = 0x00bfd400, .end = 0x00bfd5ff,
494 }; 490 };
495 jiffy_ticks = (amiga_eclock+HZ/2)/HZ; 491 jiffy_ticks = (amiga_eclock+HZ/2)/HZ;
496 492
497 if (request_resource(&mb_resources._ciab, &sched_res)) 493 if (request_resource(&mb_resources._ciab, &sched_res))
498 printk("Cannot allocate ciab.ta{lo,hi}\n"); 494 printk("Cannot allocate ciab.ta{lo,hi}\n");
499 ciab.cra &= 0xC0; /* turn off timer A, continuous mode, from Eclk */ 495 ciab.cra &= 0xC0; /* turn off timer A, continuous mode, from Eclk */
500 ciab.talo = jiffy_ticks % 256; 496 ciab.talo = jiffy_ticks % 256;
501 ciab.tahi = jiffy_ticks / 256; 497 ciab.tahi = jiffy_ticks / 256;
@@ -513,7 +509,7 @@ static void __init amiga_sched_init(irq_handler_t timer_routine)
513#define TICK_SIZE 10000 509#define TICK_SIZE 10000
514 510
515/* This is always executed with interrupts disabled. */ 511/* This is always executed with interrupts disabled. */
516static unsigned long amiga_gettimeoffset (void) 512static unsigned long amiga_gettimeoffset(void)
517{ 513{
518 unsigned short hi, lo, hi2; 514 unsigned short hi, lo, hi2;
519 unsigned long ticks, offset = 0; 515 unsigned long ticks, offset = 0;
@@ -585,15 +581,15 @@ static int a2000_hwclk(int op, struct rtc_time *t)
585 581
586 tod_2000.cntrl1 = TOD2000_CNTRL1_HOLD; 582 tod_2000.cntrl1 = TOD2000_CNTRL1_HOLD;
587 583
588 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) 584 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) {
589 { 585 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
590 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD; 586 udelay(70);
591 udelay(70); 587 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
592 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
593 } 588 }
594 589
595 if (!cnt) 590 if (!cnt)
596 printk(KERN_INFO "hwclk: timed out waiting for RTC (0x%x)\n", tod_2000.cntrl1); 591 printk(KERN_INFO "hwclk: timed out waiting for RTC (0x%x)\n",
592 tod_2000.cntrl1);
597 593
598 if (!op) { /* read */ 594 if (!op) { /* read */
599 t->tm_sec = tod_2000.second1 * 10 + tod_2000.second2; 595 t->tm_sec = tod_2000.second1 * 10 + tod_2000.second2;
@@ -606,7 +602,7 @@ static int a2000_hwclk(int op, struct rtc_time *t)
606 if (t->tm_year <= 69) 602 if (t->tm_year <= 69)
607 t->tm_year += 100; 603 t->tm_year += 100;
608 604
609 if (!(tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)){ 605 if (!(tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)) {
610 if (!(tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour == 12) 606 if (!(tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour == 12)
611 t->tm_hour = 0; 607 t->tm_hour = 0;
612 else if ((tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour != 12) 608 else if ((tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour != 12)
@@ -642,7 +638,7 @@ static int a2000_hwclk(int op, struct rtc_time *t)
642 return 0; 638 return 0;
643} 639}
644 640
645static int amiga_set_clock_mmss (unsigned long nowtime) 641static int amiga_set_clock_mmss(unsigned long nowtime)
646{ 642{
647 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60; 643 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
648 644
@@ -660,8 +656,7 @@ static int amiga_set_clock_mmss (unsigned long nowtime)
660 656
661 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD; 657 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
662 658
663 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) 659 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) {
664 {
665 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD; 660 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
666 udelay(70); 661 udelay(70);
667 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD; 662 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
@@ -681,7 +676,7 @@ static int amiga_set_clock_mmss (unsigned long nowtime)
681 return 0; 676 return 0;
682} 677}
683 678
684static unsigned int amiga_get_ss( void ) 679static unsigned int amiga_get_ss(void)
685{ 680{
686 unsigned int s; 681 unsigned int s;
687 682
@@ -695,71 +690,72 @@ static unsigned int amiga_get_ss( void )
695 return s; 690 return s;
696} 691}
697 692
698static NORET_TYPE void amiga_reset( void ) 693static NORET_TYPE void amiga_reset(void)
699 ATTRIB_NORET; 694 ATTRIB_NORET;
700 695
701static void amiga_reset (void) 696static void amiga_reset(void)
702{ 697{
703 unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040); 698 unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
704 unsigned long jmp_addr = virt_to_phys(&&jmp_addr_label); 699 unsigned long jmp_addr = virt_to_phys(&&jmp_addr_label);
705 700
706 local_irq_disable(); 701 local_irq_disable();
707 if (CPU_IS_040_OR_060) 702 if (CPU_IS_040_OR_060)
708 /* Setup transparent translation registers for mapping 703 /* Setup transparent translation registers for mapping
709 * of 16 MB kernel segment before disabling translation 704 * of 16 MB kernel segment before disabling translation
710 */ 705 */
711 __asm__ __volatile__ 706 asm volatile ("\n"
712 ("movel %0,%/d0\n\t" 707 " move.l %0,%%d0\n"
713 "andl #0xff000000,%/d0\n\t" 708 " and.l #0xff000000,%%d0\n"
714 "orw #0xe020,%/d0\n\t" /* map 16 MB, enable, cacheable */ 709 " or.w #0xe020,%%d0\n" /* map 16 MB, enable, cacheable */
715 ".chip 68040\n\t" 710 " .chip 68040\n"
716 "movec %%d0,%%itt0\n\t" 711 " movec %%d0,%%itt0\n"
717 "movec %%d0,%%dtt0\n\t" 712 " movec %%d0,%%dtt0\n"
718 ".chip 68k\n\t" 713 " .chip 68k\n"
719 "jmp %0@\n\t" 714 " jmp %0@\n"
720 : /* no outputs */ 715 : /* no outputs */
721 : "a" (jmp_addr040)); 716 : "a" (jmp_addr040)
722 else 717 : "d0");
723 /* for 680[23]0, just disable translation and jump to the physical 718 else
724 * address of the label 719 /* for 680[23]0, just disable translation and jump to the physical
725 */ 720 * address of the label
726 __asm__ __volatile__ 721 */
727 ("pmove %/tc,%@\n\t" 722 asm volatile ("\n"
728 "bclr #7,%@\n\t" 723 " pmove %%tc,%@\n"
729 "pmove %@,%/tc\n\t" 724 " bclr #7,%@\n"
730 "jmp %0@\n\t" 725 " pmove %@,%%tc\n"
731 : /* no outputs */ 726 " jmp %0@\n"
732 : "a" (jmp_addr)); 727 : /* no outputs */
733 jmp_addr_label040: 728 : "a" (jmp_addr));
734 /* disable translation on '040 now */ 729jmp_addr_label040:
735 __asm__ __volatile__ 730 /* disable translation on '040 now */
736 ("moveq #0,%/d0\n\t" 731 asm volatile ("\n"
737 ".chip 68040\n\t" 732 " moveq #0,%%d0\n"
738 "movec %%d0,%%tc\n\t" /* disable MMU */ 733 " .chip 68040\n"
739 ".chip 68k\n\t" 734 " movec %%d0,%%tc\n" /* disable MMU */
740 : /* no outputs */ 735 " .chip 68k\n"
741 : /* no inputs */ 736 : /* no outputs */
742 : "d0"); 737 : /* no inputs */
743 738 : "d0");
744 jmp_addr_label: 739
745 /* pickup reset address from AmigaOS ROM, reset devices and jump 740 jmp_addr_label:
746 * to reset address 741 /* pickup reset address from AmigaOS ROM, reset devices and jump
747 */ 742 * to reset address
748 __asm__ __volatile__ 743 */
749 ("movew #0x2700,%/sr\n\t" 744 asm volatile ("\n"
750 "leal 0x01000000,%/a0\n\t" 745 " move.w #0x2700,%sr\n"
751 "subl %/a0@(-0x14),%/a0\n\t" 746 " lea 0x01000000,%a0\n"
752 "movel %/a0@(4),%/a0\n\t" 747 " sub.l %a0@(-0x14),%a0\n"
753 "subql #2,%/a0\n\t" 748 " move.l %a0@(4),%a0\n"
754 "bra 1f\n\t" 749 " subq.l #2,%a0\n"
755 /* align on a longword boundary */ 750 " jra 1f\n"
756 __ALIGN_STR "\n" 751 /* align on a longword boundary */
757 "1:\n\t" 752 " " __ALIGN_STR "\n"
758 "reset\n\t" 753 "1:\n"
759 "jmp %/a0@" : /* Just that gcc scans it for % escapes */ ); 754 " reset\n"
760 755 " jmp %a0@");
761 for (;;); 756
762 757 for (;;)
758 ;
763} 759}
764 760
765 761
@@ -773,11 +769,11 @@ static void amiga_reset (void)
773#define SAVEKMSG_MAGIC2 0x4B4D5347 /* 'KMSG' */ 769#define SAVEKMSG_MAGIC2 0x4B4D5347 /* 'KMSG' */
774 770
775struct savekmsg { 771struct savekmsg {
776 unsigned long magic1; /* SAVEKMSG_MAGIC1 */ 772 unsigned long magic1; /* SAVEKMSG_MAGIC1 */
777 unsigned long magic2; /* SAVEKMSG_MAGIC2 */ 773 unsigned long magic2; /* SAVEKMSG_MAGIC2 */
778 unsigned long magicptr; /* address of magic1 */ 774 unsigned long magicptr; /* address of magic1 */
779 unsigned long size; 775 unsigned long size;
780 char data[0]; 776 char data[0];
781}; 777};
782 778
783static struct savekmsg *savekmsg; 779static struct savekmsg *savekmsg;
@@ -785,100 +781,100 @@ static struct savekmsg *savekmsg;
785static void amiga_mem_console_write(struct console *co, const char *s, 781static void amiga_mem_console_write(struct console *co, const char *s,
786 unsigned int count) 782 unsigned int count)
787{ 783{
788 if (savekmsg->size+count <= SAVEKMSG_MAXMEM-sizeof(struct savekmsg)) { 784 if (savekmsg->size + count <= SAVEKMSG_MAXMEM-sizeof(struct savekmsg)) {
789 memcpy(savekmsg->data+savekmsg->size, s, count); 785 memcpy(savekmsg->data + savekmsg->size, s, count);
790 savekmsg->size += count; 786 savekmsg->size += count;
791 } 787 }
792} 788}
793 789
794static void amiga_savekmsg_init(void) 790static void amiga_savekmsg_init(void)
795{ 791{
796 static struct resource debug_res = { .name = "Debug" }; 792 static struct resource debug_res = { .name = "Debug" };
797 793
798 savekmsg = amiga_chip_alloc_res(SAVEKMSG_MAXMEM, &debug_res); 794 savekmsg = amiga_chip_alloc_res(SAVEKMSG_MAXMEM, &debug_res);
799 savekmsg->magic1 = SAVEKMSG_MAGIC1; 795 savekmsg->magic1 = SAVEKMSG_MAGIC1;
800 savekmsg->magic2 = SAVEKMSG_MAGIC2; 796 savekmsg->magic2 = SAVEKMSG_MAGIC2;
801 savekmsg->magicptr = ZTWO_PADDR(savekmsg); 797 savekmsg->magicptr = ZTWO_PADDR(savekmsg);
802 savekmsg->size = 0; 798 savekmsg->size = 0;
803} 799}
804 800
805static void amiga_serial_putc(char c) 801static void amiga_serial_putc(char c)
806{ 802{
807 amiga_custom.serdat = (unsigned char)c | 0x100; 803 amiga_custom.serdat = (unsigned char)c | 0x100;
808 while (!(amiga_custom.serdatr & 0x2000)) 804 while (!(amiga_custom.serdatr & 0x2000))
809 ; 805 ;
810} 806}
811 807
812void amiga_serial_console_write(struct console *co, const char *s, 808void amiga_serial_console_write(struct console *co, const char *s,
813 unsigned int count) 809 unsigned int count)
814{ 810{
815 while (count--) { 811 while (count--) {
816 if (*s == '\n') 812 if (*s == '\n')
817 amiga_serial_putc('\r'); 813 amiga_serial_putc('\r');
818 amiga_serial_putc(*s++); 814 amiga_serial_putc(*s++);
819 } 815 }
820} 816}
821 817
822#ifdef CONFIG_SERIAL_CONSOLE 818#ifdef CONFIG_SERIAL_CONSOLE
823void amiga_serial_puts(const char *s) 819void amiga_serial_puts(const char *s)
824{ 820{
825 amiga_serial_console_write(NULL, s, strlen(s)); 821 amiga_serial_console_write(NULL, s, strlen(s));
826} 822}
827 823
828int amiga_serial_console_wait_key(struct console *co) 824int amiga_serial_console_wait_key(struct console *co)
829{ 825{
830 int ch; 826 int ch;
831 827
832 while (!(amiga_custom.intreqr & IF_RBF)) 828 while (!(amiga_custom.intreqr & IF_RBF))
833 barrier(); 829 barrier();
834 ch = amiga_custom.serdatr & 0xff; 830 ch = amiga_custom.serdatr & 0xff;
835 /* clear the interrupt, so that another character can be read */ 831 /* clear the interrupt, so that another character can be read */
836 amiga_custom.intreq = IF_RBF; 832 amiga_custom.intreq = IF_RBF;
837 return ch; 833 return ch;
838} 834}
839 835
840void amiga_serial_gets(struct console *co, char *s, int len) 836void amiga_serial_gets(struct console *co, char *s, int len)
841{ 837{
842 int ch, cnt = 0; 838 int ch, cnt = 0;
843 839
844 while (1) { 840 while (1) {
845 ch = amiga_serial_console_wait_key(co); 841 ch = amiga_serial_console_wait_key(co);
846 842
847 /* Check for backspace. */ 843 /* Check for backspace. */
848 if (ch == 8 || ch == 127) { 844 if (ch == 8 || ch == 127) {
849 if (cnt == 0) { 845 if (cnt == 0) {
850 amiga_serial_putc('\007'); 846 amiga_serial_putc('\007');
851 continue; 847 continue;
852 } 848 }
853 cnt--; 849 cnt--;
854 amiga_serial_puts("\010 \010"); 850 amiga_serial_puts("\010 \010");
855 continue; 851 continue;
856 } 852 }
857 853
858 /* Check for enter. */ 854 /* Check for enter. */
859 if (ch == 10 || ch == 13) 855 if (ch == 10 || ch == 13)
860 break; 856 break;
861 857
862 /* See if line is too long. */ 858 /* See if line is too long. */
863 if (cnt >= len + 1) { 859 if (cnt >= len + 1) {
864 amiga_serial_putc(7); 860 amiga_serial_putc(7);
865 cnt--; 861 cnt--;
866 continue; 862 continue;
867 } 863 }
868 864
869 /* Store and echo character. */ 865 /* Store and echo character. */
870 s[cnt++] = ch; 866 s[cnt++] = ch;
871 amiga_serial_putc(ch); 867 amiga_serial_putc(ch);
872 } 868 }
873 /* Print enter. */ 869 /* Print enter. */
874 amiga_serial_puts("\r\n"); 870 amiga_serial_puts("\r\n");
875 s[cnt] = 0; 871 s[cnt] = 0;
876} 872}
877#endif 873#endif
878 874
879static void __init amiga_debug_init(void) 875static void __init amiga_debug_init(void)
880{ 876{
881 if (!strcmp( m68k_debug_device, "ser" )) { 877 if (!strcmp(m68k_debug_device, "ser" )) {
882 /* no initialization required (?) */ 878 /* no initialization required (?) */
883 amiga_console_driver.write = amiga_serial_console_write; 879 amiga_console_driver.write = amiga_serial_console_write;
884 register_console(&amiga_console_driver); 880 register_console(&amiga_console_driver);
@@ -888,10 +884,10 @@ static void __init amiga_debug_init(void)
888#ifdef CONFIG_HEARTBEAT 884#ifdef CONFIG_HEARTBEAT
889static void amiga_heartbeat(int on) 885static void amiga_heartbeat(int on)
890{ 886{
891 if (on) 887 if (on)
892 ciaa.pra &= ~2; 888 ciaa.pra &= ~2;
893 else 889 else
894 ciaa.pra |= 2; 890 ciaa.pra |= 2;
895} 891}
896#endif 892#endif
897 893
@@ -901,81 +897,81 @@ static void amiga_heartbeat(int on)
901 897
902static void amiga_get_model(char *model) 898static void amiga_get_model(char *model)
903{ 899{
904 strcpy(model, amiga_model_name); 900 strcpy(model, amiga_model_name);
905} 901}
906 902
907 903
908static int amiga_get_hardware_list(char *buffer) 904static int amiga_get_hardware_list(char *buffer)
909{ 905{
910 int len = 0; 906 int len = 0;
911 907
912 if (AMIGAHW_PRESENT(CHIP_RAM)) 908 if (AMIGAHW_PRESENT(CHIP_RAM))
913 len += sprintf(buffer+len, "Chip RAM:\t%ldK\n", amiga_chip_size>>10); 909 len += sprintf(buffer+len, "Chip RAM:\t%ldK\n", amiga_chip_size>>10);
914 len += sprintf(buffer+len, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n", 910 len += sprintf(buffer+len, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n",
915 amiga_psfreq, amiga_eclock); 911 amiga_psfreq, amiga_eclock);
916 if (AMIGAHW_PRESENT(AMI_VIDEO)) { 912 if (AMIGAHW_PRESENT(AMI_VIDEO)) {
917 char *type; 913 char *type;
918 switch(amiga_chipset) { 914 switch (amiga_chipset) {
919 case CS_OCS: 915 case CS_OCS:
920 type = "OCS"; 916 type = "OCS";
921 break; 917 break;
922 case CS_ECS: 918 case CS_ECS:
923 type = "ECS"; 919 type = "ECS";
924 break; 920 break;
925 case CS_AGA: 921 case CS_AGA:
926 type = "AGA"; 922 type = "AGA";
927 break; 923 break;
928 default: 924 default:
929 type = "Old or Unknown"; 925 type = "Old or Unknown";
930 break; 926 break;
927 }
928 len += sprintf(buffer+len, "Graphics:\t%s\n", type);
931 } 929 }
932 len += sprintf(buffer+len, "Graphics:\t%s\n", type);
933 }
934 930
935#define AMIGAHW_ANNOUNCE(name, str) \ 931#define AMIGAHW_ANNOUNCE(name, str) \
936 if (AMIGAHW_PRESENT(name)) \ 932 if (AMIGAHW_PRESENT(name)) \
937 len += sprintf (buffer+len, "\t%s\n", str) 933 len += sprintf (buffer+len, "\t%s\n", str)
938 934
939 len += sprintf (buffer + len, "Detected hardware:\n"); 935 len += sprintf (buffer + len, "Detected hardware:\n");
940 936
941 AMIGAHW_ANNOUNCE(AMI_VIDEO, "Amiga Video"); 937 AMIGAHW_ANNOUNCE(AMI_VIDEO, "Amiga Video");
942 AMIGAHW_ANNOUNCE(AMI_BLITTER, "Blitter"); 938 AMIGAHW_ANNOUNCE(AMI_BLITTER, "Blitter");
943 AMIGAHW_ANNOUNCE(AMBER_FF, "Amber Flicker Fixer"); 939 AMIGAHW_ANNOUNCE(AMBER_FF, "Amber Flicker Fixer");
944 AMIGAHW_ANNOUNCE(AMI_AUDIO, "Amiga Audio"); 940 AMIGAHW_ANNOUNCE(AMI_AUDIO, "Amiga Audio");
945 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "Floppy Controller"); 941 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "Floppy Controller");
946 AMIGAHW_ANNOUNCE(A3000_SCSI, "SCSI Controller WD33C93 (A3000 style)"); 942 AMIGAHW_ANNOUNCE(A3000_SCSI, "SCSI Controller WD33C93 (A3000 style)");
947 AMIGAHW_ANNOUNCE(A4000_SCSI, "SCSI Controller NCR53C710 (A4000T style)"); 943 AMIGAHW_ANNOUNCE(A4000_SCSI, "SCSI Controller NCR53C710 (A4000T style)");
948 AMIGAHW_ANNOUNCE(A1200_IDE, "IDE Interface (A1200 style)"); 944 AMIGAHW_ANNOUNCE(A1200_IDE, "IDE Interface (A1200 style)");
949 AMIGAHW_ANNOUNCE(A4000_IDE, "IDE Interface (A4000 style)"); 945 AMIGAHW_ANNOUNCE(A4000_IDE, "IDE Interface (A4000 style)");
950 AMIGAHW_ANNOUNCE(CD_ROM, "Internal CD ROM drive"); 946 AMIGAHW_ANNOUNCE(CD_ROM, "Internal CD ROM drive");
951 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "Keyboard"); 947 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "Keyboard");
952 AMIGAHW_ANNOUNCE(AMI_MOUSE, "Mouse Port"); 948 AMIGAHW_ANNOUNCE(AMI_MOUSE, "Mouse Port");
953 AMIGAHW_ANNOUNCE(AMI_SERIAL, "Serial Port"); 949 AMIGAHW_ANNOUNCE(AMI_SERIAL, "Serial Port");
954 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "Parallel Port"); 950 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "Parallel Port");
955 AMIGAHW_ANNOUNCE(A2000_CLK, "Hardware Clock (A2000 style)"); 951 AMIGAHW_ANNOUNCE(A2000_CLK, "Hardware Clock (A2000 style)");
956 AMIGAHW_ANNOUNCE(A3000_CLK, "Hardware Clock (A3000 style)"); 952 AMIGAHW_ANNOUNCE(A3000_CLK, "Hardware Clock (A3000 style)");
957 AMIGAHW_ANNOUNCE(CHIP_RAM, "Chip RAM"); 953 AMIGAHW_ANNOUNCE(CHIP_RAM, "Chip RAM");
958 AMIGAHW_ANNOUNCE(PAULA, "Paula 8364"); 954 AMIGAHW_ANNOUNCE(PAULA, "Paula 8364");
959 AMIGAHW_ANNOUNCE(DENISE, "Denise 8362"); 955 AMIGAHW_ANNOUNCE(DENISE, "Denise 8362");
960 AMIGAHW_ANNOUNCE(DENISE_HR, "Denise 8373"); 956 AMIGAHW_ANNOUNCE(DENISE_HR, "Denise 8373");
961 AMIGAHW_ANNOUNCE(LISA, "Lisa 8375"); 957 AMIGAHW_ANNOUNCE(LISA, "Lisa 8375");
962 AMIGAHW_ANNOUNCE(AGNUS_PAL, "Normal/Fat PAL Agnus 8367/8371"); 958 AMIGAHW_ANNOUNCE(AGNUS_PAL, "Normal/Fat PAL Agnus 8367/8371");
963 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "Normal/Fat NTSC Agnus 8361/8370"); 959 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "Normal/Fat NTSC Agnus 8361/8370");
964 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "Fat Hires PAL Agnus 8372"); 960 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "Fat Hires PAL Agnus 8372");
965 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "Fat Hires NTSC Agnus 8372"); 961 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "Fat Hires NTSC Agnus 8372");
966 AMIGAHW_ANNOUNCE(ALICE_PAL, "PAL Alice 8374"); 962 AMIGAHW_ANNOUNCE(ALICE_PAL, "PAL Alice 8374");
967 AMIGAHW_ANNOUNCE(ALICE_NTSC, "NTSC Alice 8374"); 963 AMIGAHW_ANNOUNCE(ALICE_NTSC, "NTSC Alice 8374");
968 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "Magic Hard Rekick"); 964 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "Magic Hard Rekick");
969 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA Slot"); 965 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA Slot");
970#ifdef CONFIG_ZORRO 966#ifdef CONFIG_ZORRO
971 if (AMIGAHW_PRESENT(ZORRO)) 967 if (AMIGAHW_PRESENT(ZORRO))
972 len += sprintf(buffer+len, "\tZorro II%s AutoConfig: %d Expansion " 968 len += sprintf(buffer+len, "\tZorro II%s AutoConfig: %d Expansion "
973 "Device%s\n", 969 "Device%s\n",
974 AMIGAHW_PRESENT(ZORRO3) ? "I" : "", 970 AMIGAHW_PRESENT(ZORRO3) ? "I" : "",
975 zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s"); 971 zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s");
976#endif /* CONFIG_ZORRO */ 972#endif /* CONFIG_ZORRO */
977 973
978#undef AMIGAHW_ANNOUNCE 974#undef AMIGAHW_ANNOUNCE
979 975
980 return(len); 976 return len;
981} 977}