This source file includes following definitions.
- dummy_waitbut
- setup_arch
- setkeycode
- getkeycode
- get_cpuinfo
- get_hardware_list
- floppy_init
- floppy_setup
- arch_kbd_init
- arch_gettod
- video_setup
1
2
3
4
5
6
7
8
9
10
11 #include <linux/config.h>
12 #include <linux/kernel.h>
13 #include <linux/sched.h>
14 #include <linux/delay.h>
15 #include <linux/interrupt.h>
16 #include <linux/fs.h>
17 #include <linux/console.h>
18 #include <linux/genhd.h>
19 #include <linux/errno.h>
20 #include <linux/string.h>
21
22 #include <asm/bootinfo.h>
23 #include <asm/irq.h>
24 #include <asm/machdep.h>
25 #include <asm/amigatypes.h>
26 #include <asm/amigahw.h>
27
28 #ifdef CONFIG_BLK_DEV_INITRD
29 #include <linux/blk.h>
30 #include <asm/pgtable.h>
31 #endif
32
33 struct bootinfo boot_info = {0,};
34 int bisize = sizeof boot_info;
35
36 int m68k_is040or060 = 0;
37
38 char m68k_debug_device[6] = "";
39
40 extern int end;
41 extern unsigned long availmem;
42
43 char saved_command_line[CL_SIZE];
44
45
46 static void dummy_waitbut(void)
47 {
48 }
49
50 void (*mach_sched_init) (isrfunc);
51 int (*mach_keyb_init) (void);
52 int (*mach_kbdrate) (struct kbd_repeat *) = NULL;
53 void (*mach_kbd_leds) (unsigned int) = NULL;
54 void (*mach_init_INTS) (void);
55 int (*mach_add_isr) (unsigned long, isrfunc, int, void *, char *);
56 int (*mach_remove_isr) (unsigned long, isrfunc);
57 void (*mach_process_int) (int, struct pt_regs *) = NULL;
58 void (*mach_enable_irq) (unsigned) = NULL;
59 void (*mach_disable_irq) (unsigned) = NULL;
60 int (*mach_get_irq_list) (char *, int) = NULL;
61 unsigned long (*mach_gettimeoffset) (void);
62 void (*mach_gettod) (int*, int*, int*, int*, int*, int*);
63 int (*mach_hwclk) (int, struct hwclk_time*) = NULL;
64 int (*mach_set_clock_mmss) (unsigned long) = NULL;
65 void (*mach_mksound)( unsigned int count, unsigned int ticks );
66 void (*mach_reset)( void );
67 void (*waitbut)(void) = dummy_waitbut;
68 struct fb_info *(*mach_fb_init)(long *);
69 long mach_max_dma_address = 0x00ffffff;
70 void (*mach_debug_init)(void);
71 void (*mach_video_setup) (char *, int *);
72 #ifdef CONFIG_BLK_DEV_FD
73 int (*mach_floppy_init) (void) = NULL;
74 void (*mach_floppy_setup) (char *, int *) = NULL;
75 #endif
76
77 extern void config_amiga(void);
78 extern void config_atari(void);
79 extern void config_mac(void);
80
81 extern void register_console(void (*proc)(const char *));
82 extern void ami_serial_print (const char *str);
83 extern void ata_serial_print (const char *str);
84
85 extern void (*kd_mksound)(unsigned int, unsigned int);
86
87 extern void amiga_get_model(char *model);
88 extern void atari_get_model(char *model);
89 extern void mac_get_model(char *model);
90 extern int amiga_get_hardware_list(char *buffer);
91 extern int atari_get_hardware_list(char *buffer);
92 extern int mac_get_hardware_list(char *buffer);
93
94 #define MASK_256K 0xfffc0000
95
96 void setup_arch(char **cmdline_p,
97 unsigned long * memory_start_p, unsigned long * memory_end_p)
98 {
99 unsigned long memory_start, memory_end;
100 extern int _etext, _edata, _end;
101 int i;
102 char *p, *q;
103
104 #ifdef CONFIG_AMIGA
105 if (MACH_IS_AMIGA)
106 register_console (ami_serial_print);
107 #endif
108 #ifdef CONFIG_ATARI
109 if (MACH_IS_ATARI)
110 register_console (ata_serial_print);
111 #endif
112
113 if (boot_info.cputype & CPU_68040)
114 m68k_is040or060 = 4;
115 else if (boot_info.cputype & CPU_68060)
116 m68k_is040or060 = 6;
117
118 memory_start = availmem;
119 memory_end = 0;
120
121 for (i = 0; i < boot_info.num_memory; i++)
122 memory_end += boot_info.memory[i].size & MASK_256K;
123
124 init_task.mm->start_code = 0;
125 init_task.mm->end_code = (unsigned long) &_etext;
126 init_task.mm->end_data = (unsigned long) &_edata;
127 init_task.mm->brk = (unsigned long) &_end;
128
129 *cmdline_p = boot_info.command_line;
130 memcpy(saved_command_line, *cmdline_p, CL_SIZE);
131
132
133
134
135
136 for( p = *cmdline_p; p && *p; ) {
137 i = 0;
138 if (!strncmp( p, "debug=", 6 )) {
139 strncpy( m68k_debug_device, p+6, sizeof(m68k_debug_device)-1 );
140 m68k_debug_device[sizeof(m68k_debug_device)-1] = 0;
141 if ((q = strchr( m68k_debug_device, ' ' ))) *q = 0;
142 i = 1;
143 }
144
145 if (i) {
146
147 if ((q = strchr( p, ' ' )))
148 strcpy( p, q+1 );
149 else
150 *p = 0;
151 } else {
152 if ((p = strchr( p, ' ' ))) ++p;
153 }
154 }
155
156 *memory_start_p = memory_start;
157 *memory_end_p = memory_end;
158
159 switch (boot_info.machtype) {
160 #ifdef CONFIG_AMIGA
161 case MACH_AMIGA:
162 config_amiga();
163 break;
164 #endif
165 #ifdef CONFIG_ATARI
166 case MACH_ATARI:
167 config_atari();
168 break;
169 #endif
170 #ifdef CONFIG_MAC
171 case MACH_MAC:
172 config_mac();
173 break;
174 #endif
175 default:
176 panic ("No configuration setup");
177 }
178
179 #ifdef CONFIG_BLK_DEV_INITRD
180 if (boot_info.ramdisk_size) {
181 initrd_start = PTOV (boot_info.ramdisk_addr);
182 initrd_end = initrd_start + boot_info.ramdisk_size * 1024;
183 }
184 #endif
185 }
186
187 int setkeycode(unsigned int scancode, unsigned int keycode)
188 {
189 return -EOPNOTSUPP;
190 }
191
192 int getkeycode(unsigned int scancode)
193 {
194 return -EOPNOTSUPP;
195 }
196
197 int get_cpuinfo(char * buffer)
198 {
199 char *cpu, *mmu, *fpu;
200 u_long clockfreq, clockfactor;
201
202 #define CLOCK_FACTOR_68020 (8046)
203 #define CLOCK_FACTOR_68030 (8010)
204 #define CLOCK_FACTOR_68040 (3010)
205 #define CLOCK_FACTOR_68060 (998)
206
207 if (boot_info.cputype & CPU_68020) {
208 cpu = "68020";
209 mmu = "68851";
210 clockfactor = CLOCK_FACTOR_68020;
211 } else if (boot_info.cputype & CPU_68030) {
212 cpu = mmu = "68030";
213 clockfactor = CLOCK_FACTOR_68030;
214 } else if (boot_info.cputype & CPU_68040) {
215 cpu = mmu = "68040";
216 clockfactor = CLOCK_FACTOR_68040;
217 } else if (boot_info.cputype & CPU_68060) {
218 cpu = mmu = "68060";
219 clockfactor = CLOCK_FACTOR_68060;
220 } else {
221 cpu = mmu = "680x0";
222 clockfactor = 0;
223 }
224
225 if (boot_info.cputype & FPU_68881)
226 fpu = "68881";
227 else if (boot_info.cputype & FPU_68882)
228 fpu = "68882";
229 else if (boot_info.cputype & FPU_68040)
230 fpu = "68040";
231 else if (boot_info.cputype & FPU_68060)
232 fpu = "68060";
233 else
234 fpu = "none";
235
236 clockfreq = loops_per_sec/1000*clockfactor;
237
238 return(sprintf(buffer, "CPU:\t\t%s\n"
239 "MMU:\t\t%s\n"
240 "FPU:\t\t%s\n"
241 "Clockspeed:\t%lu.%1luMHz\n"
242 "BogoMips:\t%lu.%02lu\n",
243 cpu, mmu, fpu, clockfreq/1000000,
244 ((clockfreq+50000)/100000)%10, loops_per_sec/500000,
245 (loops_per_sec/5000)%100));
246 }
247
248 int get_hardware_list(char *buffer)
249 {
250 int len = 0;
251 char model[80];
252 u_long mem;
253 int i;
254
255 switch (boot_info.machtype) {
256 #ifdef CONFIG_AMIGA
257 case MACH_AMIGA:
258 amiga_get_model(model);
259 break;
260 #endif
261 #ifdef CONFIG_ATARI
262 case MACH_ATARI:
263 atari_get_model(model);
264 break;
265 #endif
266 #ifdef CONFIG_MAC
267 case MACH_MAC:
268 mac_get_model(model);
269 break;
270 #endif
271 default:
272 strcpy(model, "Unknown m68k");
273 }
274
275 len += sprintf(buffer+len, "Model:\t\t%s\n", model);
276 len += get_cpuinfo(buffer+len);
277 for (mem = 0, i = 0; i < boot_info.num_memory; i++)
278 mem += boot_info.memory[i].size;
279 len += sprintf(buffer+len, "System Memory:\t%ldK\n", mem>>10);
280
281 switch (boot_info.machtype) {
282 #ifdef CONFIG_AMIGA
283 case MACH_AMIGA:
284 len += amiga_get_hardware_list(buffer+len);
285 break;
286 #endif
287 #ifdef CONFIG_ATARI
288 case MACH_ATARI:
289 len += atari_get_hardware_list(buffer+len);
290 break;
291 #endif
292 #ifdef CONFIG_MAC
293 case MACH_MAC:
294 break;
295 #endif
296 }
297
298 return(len);
299 }
300
301 #ifdef CONFIG_BLK_DEV_FD
302 int floppy_init(void)
303 {
304 if (mach_floppy_init)
305 return mach_floppy_init();
306 else
307 return 0;
308 }
309
310 void floppy_setup(char *str, int *ints)
311 {
312 if (mach_floppy_setup)
313 mach_floppy_setup (str, ints);
314 }
315 #endif
316
317 unsigned long arch_kbd_init(void)
318 {
319 return mach_keyb_init();
320 }
321
322 void arch_gettod(int *year, int *mon, int *day, int *hour,
323 int *min, int *sec)
324 {
325 if (mach_gettod)
326 mach_gettod(year, mon, day, hour, min, sec);
327 else
328 *year = *mon = *day = *hour = *min = *sec = 0;
329 }
330
331 void video_setup (char *options, int *ints)
332 {
333 if (mach_video_setup)
334 mach_video_setup (options, ints);
335 }