xref: /linux/arch/m68k/kernel/setup_mm.c (revision 0a2796da1182a7dcfba41f796f45986237bc1688)
166d857b0SGreg Ungerer /*
266d857b0SGreg Ungerer  *  linux/arch/m68k/kernel/setup.c
366d857b0SGreg Ungerer  *
466d857b0SGreg Ungerer  *  Copyright (C) 1995  Hamish Macdonald
566d857b0SGreg Ungerer  */
666d857b0SGreg Ungerer 
766d857b0SGreg Ungerer /*
866d857b0SGreg Ungerer  * This file handles the architecture-dependent parts of system setup
966d857b0SGreg Ungerer  */
1066d857b0SGreg Ungerer 
1166d857b0SGreg Ungerer #include <linux/kernel.h>
1266d857b0SGreg Ungerer #include <linux/mm.h>
1366d857b0SGreg Ungerer #include <linux/sched.h>
1466d857b0SGreg Ungerer #include <linux/delay.h>
1566d857b0SGreg Ungerer #include <linux/interrupt.h>
1666d857b0SGreg Ungerer #include <linux/fs.h>
1766d857b0SGreg Ungerer #include <linux/console.h>
1866d857b0SGreg Ungerer #include <linux/genhd.h>
1966d857b0SGreg Ungerer #include <linux/errno.h>
2066d857b0SGreg Ungerer #include <linux/string.h>
2166d857b0SGreg Ungerer #include <linux/init.h>
2266d857b0SGreg Ungerer #include <linux/bootmem.h>
2366d857b0SGreg Ungerer #include <linux/proc_fs.h>
2466d857b0SGreg Ungerer #include <linux/seq_file.h>
2566d857b0SGreg Ungerer #include <linux/module.h>
2666d857b0SGreg Ungerer #include <linux/initrd.h>
2766d857b0SGreg Ungerer 
2866d857b0SGreg Ungerer #include <asm/bootinfo.h>
2966d857b0SGreg Ungerer #include <asm/sections.h>
3066d857b0SGreg Ungerer #include <asm/setup.h>
3166d857b0SGreg Ungerer #include <asm/fpu.h>
3266d857b0SGreg Ungerer #include <asm/irq.h>
3366d857b0SGreg Ungerer #include <asm/io.h>
3466d857b0SGreg Ungerer #include <asm/machdep.h>
3566d857b0SGreg Ungerer #ifdef CONFIG_AMIGA
3666d857b0SGreg Ungerer #include <asm/amigahw.h>
3766d857b0SGreg Ungerer #endif
3866d857b0SGreg Ungerer #ifdef CONFIG_ATARI
3966d857b0SGreg Ungerer #include <asm/atarihw.h>
4066d857b0SGreg Ungerer #include <asm/atari_stram.h>
4166d857b0SGreg Ungerer #endif
4266d857b0SGreg Ungerer #ifdef CONFIG_SUN3X
4366d857b0SGreg Ungerer #include <asm/dvma.h>
4466d857b0SGreg Ungerer #endif
4566d857b0SGreg Ungerer #include <asm/natfeat.h>
4666d857b0SGreg Ungerer 
4766d857b0SGreg Ungerer #if !FPSTATESIZE || !NR_IRQS
4866d857b0SGreg Ungerer #warning No CPU/platform type selected, your kernel will not work!
4966d857b0SGreg Ungerer #warning Are you building an allnoconfig kernel?
5066d857b0SGreg Ungerer #endif
5166d857b0SGreg Ungerer 
5266d857b0SGreg Ungerer unsigned long m68k_machtype;
5366d857b0SGreg Ungerer EXPORT_SYMBOL(m68k_machtype);
5466d857b0SGreg Ungerer unsigned long m68k_cputype;
5566d857b0SGreg Ungerer EXPORT_SYMBOL(m68k_cputype);
5666d857b0SGreg Ungerer unsigned long m68k_fputype;
5766d857b0SGreg Ungerer unsigned long m68k_mmutype;
5866d857b0SGreg Ungerer EXPORT_SYMBOL(m68k_mmutype);
5966d857b0SGreg Ungerer #ifdef CONFIG_VME
6066d857b0SGreg Ungerer unsigned long vme_brdtype;
6166d857b0SGreg Ungerer EXPORT_SYMBOL(vme_brdtype);
6266d857b0SGreg Ungerer #endif
6366d857b0SGreg Ungerer 
6466d857b0SGreg Ungerer int m68k_is040or060;
6566d857b0SGreg Ungerer EXPORT_SYMBOL(m68k_is040or060);
6666d857b0SGreg Ungerer 
6766d857b0SGreg Ungerer extern unsigned long availmem;
6866d857b0SGreg Ungerer 
6966d857b0SGreg Ungerer int m68k_num_memory;
7066d857b0SGreg Ungerer EXPORT_SYMBOL(m68k_num_memory);
7166d857b0SGreg Ungerer int m68k_realnum_memory;
7266d857b0SGreg Ungerer EXPORT_SYMBOL(m68k_realnum_memory);
7366d857b0SGreg Ungerer unsigned long m68k_memoffset;
7466d857b0SGreg Ungerer struct mem_info m68k_memory[NUM_MEMINFO];
7566d857b0SGreg Ungerer EXPORT_SYMBOL(m68k_memory);
7666d857b0SGreg Ungerer 
7766d857b0SGreg Ungerer struct mem_info m68k_ramdisk;
7866d857b0SGreg Ungerer 
7966d857b0SGreg Ungerer static char m68k_command_line[CL_SIZE];
8066d857b0SGreg Ungerer 
8166d857b0SGreg Ungerer void (*mach_sched_init) (irq_handler_t handler) __initdata = NULL;
8266d857b0SGreg Ungerer /* machine dependent irq functions */
8366d857b0SGreg Ungerer void (*mach_init_IRQ) (void) __initdata = NULL;
8466d857b0SGreg Ungerer void (*mach_get_model) (char *model);
8566d857b0SGreg Ungerer void (*mach_get_hardware_list) (struct seq_file *m);
8666d857b0SGreg Ungerer /* machine dependent timer functions */
8766d857b0SGreg Ungerer unsigned long (*mach_gettimeoffset) (void);
8866d857b0SGreg Ungerer int (*mach_hwclk) (int, struct rtc_time*);
8966d857b0SGreg Ungerer EXPORT_SYMBOL(mach_hwclk);
9066d857b0SGreg Ungerer int (*mach_set_clock_mmss) (unsigned long);
9166d857b0SGreg Ungerer unsigned int (*mach_get_ss)(void);
9266d857b0SGreg Ungerer int (*mach_get_rtc_pll)(struct rtc_pll_info *);
9366d857b0SGreg Ungerer int (*mach_set_rtc_pll)(struct rtc_pll_info *);
9466d857b0SGreg Ungerer EXPORT_SYMBOL(mach_get_ss);
9566d857b0SGreg Ungerer EXPORT_SYMBOL(mach_get_rtc_pll);
9666d857b0SGreg Ungerer EXPORT_SYMBOL(mach_set_rtc_pll);
9766d857b0SGreg Ungerer void (*mach_reset)( void );
9866d857b0SGreg Ungerer void (*mach_halt)( void );
9966d857b0SGreg Ungerer void (*mach_power_off)( void );
10066d857b0SGreg Ungerer long mach_max_dma_address = 0x00ffffff; /* default set to the lower 16MB */
10166d857b0SGreg Ungerer #ifdef CONFIG_HEARTBEAT
10266d857b0SGreg Ungerer void (*mach_heartbeat) (int);
10366d857b0SGreg Ungerer EXPORT_SYMBOL(mach_heartbeat);
10466d857b0SGreg Ungerer #endif
10566d857b0SGreg Ungerer #ifdef CONFIG_M68K_L2_CACHE
10666d857b0SGreg Ungerer void (*mach_l2_flush) (int);
10766d857b0SGreg Ungerer #endif
10866d857b0SGreg Ungerer #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
10966d857b0SGreg Ungerer void (*mach_beep)(unsigned int, unsigned int);
11066d857b0SGreg Ungerer EXPORT_SYMBOL(mach_beep);
11166d857b0SGreg Ungerer #endif
11266d857b0SGreg Ungerer #if defined(CONFIG_ISA) && defined(MULTI_ISA)
11366d857b0SGreg Ungerer int isa_type;
11466d857b0SGreg Ungerer int isa_sex;
11566d857b0SGreg Ungerer EXPORT_SYMBOL(isa_type);
11666d857b0SGreg Ungerer EXPORT_SYMBOL(isa_sex);
11766d857b0SGreg Ungerer #endif
11866d857b0SGreg Ungerer 
11966d857b0SGreg Ungerer extern int amiga_parse_bootinfo(const struct bi_record *);
12066d857b0SGreg Ungerer extern int atari_parse_bootinfo(const struct bi_record *);
12166d857b0SGreg Ungerer extern int mac_parse_bootinfo(const struct bi_record *);
12266d857b0SGreg Ungerer extern int q40_parse_bootinfo(const struct bi_record *);
12366d857b0SGreg Ungerer extern int bvme6000_parse_bootinfo(const struct bi_record *);
12466d857b0SGreg Ungerer extern int mvme16x_parse_bootinfo(const struct bi_record *);
12566d857b0SGreg Ungerer extern int mvme147_parse_bootinfo(const struct bi_record *);
12666d857b0SGreg Ungerer extern int hp300_parse_bootinfo(const struct bi_record *);
12766d857b0SGreg Ungerer extern int apollo_parse_bootinfo(const struct bi_record *);
12866d857b0SGreg Ungerer 
12966d857b0SGreg Ungerer extern void config_amiga(void);
13066d857b0SGreg Ungerer extern void config_atari(void);
13166d857b0SGreg Ungerer extern void config_mac(void);
13266d857b0SGreg Ungerer extern void config_sun3(void);
13366d857b0SGreg Ungerer extern void config_apollo(void);
13466d857b0SGreg Ungerer extern void config_mvme147(void);
13566d857b0SGreg Ungerer extern void config_mvme16x(void);
13666d857b0SGreg Ungerer extern void config_bvme6000(void);
13766d857b0SGreg Ungerer extern void config_hp300(void);
13866d857b0SGreg Ungerer extern void config_q40(void);
13966d857b0SGreg Ungerer extern void config_sun3x(void);
14066d857b0SGreg Ungerer 
14166d857b0SGreg Ungerer #define MASK_256K 0xfffc0000
14266d857b0SGreg Ungerer 
14366d857b0SGreg Ungerer extern void paging_init(void);
14466d857b0SGreg Ungerer 
14566d857b0SGreg Ungerer static void __init m68k_parse_bootinfo(const struct bi_record *record)
14666d857b0SGreg Ungerer {
14766d857b0SGreg Ungerer 	while (record->tag != BI_LAST) {
14866d857b0SGreg Ungerer 		int unknown = 0;
14966d857b0SGreg Ungerer 		const unsigned long *data = record->data;
15066d857b0SGreg Ungerer 
15166d857b0SGreg Ungerer 		switch (record->tag) {
15266d857b0SGreg Ungerer 		case BI_MACHTYPE:
15366d857b0SGreg Ungerer 		case BI_CPUTYPE:
15466d857b0SGreg Ungerer 		case BI_FPUTYPE:
15566d857b0SGreg Ungerer 		case BI_MMUTYPE:
15666d857b0SGreg Ungerer 			/* Already set up by head.S */
15766d857b0SGreg Ungerer 			break;
15866d857b0SGreg Ungerer 
15966d857b0SGreg Ungerer 		case BI_MEMCHUNK:
16066d857b0SGreg Ungerer 			if (m68k_num_memory < NUM_MEMINFO) {
16166d857b0SGreg Ungerer 				m68k_memory[m68k_num_memory].addr = data[0];
16266d857b0SGreg Ungerer 				m68k_memory[m68k_num_memory].size = data[1];
16366d857b0SGreg Ungerer 				m68k_num_memory++;
16466d857b0SGreg Ungerer 			} else
16566d857b0SGreg Ungerer 				printk("m68k_parse_bootinfo: too many memory chunks\n");
16666d857b0SGreg Ungerer 			break;
16766d857b0SGreg Ungerer 
16866d857b0SGreg Ungerer 		case BI_RAMDISK:
16966d857b0SGreg Ungerer 			m68k_ramdisk.addr = data[0];
17066d857b0SGreg Ungerer 			m68k_ramdisk.size = data[1];
17166d857b0SGreg Ungerer 			break;
17266d857b0SGreg Ungerer 
17366d857b0SGreg Ungerer 		case BI_COMMAND_LINE:
17466d857b0SGreg Ungerer 			strlcpy(m68k_command_line, (const char *)data,
17566d857b0SGreg Ungerer 				sizeof(m68k_command_line));
17666d857b0SGreg Ungerer 			break;
17766d857b0SGreg Ungerer 
17866d857b0SGreg Ungerer 		default:
17966d857b0SGreg Ungerer 			if (MACH_IS_AMIGA)
18066d857b0SGreg Ungerer 				unknown = amiga_parse_bootinfo(record);
18166d857b0SGreg Ungerer 			else if (MACH_IS_ATARI)
18266d857b0SGreg Ungerer 				unknown = atari_parse_bootinfo(record);
18366d857b0SGreg Ungerer 			else if (MACH_IS_MAC)
18466d857b0SGreg Ungerer 				unknown = mac_parse_bootinfo(record);
18566d857b0SGreg Ungerer 			else if (MACH_IS_Q40)
18666d857b0SGreg Ungerer 				unknown = q40_parse_bootinfo(record);
18766d857b0SGreg Ungerer 			else if (MACH_IS_BVME6000)
18866d857b0SGreg Ungerer 				unknown = bvme6000_parse_bootinfo(record);
18966d857b0SGreg Ungerer 			else if (MACH_IS_MVME16x)
19066d857b0SGreg Ungerer 				unknown = mvme16x_parse_bootinfo(record);
19166d857b0SGreg Ungerer 			else if (MACH_IS_MVME147)
19266d857b0SGreg Ungerer 				unknown = mvme147_parse_bootinfo(record);
19366d857b0SGreg Ungerer 			else if (MACH_IS_HP300)
19466d857b0SGreg Ungerer 				unknown = hp300_parse_bootinfo(record);
19566d857b0SGreg Ungerer 			else if (MACH_IS_APOLLO)
19666d857b0SGreg Ungerer 				unknown = apollo_parse_bootinfo(record);
19766d857b0SGreg Ungerer 			else
19866d857b0SGreg Ungerer 				unknown = 1;
19966d857b0SGreg Ungerer 		}
20066d857b0SGreg Ungerer 		if (unknown)
20166d857b0SGreg Ungerer 			printk("m68k_parse_bootinfo: unknown tag 0x%04x ignored\n",
20266d857b0SGreg Ungerer 			       record->tag);
20366d857b0SGreg Ungerer 		record = (struct bi_record *)((unsigned long)record +
20466d857b0SGreg Ungerer 					      record->size);
20566d857b0SGreg Ungerer 	}
20666d857b0SGreg Ungerer 
20766d857b0SGreg Ungerer 	m68k_realnum_memory = m68k_num_memory;
20866d857b0SGreg Ungerer #ifdef CONFIG_SINGLE_MEMORY_CHUNK
20966d857b0SGreg Ungerer 	if (m68k_num_memory > 1) {
21066d857b0SGreg Ungerer 		printk("Ignoring last %i chunks of physical memory\n",
21166d857b0SGreg Ungerer 		       (m68k_num_memory - 1));
21266d857b0SGreg Ungerer 		m68k_num_memory = 1;
21366d857b0SGreg Ungerer 	}
21466d857b0SGreg Ungerer #endif
21566d857b0SGreg Ungerer }
21666d857b0SGreg Ungerer 
21766d857b0SGreg Ungerer void __init setup_arch(char **cmdline_p)
21866d857b0SGreg Ungerer {
219b2cb9241SGeert Uytterhoeven #ifndef CONFIG_SUN3
22066d857b0SGreg Ungerer 	int i;
221b2cb9241SGeert Uytterhoeven #endif
22266d857b0SGreg Ungerer 
22366d857b0SGreg Ungerer 	/* The bootinfo is located right after the kernel bss */
22437314540SGreg Ungerer 	if (!CPU_IS_COLDFIRE)
22566d857b0SGreg Ungerer 		m68k_parse_bootinfo((const struct bi_record *)_end);
22666d857b0SGreg Ungerer 
22766d857b0SGreg Ungerer 	if (CPU_IS_040)
22866d857b0SGreg Ungerer 		m68k_is040or060 = 4;
22966d857b0SGreg Ungerer 	else if (CPU_IS_060)
23066d857b0SGreg Ungerer 		m68k_is040or060 = 6;
23166d857b0SGreg Ungerer 
23266d857b0SGreg Ungerer 	/* FIXME: m68k_fputype is passed in by Penguin booter, which can
23366d857b0SGreg Ungerer 	 * be confused by software FPU emulation. BEWARE.
23466d857b0SGreg Ungerer 	 * We should really do our own FPU check at startup.
23566d857b0SGreg Ungerer 	 * [what do we do with buggy 68LC040s? if we have problems
23666d857b0SGreg Ungerer 	 *  with them, we should add a test to check_bugs() below] */
23766d857b0SGreg Ungerer #ifndef CONFIG_M68KFPU_EMU_ONLY
23866d857b0SGreg Ungerer 	/* clear the fpu if we have one */
239*0a2796daSGreg Ungerer 	if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060|FPU_COLDFIRE)) {
24066d857b0SGreg Ungerer 		volatile int zero = 0;
24166d857b0SGreg Ungerer 		asm volatile ("frestore %0" : : "m" (zero));
24266d857b0SGreg Ungerer 	}
24366d857b0SGreg Ungerer #endif
24466d857b0SGreg Ungerer 
24566d857b0SGreg Ungerer 	if (CPU_IS_060) {
24666d857b0SGreg Ungerer 		u32 pcr;
24766d857b0SGreg Ungerer 
24866d857b0SGreg Ungerer 		asm (".chip 68060; movec %%pcr,%0; .chip 68k"
24966d857b0SGreg Ungerer 		     : "=d" (pcr));
25066d857b0SGreg Ungerer 		if (((pcr >> 8) & 0xff) <= 5) {
25166d857b0SGreg Ungerer 			printk("Enabling workaround for errata I14\n");
25266d857b0SGreg Ungerer 			asm (".chip 68060; movec %0,%%pcr; .chip 68k"
25366d857b0SGreg Ungerer 			     : : "d" (pcr | 0x20));
25466d857b0SGreg Ungerer 		}
25566d857b0SGreg Ungerer 	}
25666d857b0SGreg Ungerer 
25766d857b0SGreg Ungerer 	init_mm.start_code = PAGE_OFFSET;
25866d857b0SGreg Ungerer 	init_mm.end_code = (unsigned long)_etext;
25966d857b0SGreg Ungerer 	init_mm.end_data = (unsigned long)_edata;
26066d857b0SGreg Ungerer 	init_mm.brk = (unsigned long)_end;
26166d857b0SGreg Ungerer 
262d1db9120SGreg Ungerer #if defined(CONFIG_BOOTPARAM)
263d1db9120SGreg Ungerer 	strncpy(m68k_command_line, CONFIG_BOOTPARAM_STRING, CL_SIZE);
264d1db9120SGreg Ungerer 	m68k_command_line[CL_SIZE - 1] = 0;
265d1db9120SGreg Ungerer #endif /* CONFIG_BOOTPARAM */
26666d857b0SGreg Ungerer 	*cmdline_p = m68k_command_line;
26766d857b0SGreg Ungerer 	memcpy(boot_command_line, *cmdline_p, CL_SIZE);
26866d857b0SGreg Ungerer 
26966d857b0SGreg Ungerer 	parse_early_param();
27066d857b0SGreg Ungerer 
27166d857b0SGreg Ungerer #ifdef CONFIG_DUMMY_CONSOLE
27266d857b0SGreg Ungerer 	conswitchp = &dummy_con;
27366d857b0SGreg Ungerer #endif
27466d857b0SGreg Ungerer 
27566d857b0SGreg Ungerer 	switch (m68k_machtype) {
27666d857b0SGreg Ungerer #ifdef CONFIG_AMIGA
27766d857b0SGreg Ungerer 	case MACH_AMIGA:
27866d857b0SGreg Ungerer 		config_amiga();
27966d857b0SGreg Ungerer 		break;
28066d857b0SGreg Ungerer #endif
28166d857b0SGreg Ungerer #ifdef CONFIG_ATARI
28266d857b0SGreg Ungerer 	case MACH_ATARI:
28366d857b0SGreg Ungerer 		config_atari();
28466d857b0SGreg Ungerer 		break;
28566d857b0SGreg Ungerer #endif
28666d857b0SGreg Ungerer #ifdef CONFIG_MAC
28766d857b0SGreg Ungerer 	case MACH_MAC:
28866d857b0SGreg Ungerer 		config_mac();
28966d857b0SGreg Ungerer 		break;
29066d857b0SGreg Ungerer #endif
29166d857b0SGreg Ungerer #ifdef CONFIG_SUN3
29266d857b0SGreg Ungerer 	case MACH_SUN3:
29366d857b0SGreg Ungerer 		config_sun3();
29466d857b0SGreg Ungerer 		break;
29566d857b0SGreg Ungerer #endif
29666d857b0SGreg Ungerer #ifdef CONFIG_APOLLO
29766d857b0SGreg Ungerer 	case MACH_APOLLO:
29866d857b0SGreg Ungerer 		config_apollo();
29966d857b0SGreg Ungerer 		break;
30066d857b0SGreg Ungerer #endif
30166d857b0SGreg Ungerer #ifdef CONFIG_MVME147
30266d857b0SGreg Ungerer 	case MACH_MVME147:
30366d857b0SGreg Ungerer 		config_mvme147();
30466d857b0SGreg Ungerer 		break;
30566d857b0SGreg Ungerer #endif
30666d857b0SGreg Ungerer #ifdef CONFIG_MVME16x
30766d857b0SGreg Ungerer 	case MACH_MVME16x:
30866d857b0SGreg Ungerer 		config_mvme16x();
30966d857b0SGreg Ungerer 		break;
31066d857b0SGreg Ungerer #endif
31166d857b0SGreg Ungerer #ifdef CONFIG_BVME6000
31266d857b0SGreg Ungerer 	case MACH_BVME6000:
31366d857b0SGreg Ungerer 		config_bvme6000();
31466d857b0SGreg Ungerer 		break;
31566d857b0SGreg Ungerer #endif
31666d857b0SGreg Ungerer #ifdef CONFIG_HP300
31766d857b0SGreg Ungerer 	case MACH_HP300:
31866d857b0SGreg Ungerer 		config_hp300();
31966d857b0SGreg Ungerer 		break;
32066d857b0SGreg Ungerer #endif
32166d857b0SGreg Ungerer #ifdef CONFIG_Q40
32266d857b0SGreg Ungerer 	case MACH_Q40:
32366d857b0SGreg Ungerer 		config_q40();
32466d857b0SGreg Ungerer 		break;
32566d857b0SGreg Ungerer #endif
32666d857b0SGreg Ungerer #ifdef CONFIG_SUN3X
32766d857b0SGreg Ungerer 	case MACH_SUN3X:
32866d857b0SGreg Ungerer 		config_sun3x();
32966d857b0SGreg Ungerer 		break;
33066d857b0SGreg Ungerer #endif
33137314540SGreg Ungerer #ifdef CONFIG_COLDFIRE
33237314540SGreg Ungerer 	case MACH_M54XX:
33337314540SGreg Ungerer 		config_BSP(NULL, 0);
33437314540SGreg Ungerer 		break;
33537314540SGreg Ungerer #endif
33666d857b0SGreg Ungerer 	default:
33766d857b0SGreg Ungerer 		panic("No configuration setup");
33866d857b0SGreg Ungerer 	}
33966d857b0SGreg Ungerer 
34066d857b0SGreg Ungerer #ifdef CONFIG_NATFEAT
34166d857b0SGreg Ungerer 	nf_init();
34266d857b0SGreg Ungerer #endif
34366d857b0SGreg Ungerer 
34466d857b0SGreg Ungerer 	paging_init();
34566d857b0SGreg Ungerer 
34666d857b0SGreg Ungerer #ifndef CONFIG_SUN3
34766d857b0SGreg Ungerer 	for (i = 1; i < m68k_num_memory; i++)
34866d857b0SGreg Ungerer 		free_bootmem_node(NODE_DATA(i), m68k_memory[i].addr,
34966d857b0SGreg Ungerer 				  m68k_memory[i].size);
35066d857b0SGreg Ungerer #ifdef CONFIG_BLK_DEV_INITRD
35166d857b0SGreg Ungerer 	if (m68k_ramdisk.size) {
35266d857b0SGreg Ungerer 		reserve_bootmem_node(__virt_to_node(phys_to_virt(m68k_ramdisk.addr)),
35366d857b0SGreg Ungerer 				     m68k_ramdisk.addr, m68k_ramdisk.size,
35466d857b0SGreg Ungerer 				     BOOTMEM_DEFAULT);
35566d857b0SGreg Ungerer 		initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
35666d857b0SGreg Ungerer 		initrd_end = initrd_start + m68k_ramdisk.size;
35766d857b0SGreg Ungerer 		printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
35866d857b0SGreg Ungerer 	}
35966d857b0SGreg Ungerer #endif
36066d857b0SGreg Ungerer 
36166d857b0SGreg Ungerer #ifdef CONFIG_ATARI
36266d857b0SGreg Ungerer 	if (MACH_IS_ATARI)
36366d857b0SGreg Ungerer 		atari_stram_reserve_pages((void *)availmem);
36466d857b0SGreg Ungerer #endif
36566d857b0SGreg Ungerer #ifdef CONFIG_SUN3X
36666d857b0SGreg Ungerer 	if (MACH_IS_SUN3X) {
36766d857b0SGreg Ungerer 		dvma_init();
36866d857b0SGreg Ungerer 	}
36966d857b0SGreg Ungerer #endif
37066d857b0SGreg Ungerer 
37166d857b0SGreg Ungerer #endif /* !CONFIG_SUN3 */
37266d857b0SGreg Ungerer 
37366d857b0SGreg Ungerer /* set ISA defs early as possible */
37466d857b0SGreg Ungerer #if defined(CONFIG_ISA) && defined(MULTI_ISA)
37566d857b0SGreg Ungerer 	if (MACH_IS_Q40) {
37666d857b0SGreg Ungerer 		isa_type = ISA_TYPE_Q40;
37766d857b0SGreg Ungerer 		isa_sex = 0;
37866d857b0SGreg Ungerer 	}
37966d857b0SGreg Ungerer #ifdef CONFIG_AMIGA_PCMCIA
38066d857b0SGreg Ungerer 	if (MACH_IS_AMIGA && AMIGAHW_PRESENT(PCMCIA)) {
38166d857b0SGreg Ungerer 		isa_type = ISA_TYPE_AG;
38266d857b0SGreg Ungerer 		isa_sex = 1;
38366d857b0SGreg Ungerer 	}
38466d857b0SGreg Ungerer #endif
38566d857b0SGreg Ungerer #endif
38666d857b0SGreg Ungerer }
38766d857b0SGreg Ungerer 
38866d857b0SGreg Ungerer static int show_cpuinfo(struct seq_file *m, void *v)
38966d857b0SGreg Ungerer {
39066d857b0SGreg Ungerer 	const char *cpu, *mmu, *fpu;
39166d857b0SGreg Ungerer 	unsigned long clockfreq, clockfactor;
39266d857b0SGreg Ungerer 
39366d857b0SGreg Ungerer #define LOOP_CYCLES_68020	(8)
39466d857b0SGreg Ungerer #define LOOP_CYCLES_68030	(8)
39566d857b0SGreg Ungerer #define LOOP_CYCLES_68040	(3)
39666d857b0SGreg Ungerer #define LOOP_CYCLES_68060	(1)
397060632adSGreg Ungerer #define LOOP_CYCLES_COLDFIRE	(2)
39866d857b0SGreg Ungerer 
39966d857b0SGreg Ungerer 	if (CPU_IS_020) {
40066d857b0SGreg Ungerer 		cpu = "68020";
40166d857b0SGreg Ungerer 		clockfactor = LOOP_CYCLES_68020;
40266d857b0SGreg Ungerer 	} else if (CPU_IS_030) {
40366d857b0SGreg Ungerer 		cpu = "68030";
40466d857b0SGreg Ungerer 		clockfactor = LOOP_CYCLES_68030;
40566d857b0SGreg Ungerer 	} else if (CPU_IS_040) {
40666d857b0SGreg Ungerer 		cpu = "68040";
40766d857b0SGreg Ungerer 		clockfactor = LOOP_CYCLES_68040;
40866d857b0SGreg Ungerer 	} else if (CPU_IS_060) {
40966d857b0SGreg Ungerer 		cpu = "68060";
41066d857b0SGreg Ungerer 		clockfactor = LOOP_CYCLES_68060;
411060632adSGreg Ungerer 	} else if (CPU_IS_COLDFIRE) {
412060632adSGreg Ungerer 		cpu = "ColdFire";
413060632adSGreg Ungerer 		clockfactor = LOOP_CYCLES_COLDFIRE;
41466d857b0SGreg Ungerer 	} else {
41566d857b0SGreg Ungerer 		cpu = "680x0";
41666d857b0SGreg Ungerer 		clockfactor = 0;
41766d857b0SGreg Ungerer 	}
41866d857b0SGreg Ungerer 
41966d857b0SGreg Ungerer #ifdef CONFIG_M68KFPU_EMU_ONLY
42066d857b0SGreg Ungerer 	fpu = "none(soft float)";
42166d857b0SGreg Ungerer #else
42266d857b0SGreg Ungerer 	if (m68k_fputype & FPU_68881)
42366d857b0SGreg Ungerer 		fpu = "68881";
42466d857b0SGreg Ungerer 	else if (m68k_fputype & FPU_68882)
42566d857b0SGreg Ungerer 		fpu = "68882";
42666d857b0SGreg Ungerer 	else if (m68k_fputype & FPU_68040)
42766d857b0SGreg Ungerer 		fpu = "68040";
42866d857b0SGreg Ungerer 	else if (m68k_fputype & FPU_68060)
42966d857b0SGreg Ungerer 		fpu = "68060";
43066d857b0SGreg Ungerer 	else if (m68k_fputype & FPU_SUNFPA)
43166d857b0SGreg Ungerer 		fpu = "Sun FPA";
432060632adSGreg Ungerer 	else if (m68k_fputype & FPU_COLDFIRE)
433060632adSGreg Ungerer 		fpu = "ColdFire";
43466d857b0SGreg Ungerer 	else
43566d857b0SGreg Ungerer 		fpu = "none";
43666d857b0SGreg Ungerer #endif
43766d857b0SGreg Ungerer 
43866d857b0SGreg Ungerer 	if (m68k_mmutype & MMU_68851)
43966d857b0SGreg Ungerer 		mmu = "68851";
44066d857b0SGreg Ungerer 	else if (m68k_mmutype & MMU_68030)
44166d857b0SGreg Ungerer 		mmu = "68030";
44266d857b0SGreg Ungerer 	else if (m68k_mmutype & MMU_68040)
44366d857b0SGreg Ungerer 		mmu = "68040";
44466d857b0SGreg Ungerer 	else if (m68k_mmutype & MMU_68060)
44566d857b0SGreg Ungerer 		mmu = "68060";
44666d857b0SGreg Ungerer 	else if (m68k_mmutype & MMU_SUN3)
44766d857b0SGreg Ungerer 		mmu = "Sun-3";
44866d857b0SGreg Ungerer 	else if (m68k_mmutype & MMU_APOLLO)
44966d857b0SGreg Ungerer 		mmu = "Apollo";
450060632adSGreg Ungerer 	else if (m68k_mmutype & MMU_COLDFIRE)
451060632adSGreg Ungerer 		mmu = "ColdFire";
45266d857b0SGreg Ungerer 	else
45366d857b0SGreg Ungerer 		mmu = "unknown";
45466d857b0SGreg Ungerer 
45566d857b0SGreg Ungerer 	clockfreq = loops_per_jiffy * HZ * clockfactor;
45666d857b0SGreg Ungerer 
45766d857b0SGreg Ungerer 	seq_printf(m, "CPU:\t\t%s\n"
45866d857b0SGreg Ungerer 		   "MMU:\t\t%s\n"
45966d857b0SGreg Ungerer 		   "FPU:\t\t%s\n"
46066d857b0SGreg Ungerer 		   "Clocking:\t%lu.%1luMHz\n"
46166d857b0SGreg Ungerer 		   "BogoMips:\t%lu.%02lu\n"
46266d857b0SGreg Ungerer 		   "Calibration:\t%lu loops\n",
46366d857b0SGreg Ungerer 		   cpu, mmu, fpu,
46466d857b0SGreg Ungerer 		   clockfreq/1000000,(clockfreq/100000)%10,
46566d857b0SGreg Ungerer 		   loops_per_jiffy/(500000/HZ),(loops_per_jiffy/(5000/HZ))%100,
46666d857b0SGreg Ungerer 		   loops_per_jiffy);
46766d857b0SGreg Ungerer 	return 0;
46866d857b0SGreg Ungerer }
46966d857b0SGreg Ungerer 
47066d857b0SGreg Ungerer static void *c_start(struct seq_file *m, loff_t *pos)
47166d857b0SGreg Ungerer {
47266d857b0SGreg Ungerer 	return *pos < 1 ? (void *)1 : NULL;
47366d857b0SGreg Ungerer }
47466d857b0SGreg Ungerer static void *c_next(struct seq_file *m, void *v, loff_t *pos)
47566d857b0SGreg Ungerer {
47666d857b0SGreg Ungerer 	++*pos;
47766d857b0SGreg Ungerer 	return NULL;
47866d857b0SGreg Ungerer }
47966d857b0SGreg Ungerer static void c_stop(struct seq_file *m, void *v)
48066d857b0SGreg Ungerer {
48166d857b0SGreg Ungerer }
48266d857b0SGreg Ungerer const struct seq_operations cpuinfo_op = {
48366d857b0SGreg Ungerer 	.start	= c_start,
48466d857b0SGreg Ungerer 	.next	= c_next,
48566d857b0SGreg Ungerer 	.stop	= c_stop,
48666d857b0SGreg Ungerer 	.show	= show_cpuinfo,
48766d857b0SGreg Ungerer };
48866d857b0SGreg Ungerer 
48966d857b0SGreg Ungerer #ifdef CONFIG_PROC_HARDWARE
49066d857b0SGreg Ungerer static int hardware_proc_show(struct seq_file *m, void *v)
49166d857b0SGreg Ungerer {
49266d857b0SGreg Ungerer 	char model[80];
49366d857b0SGreg Ungerer 	unsigned long mem;
49466d857b0SGreg Ungerer 	int i;
49566d857b0SGreg Ungerer 
49666d857b0SGreg Ungerer 	if (mach_get_model)
49766d857b0SGreg Ungerer 		mach_get_model(model);
49866d857b0SGreg Ungerer 	else
49966d857b0SGreg Ungerer 		strcpy(model, "Unknown m68k");
50066d857b0SGreg Ungerer 
50166d857b0SGreg Ungerer 	seq_printf(m, "Model:\t\t%s\n", model);
50266d857b0SGreg Ungerer 	for (mem = 0, i = 0; i < m68k_num_memory; i++)
50366d857b0SGreg Ungerer 		mem += m68k_memory[i].size;
50466d857b0SGreg Ungerer 	seq_printf(m, "System Memory:\t%ldK\n", mem >> 10);
50566d857b0SGreg Ungerer 
50666d857b0SGreg Ungerer 	if (mach_get_hardware_list)
50766d857b0SGreg Ungerer 		mach_get_hardware_list(m);
50866d857b0SGreg Ungerer 
50966d857b0SGreg Ungerer 	return 0;
51066d857b0SGreg Ungerer }
51166d857b0SGreg Ungerer 
51266d857b0SGreg Ungerer static int hardware_proc_open(struct inode *inode, struct file *file)
51366d857b0SGreg Ungerer {
51466d857b0SGreg Ungerer 	return single_open(file, hardware_proc_show, NULL);
51566d857b0SGreg Ungerer }
51666d857b0SGreg Ungerer 
51766d857b0SGreg Ungerer static const struct file_operations hardware_proc_fops = {
51866d857b0SGreg Ungerer 	.open		= hardware_proc_open,
51966d857b0SGreg Ungerer 	.read		= seq_read,
52066d857b0SGreg Ungerer 	.llseek		= seq_lseek,
52166d857b0SGreg Ungerer 	.release	= single_release,
52266d857b0SGreg Ungerer };
52366d857b0SGreg Ungerer 
52466d857b0SGreg Ungerer static int __init proc_hardware_init(void)
52566d857b0SGreg Ungerer {
52666d857b0SGreg Ungerer 	proc_create("hardware", 0, NULL, &hardware_proc_fops);
52766d857b0SGreg Ungerer 	return 0;
52866d857b0SGreg Ungerer }
52966d857b0SGreg Ungerer module_init(proc_hardware_init);
53066d857b0SGreg Ungerer #endif
53166d857b0SGreg Ungerer 
53266d857b0SGreg Ungerer void check_bugs(void)
53366d857b0SGreg Ungerer {
53466d857b0SGreg Ungerer #ifndef CONFIG_M68KFPU_EMU
53566d857b0SGreg Ungerer 	if (m68k_fputype == 0) {
53666d857b0SGreg Ungerer 		printk(KERN_EMERG "*** YOU DO NOT HAVE A FLOATING POINT UNIT, "
53766d857b0SGreg Ungerer 			"WHICH IS REQUIRED BY LINUX/M68K ***\n");
53866d857b0SGreg Ungerer 		printk(KERN_EMERG "Upgrade your hardware or join the FPU "
53966d857b0SGreg Ungerer 			"emulation project\n");
54066d857b0SGreg Ungerer 		panic("no FPU");
54166d857b0SGreg Ungerer 	}
54266d857b0SGreg Ungerer #endif /* !CONFIG_M68KFPU_EMU */
54366d857b0SGreg Ungerer }
54466d857b0SGreg Ungerer 
54566d857b0SGreg Ungerer #ifdef CONFIG_ADB
54666d857b0SGreg Ungerer static int __init adb_probe_sync_enable (char *str) {
54766d857b0SGreg Ungerer 	extern int __adb_probe_sync;
54866d857b0SGreg Ungerer 	__adb_probe_sync = 1;
54966d857b0SGreg Ungerer 	return 1;
55066d857b0SGreg Ungerer }
55166d857b0SGreg Ungerer 
55266d857b0SGreg Ungerer __setup("adb_sync", adb_probe_sync_enable);
55366d857b0SGreg Ungerer #endif /* CONFIG_ADB */
554