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> 29*abe48101SGeert Uytterhoeven #include <asm/byteorder.h> 3066d857b0SGreg Ungerer #include <asm/sections.h> 3166d857b0SGreg Ungerer #include <asm/setup.h> 3266d857b0SGreg Ungerer #include <asm/fpu.h> 3366d857b0SGreg Ungerer #include <asm/irq.h> 3466d857b0SGreg Ungerer #include <asm/io.h> 3566d857b0SGreg Ungerer #include <asm/machdep.h> 3666d857b0SGreg Ungerer #ifdef CONFIG_AMIGA 3766d857b0SGreg Ungerer #include <asm/amigahw.h> 3866d857b0SGreg Ungerer #endif 3966d857b0SGreg Ungerer #ifdef CONFIG_ATARI 4066d857b0SGreg Ungerer #include <asm/atarihw.h> 4166d857b0SGreg Ungerer #include <asm/atari_stram.h> 4266d857b0SGreg Ungerer #endif 4366d857b0SGreg Ungerer #ifdef CONFIG_SUN3X 4466d857b0SGreg Ungerer #include <asm/dvma.h> 4566d857b0SGreg Ungerer #endif 4666d857b0SGreg Ungerer #include <asm/natfeat.h> 4766d857b0SGreg Ungerer 4866d857b0SGreg Ungerer #if !FPSTATESIZE || !NR_IRQS 4966d857b0SGreg Ungerer #warning No CPU/platform type selected, your kernel will not work! 5066d857b0SGreg Ungerer #warning Are you building an allnoconfig kernel? 5166d857b0SGreg Ungerer #endif 5266d857b0SGreg Ungerer 5366d857b0SGreg Ungerer unsigned long m68k_machtype; 5466d857b0SGreg Ungerer EXPORT_SYMBOL(m68k_machtype); 5566d857b0SGreg Ungerer unsigned long m68k_cputype; 5666d857b0SGreg Ungerer EXPORT_SYMBOL(m68k_cputype); 5766d857b0SGreg Ungerer unsigned long m68k_fputype; 5866d857b0SGreg Ungerer unsigned long m68k_mmutype; 5966d857b0SGreg Ungerer EXPORT_SYMBOL(m68k_mmutype); 6066d857b0SGreg Ungerer #ifdef CONFIG_VME 6166d857b0SGreg Ungerer unsigned long vme_brdtype; 6266d857b0SGreg Ungerer EXPORT_SYMBOL(vme_brdtype); 6366d857b0SGreg Ungerer #endif 6466d857b0SGreg Ungerer 6566d857b0SGreg Ungerer int m68k_is040or060; 6666d857b0SGreg Ungerer EXPORT_SYMBOL(m68k_is040or060); 6766d857b0SGreg Ungerer 6866d857b0SGreg Ungerer extern unsigned long availmem; 6966d857b0SGreg Ungerer 7066d857b0SGreg Ungerer int m68k_num_memory; 7166d857b0SGreg Ungerer EXPORT_SYMBOL(m68k_num_memory); 7266d857b0SGreg Ungerer int m68k_realnum_memory; 7366d857b0SGreg Ungerer EXPORT_SYMBOL(m68k_realnum_memory); 7466d857b0SGreg Ungerer unsigned long m68k_memoffset; 7579930084SGeert Uytterhoeven struct m68k_mem_info m68k_memory[NUM_MEMINFO]; 7666d857b0SGreg Ungerer EXPORT_SYMBOL(m68k_memory); 7766d857b0SGreg Ungerer 7879930084SGeert Uytterhoeven static struct m68k_mem_info m68k_ramdisk __initdata; 7966d857b0SGreg Ungerer 80a4df02a2SGeert Uytterhoeven static char m68k_command_line[CL_SIZE] __initdata; 8166d857b0SGreg Ungerer 8266d857b0SGreg Ungerer void (*mach_sched_init) (irq_handler_t handler) __initdata = NULL; 8366d857b0SGreg Ungerer /* machine dependent irq functions */ 8466d857b0SGreg Ungerer void (*mach_init_IRQ) (void) __initdata = NULL; 8566d857b0SGreg Ungerer void (*mach_get_model) (char *model); 8666d857b0SGreg Ungerer void (*mach_get_hardware_list) (struct seq_file *m); 8766d857b0SGreg Ungerer /* machine dependent timer functions */ 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 { 147*abe48101SGeert Uytterhoeven uint16_t tag; 14866d857b0SGreg Ungerer 149*abe48101SGeert Uytterhoeven while ((tag = be16_to_cpu(record->tag)) != BI_LAST) { 150*abe48101SGeert Uytterhoeven int unknown = 0; 151*abe48101SGeert Uytterhoeven const void *data = record->data; 152*abe48101SGeert Uytterhoeven uint16_t size = be16_to_cpu(record->size); 153*abe48101SGeert Uytterhoeven 154*abe48101SGeert Uytterhoeven switch (tag) { 15566d857b0SGreg Ungerer case BI_MACHTYPE: 15666d857b0SGreg Ungerer case BI_CPUTYPE: 15766d857b0SGreg Ungerer case BI_FPUTYPE: 15866d857b0SGreg Ungerer case BI_MMUTYPE: 15966d857b0SGreg Ungerer /* Already set up by head.S */ 16066d857b0SGreg Ungerer break; 16166d857b0SGreg Ungerer 16266d857b0SGreg Ungerer case BI_MEMCHUNK: 16366d857b0SGreg Ungerer if (m68k_num_memory < NUM_MEMINFO) { 164*abe48101SGeert Uytterhoeven const struct mem_info *m = data; 165*abe48101SGeert Uytterhoeven m68k_memory[m68k_num_memory].addr = 166*abe48101SGeert Uytterhoeven be32_to_cpu(m->addr); 167*abe48101SGeert Uytterhoeven m68k_memory[m68k_num_memory].size = 168*abe48101SGeert Uytterhoeven be32_to_cpu(m->size); 16966d857b0SGreg Ungerer m68k_num_memory++; 17066d857b0SGreg Ungerer } else 1716074a139SGeert Uytterhoeven pr_warn("%s: too many memory chunks\n", 1726074a139SGeert Uytterhoeven __func__); 17366d857b0SGreg Ungerer break; 17466d857b0SGreg Ungerer 17566d857b0SGreg Ungerer case BI_RAMDISK: 176*abe48101SGeert Uytterhoeven { 177*abe48101SGeert Uytterhoeven const struct mem_info *m = data; 178*abe48101SGeert Uytterhoeven m68k_ramdisk.addr = be32_to_cpu(m->addr); 179*abe48101SGeert Uytterhoeven m68k_ramdisk.size = be32_to_cpu(m->size); 180*abe48101SGeert Uytterhoeven } 18166d857b0SGreg Ungerer break; 18266d857b0SGreg Ungerer 18366d857b0SGreg Ungerer case BI_COMMAND_LINE: 184*abe48101SGeert Uytterhoeven strlcpy(m68k_command_line, data, 18566d857b0SGreg Ungerer sizeof(m68k_command_line)); 18666d857b0SGreg Ungerer break; 18766d857b0SGreg Ungerer 18866d857b0SGreg Ungerer default: 18966d857b0SGreg Ungerer if (MACH_IS_AMIGA) 19066d857b0SGreg Ungerer unknown = amiga_parse_bootinfo(record); 19166d857b0SGreg Ungerer else if (MACH_IS_ATARI) 19266d857b0SGreg Ungerer unknown = atari_parse_bootinfo(record); 19366d857b0SGreg Ungerer else if (MACH_IS_MAC) 19466d857b0SGreg Ungerer unknown = mac_parse_bootinfo(record); 19566d857b0SGreg Ungerer else if (MACH_IS_Q40) 19666d857b0SGreg Ungerer unknown = q40_parse_bootinfo(record); 19766d857b0SGreg Ungerer else if (MACH_IS_BVME6000) 19866d857b0SGreg Ungerer unknown = bvme6000_parse_bootinfo(record); 19966d857b0SGreg Ungerer else if (MACH_IS_MVME16x) 20066d857b0SGreg Ungerer unknown = mvme16x_parse_bootinfo(record); 20166d857b0SGreg Ungerer else if (MACH_IS_MVME147) 20266d857b0SGreg Ungerer unknown = mvme147_parse_bootinfo(record); 20366d857b0SGreg Ungerer else if (MACH_IS_HP300) 20466d857b0SGreg Ungerer unknown = hp300_parse_bootinfo(record); 20566d857b0SGreg Ungerer else if (MACH_IS_APOLLO) 20666d857b0SGreg Ungerer unknown = apollo_parse_bootinfo(record); 20766d857b0SGreg Ungerer else 20866d857b0SGreg Ungerer unknown = 1; 20966d857b0SGreg Ungerer } 21066d857b0SGreg Ungerer if (unknown) 2116074a139SGeert Uytterhoeven pr_warn("%s: unknown tag 0x%04x ignored\n", __func__, 212*abe48101SGeert Uytterhoeven tag); 213*abe48101SGeert Uytterhoeven record = (struct bi_record *)((unsigned long)record + size); 21466d857b0SGreg Ungerer } 21566d857b0SGreg Ungerer 21666d857b0SGreg Ungerer m68k_realnum_memory = m68k_num_memory; 21766d857b0SGreg Ungerer #ifdef CONFIG_SINGLE_MEMORY_CHUNK 21866d857b0SGreg Ungerer if (m68k_num_memory > 1) { 2196074a139SGeert Uytterhoeven pr_warn("%s: ignoring last %i chunks of physical memory\n", 2206074a139SGeert Uytterhoeven __func__, (m68k_num_memory - 1)); 22166d857b0SGreg Ungerer m68k_num_memory = 1; 22266d857b0SGreg Ungerer } 22366d857b0SGreg Ungerer #endif 22466d857b0SGreg Ungerer } 22566d857b0SGreg Ungerer 22666d857b0SGreg Ungerer void __init setup_arch(char **cmdline_p) 22766d857b0SGreg Ungerer { 228b2cb9241SGeert Uytterhoeven #ifndef CONFIG_SUN3 22966d857b0SGreg Ungerer int i; 230b2cb9241SGeert Uytterhoeven #endif 23166d857b0SGreg Ungerer 23229a20203SGeert Uytterhoeven /* The bootinfo is located right after the kernel */ 23337314540SGreg Ungerer if (!CPU_IS_COLDFIRE) 23466d857b0SGreg Ungerer m68k_parse_bootinfo((const struct bi_record *)_end); 23566d857b0SGreg Ungerer 23666d857b0SGreg Ungerer if (CPU_IS_040) 23766d857b0SGreg Ungerer m68k_is040or060 = 4; 23866d857b0SGreg Ungerer else if (CPU_IS_060) 23966d857b0SGreg Ungerer m68k_is040or060 = 6; 24066d857b0SGreg Ungerer 24166d857b0SGreg Ungerer /* FIXME: m68k_fputype is passed in by Penguin booter, which can 24266d857b0SGreg Ungerer * be confused by software FPU emulation. BEWARE. 24366d857b0SGreg Ungerer * We should really do our own FPU check at startup. 24466d857b0SGreg Ungerer * [what do we do with buggy 68LC040s? if we have problems 24566d857b0SGreg Ungerer * with them, we should add a test to check_bugs() below] */ 24666d857b0SGreg Ungerer #ifndef CONFIG_M68KFPU_EMU_ONLY 24766d857b0SGreg Ungerer /* clear the fpu if we have one */ 2480a2796daSGreg Ungerer if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060|FPU_COLDFIRE)) { 24966d857b0SGreg Ungerer volatile int zero = 0; 25066d857b0SGreg Ungerer asm volatile ("frestore %0" : : "m" (zero)); 25166d857b0SGreg Ungerer } 25266d857b0SGreg Ungerer #endif 25366d857b0SGreg Ungerer 25466d857b0SGreg Ungerer if (CPU_IS_060) { 25566d857b0SGreg Ungerer u32 pcr; 25666d857b0SGreg Ungerer 25766d857b0SGreg Ungerer asm (".chip 68060; movec %%pcr,%0; .chip 68k" 25866d857b0SGreg Ungerer : "=d" (pcr)); 25966d857b0SGreg Ungerer if (((pcr >> 8) & 0xff) <= 5) { 2606074a139SGeert Uytterhoeven pr_warn("Enabling workaround for errata I14\n"); 26166d857b0SGreg Ungerer asm (".chip 68060; movec %0,%%pcr; .chip 68k" 26266d857b0SGreg Ungerer : : "d" (pcr | 0x20)); 26366d857b0SGreg Ungerer } 26466d857b0SGreg Ungerer } 26566d857b0SGreg Ungerer 26666d857b0SGreg Ungerer init_mm.start_code = PAGE_OFFSET; 26766d857b0SGreg Ungerer init_mm.end_code = (unsigned long)_etext; 26866d857b0SGreg Ungerer init_mm.end_data = (unsigned long)_edata; 26966d857b0SGreg Ungerer init_mm.brk = (unsigned long)_end; 27066d857b0SGreg Ungerer 271d1db9120SGreg Ungerer #if defined(CONFIG_BOOTPARAM) 272d1db9120SGreg Ungerer strncpy(m68k_command_line, CONFIG_BOOTPARAM_STRING, CL_SIZE); 273d1db9120SGreg Ungerer m68k_command_line[CL_SIZE - 1] = 0; 274d1db9120SGreg Ungerer #endif /* CONFIG_BOOTPARAM */ 27566d857b0SGreg Ungerer *cmdline_p = m68k_command_line; 27666d857b0SGreg Ungerer memcpy(boot_command_line, *cmdline_p, CL_SIZE); 27766d857b0SGreg Ungerer 27866d857b0SGreg Ungerer parse_early_param(); 27966d857b0SGreg Ungerer 28066d857b0SGreg Ungerer #ifdef CONFIG_DUMMY_CONSOLE 28166d857b0SGreg Ungerer conswitchp = &dummy_con; 28266d857b0SGreg Ungerer #endif 28366d857b0SGreg Ungerer 28466d857b0SGreg Ungerer switch (m68k_machtype) { 28566d857b0SGreg Ungerer #ifdef CONFIG_AMIGA 28666d857b0SGreg Ungerer case MACH_AMIGA: 28766d857b0SGreg Ungerer config_amiga(); 28866d857b0SGreg Ungerer break; 28966d857b0SGreg Ungerer #endif 29066d857b0SGreg Ungerer #ifdef CONFIG_ATARI 29166d857b0SGreg Ungerer case MACH_ATARI: 29266d857b0SGreg Ungerer config_atari(); 29366d857b0SGreg Ungerer break; 29466d857b0SGreg Ungerer #endif 29566d857b0SGreg Ungerer #ifdef CONFIG_MAC 29666d857b0SGreg Ungerer case MACH_MAC: 29766d857b0SGreg Ungerer config_mac(); 29866d857b0SGreg Ungerer break; 29966d857b0SGreg Ungerer #endif 30066d857b0SGreg Ungerer #ifdef CONFIG_SUN3 30166d857b0SGreg Ungerer case MACH_SUN3: 30266d857b0SGreg Ungerer config_sun3(); 30366d857b0SGreg Ungerer break; 30466d857b0SGreg Ungerer #endif 30566d857b0SGreg Ungerer #ifdef CONFIG_APOLLO 30666d857b0SGreg Ungerer case MACH_APOLLO: 30766d857b0SGreg Ungerer config_apollo(); 30866d857b0SGreg Ungerer break; 30966d857b0SGreg Ungerer #endif 31066d857b0SGreg Ungerer #ifdef CONFIG_MVME147 31166d857b0SGreg Ungerer case MACH_MVME147: 31266d857b0SGreg Ungerer config_mvme147(); 31366d857b0SGreg Ungerer break; 31466d857b0SGreg Ungerer #endif 31566d857b0SGreg Ungerer #ifdef CONFIG_MVME16x 31666d857b0SGreg Ungerer case MACH_MVME16x: 31766d857b0SGreg Ungerer config_mvme16x(); 31866d857b0SGreg Ungerer break; 31966d857b0SGreg Ungerer #endif 32066d857b0SGreg Ungerer #ifdef CONFIG_BVME6000 32166d857b0SGreg Ungerer case MACH_BVME6000: 32266d857b0SGreg Ungerer config_bvme6000(); 32366d857b0SGreg Ungerer break; 32466d857b0SGreg Ungerer #endif 32566d857b0SGreg Ungerer #ifdef CONFIG_HP300 32666d857b0SGreg Ungerer case MACH_HP300: 32766d857b0SGreg Ungerer config_hp300(); 32866d857b0SGreg Ungerer break; 32966d857b0SGreg Ungerer #endif 33066d857b0SGreg Ungerer #ifdef CONFIG_Q40 33166d857b0SGreg Ungerer case MACH_Q40: 33266d857b0SGreg Ungerer config_q40(); 33366d857b0SGreg Ungerer break; 33466d857b0SGreg Ungerer #endif 33566d857b0SGreg Ungerer #ifdef CONFIG_SUN3X 33666d857b0SGreg Ungerer case MACH_SUN3X: 33766d857b0SGreg Ungerer config_sun3x(); 33866d857b0SGreg Ungerer break; 33966d857b0SGreg Ungerer #endif 34037314540SGreg Ungerer #ifdef CONFIG_COLDFIRE 34137314540SGreg Ungerer case MACH_M54XX: 34237314540SGreg Ungerer config_BSP(NULL, 0); 34337314540SGreg Ungerer break; 34437314540SGreg Ungerer #endif 34566d857b0SGreg Ungerer default: 34666d857b0SGreg Ungerer panic("No configuration setup"); 34766d857b0SGreg Ungerer } 34866d857b0SGreg Ungerer 34966d857b0SGreg Ungerer #ifdef CONFIG_NATFEAT 35066d857b0SGreg Ungerer nf_init(); 35166d857b0SGreg Ungerer #endif 35266d857b0SGreg Ungerer 35366d857b0SGreg Ungerer paging_init(); 35466d857b0SGreg Ungerer 35566d857b0SGreg Ungerer #ifndef CONFIG_SUN3 35666d857b0SGreg Ungerer for (i = 1; i < m68k_num_memory; i++) 35766d857b0SGreg Ungerer free_bootmem_node(NODE_DATA(i), m68k_memory[i].addr, 35866d857b0SGreg Ungerer m68k_memory[i].size); 35966d857b0SGreg Ungerer #ifdef CONFIG_BLK_DEV_INITRD 36066d857b0SGreg Ungerer if (m68k_ramdisk.size) { 36166d857b0SGreg Ungerer reserve_bootmem_node(__virt_to_node(phys_to_virt(m68k_ramdisk.addr)), 36266d857b0SGreg Ungerer m68k_ramdisk.addr, m68k_ramdisk.size, 36366d857b0SGreg Ungerer BOOTMEM_DEFAULT); 36466d857b0SGreg Ungerer initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr); 36566d857b0SGreg Ungerer initrd_end = initrd_start + m68k_ramdisk.size; 3666074a139SGeert Uytterhoeven pr_info("initrd: %08lx - %08lx\n", initrd_start, initrd_end); 36766d857b0SGreg Ungerer } 36866d857b0SGreg Ungerer #endif 36966d857b0SGreg Ungerer 37066d857b0SGreg Ungerer #ifdef CONFIG_ATARI 37166d857b0SGreg Ungerer if (MACH_IS_ATARI) 37266d857b0SGreg Ungerer atari_stram_reserve_pages((void *)availmem); 37366d857b0SGreg Ungerer #endif 37466d857b0SGreg Ungerer #ifdef CONFIG_SUN3X 37566d857b0SGreg Ungerer if (MACH_IS_SUN3X) { 37666d857b0SGreg Ungerer dvma_init(); 37766d857b0SGreg Ungerer } 37866d857b0SGreg Ungerer #endif 37966d857b0SGreg Ungerer 38066d857b0SGreg Ungerer #endif /* !CONFIG_SUN3 */ 38166d857b0SGreg Ungerer 38266d857b0SGreg Ungerer /* set ISA defs early as possible */ 38366d857b0SGreg Ungerer #if defined(CONFIG_ISA) && defined(MULTI_ISA) 38466d857b0SGreg Ungerer if (MACH_IS_Q40) { 38566d857b0SGreg Ungerer isa_type = ISA_TYPE_Q40; 38666d857b0SGreg Ungerer isa_sex = 0; 38766d857b0SGreg Ungerer } 38866d857b0SGreg Ungerer #ifdef CONFIG_AMIGA_PCMCIA 38966d857b0SGreg Ungerer if (MACH_IS_AMIGA && AMIGAHW_PRESENT(PCMCIA)) { 39066d857b0SGreg Ungerer isa_type = ISA_TYPE_AG; 39166d857b0SGreg Ungerer isa_sex = 1; 39266d857b0SGreg Ungerer } 39366d857b0SGreg Ungerer #endif 39484b16b7bSMichael Schmitz #ifdef CONFIG_ATARI_ROM_ISA 39584b16b7bSMichael Schmitz if (MACH_IS_ATARI) { 39684b16b7bSMichael Schmitz isa_type = ISA_TYPE_ENEC; 39784b16b7bSMichael Schmitz isa_sex = 0; 39884b16b7bSMichael Schmitz } 39984b16b7bSMichael Schmitz #endif 40066d857b0SGreg Ungerer #endif 40166d857b0SGreg Ungerer } 40266d857b0SGreg Ungerer 40366d857b0SGreg Ungerer static int show_cpuinfo(struct seq_file *m, void *v) 40466d857b0SGreg Ungerer { 40566d857b0SGreg Ungerer const char *cpu, *mmu, *fpu; 40666d857b0SGreg Ungerer unsigned long clockfreq, clockfactor; 40766d857b0SGreg Ungerer 40866d857b0SGreg Ungerer #define LOOP_CYCLES_68020 (8) 40966d857b0SGreg Ungerer #define LOOP_CYCLES_68030 (8) 41066d857b0SGreg Ungerer #define LOOP_CYCLES_68040 (3) 41166d857b0SGreg Ungerer #define LOOP_CYCLES_68060 (1) 412060632adSGreg Ungerer #define LOOP_CYCLES_COLDFIRE (2) 41366d857b0SGreg Ungerer 41466d857b0SGreg Ungerer if (CPU_IS_020) { 41566d857b0SGreg Ungerer cpu = "68020"; 41666d857b0SGreg Ungerer clockfactor = LOOP_CYCLES_68020; 41766d857b0SGreg Ungerer } else if (CPU_IS_030) { 41866d857b0SGreg Ungerer cpu = "68030"; 41966d857b0SGreg Ungerer clockfactor = LOOP_CYCLES_68030; 42066d857b0SGreg Ungerer } else if (CPU_IS_040) { 42166d857b0SGreg Ungerer cpu = "68040"; 42266d857b0SGreg Ungerer clockfactor = LOOP_CYCLES_68040; 42366d857b0SGreg Ungerer } else if (CPU_IS_060) { 42466d857b0SGreg Ungerer cpu = "68060"; 42566d857b0SGreg Ungerer clockfactor = LOOP_CYCLES_68060; 426060632adSGreg Ungerer } else if (CPU_IS_COLDFIRE) { 427060632adSGreg Ungerer cpu = "ColdFire"; 428060632adSGreg Ungerer clockfactor = LOOP_CYCLES_COLDFIRE; 42966d857b0SGreg Ungerer } else { 43066d857b0SGreg Ungerer cpu = "680x0"; 43166d857b0SGreg Ungerer clockfactor = 0; 43266d857b0SGreg Ungerer } 43366d857b0SGreg Ungerer 43466d857b0SGreg Ungerer #ifdef CONFIG_M68KFPU_EMU_ONLY 43566d857b0SGreg Ungerer fpu = "none(soft float)"; 43666d857b0SGreg Ungerer #else 43766d857b0SGreg Ungerer if (m68k_fputype & FPU_68881) 43866d857b0SGreg Ungerer fpu = "68881"; 43966d857b0SGreg Ungerer else if (m68k_fputype & FPU_68882) 44066d857b0SGreg Ungerer fpu = "68882"; 44166d857b0SGreg Ungerer else if (m68k_fputype & FPU_68040) 44266d857b0SGreg Ungerer fpu = "68040"; 44366d857b0SGreg Ungerer else if (m68k_fputype & FPU_68060) 44466d857b0SGreg Ungerer fpu = "68060"; 44566d857b0SGreg Ungerer else if (m68k_fputype & FPU_SUNFPA) 44666d857b0SGreg Ungerer fpu = "Sun FPA"; 447060632adSGreg Ungerer else if (m68k_fputype & FPU_COLDFIRE) 448060632adSGreg Ungerer fpu = "ColdFire"; 44966d857b0SGreg Ungerer else 45066d857b0SGreg Ungerer fpu = "none"; 45166d857b0SGreg Ungerer #endif 45266d857b0SGreg Ungerer 45366d857b0SGreg Ungerer if (m68k_mmutype & MMU_68851) 45466d857b0SGreg Ungerer mmu = "68851"; 45566d857b0SGreg Ungerer else if (m68k_mmutype & MMU_68030) 45666d857b0SGreg Ungerer mmu = "68030"; 45766d857b0SGreg Ungerer else if (m68k_mmutype & MMU_68040) 45866d857b0SGreg Ungerer mmu = "68040"; 45966d857b0SGreg Ungerer else if (m68k_mmutype & MMU_68060) 46066d857b0SGreg Ungerer mmu = "68060"; 46166d857b0SGreg Ungerer else if (m68k_mmutype & MMU_SUN3) 46266d857b0SGreg Ungerer mmu = "Sun-3"; 46366d857b0SGreg Ungerer else if (m68k_mmutype & MMU_APOLLO) 46466d857b0SGreg Ungerer mmu = "Apollo"; 465060632adSGreg Ungerer else if (m68k_mmutype & MMU_COLDFIRE) 466060632adSGreg Ungerer mmu = "ColdFire"; 46766d857b0SGreg Ungerer else 46866d857b0SGreg Ungerer mmu = "unknown"; 46966d857b0SGreg Ungerer 47066d857b0SGreg Ungerer clockfreq = loops_per_jiffy * HZ * clockfactor; 47166d857b0SGreg Ungerer 47266d857b0SGreg Ungerer seq_printf(m, "CPU:\t\t%s\n" 47366d857b0SGreg Ungerer "MMU:\t\t%s\n" 47466d857b0SGreg Ungerer "FPU:\t\t%s\n" 47566d857b0SGreg Ungerer "Clocking:\t%lu.%1luMHz\n" 47666d857b0SGreg Ungerer "BogoMips:\t%lu.%02lu\n" 47766d857b0SGreg Ungerer "Calibration:\t%lu loops\n", 47866d857b0SGreg Ungerer cpu, mmu, fpu, 47966d857b0SGreg Ungerer clockfreq/1000000,(clockfreq/100000)%10, 48066d857b0SGreg Ungerer loops_per_jiffy/(500000/HZ),(loops_per_jiffy/(5000/HZ))%100, 48166d857b0SGreg Ungerer loops_per_jiffy); 48266d857b0SGreg Ungerer return 0; 48366d857b0SGreg Ungerer } 48466d857b0SGreg Ungerer 48566d857b0SGreg Ungerer static void *c_start(struct seq_file *m, loff_t *pos) 48666d857b0SGreg Ungerer { 48766d857b0SGreg Ungerer return *pos < 1 ? (void *)1 : NULL; 48866d857b0SGreg Ungerer } 48966d857b0SGreg Ungerer static void *c_next(struct seq_file *m, void *v, loff_t *pos) 49066d857b0SGreg Ungerer { 49166d857b0SGreg Ungerer ++*pos; 49266d857b0SGreg Ungerer return NULL; 49366d857b0SGreg Ungerer } 49466d857b0SGreg Ungerer static void c_stop(struct seq_file *m, void *v) 49566d857b0SGreg Ungerer { 49666d857b0SGreg Ungerer } 49766d857b0SGreg Ungerer const struct seq_operations cpuinfo_op = { 49866d857b0SGreg Ungerer .start = c_start, 49966d857b0SGreg Ungerer .next = c_next, 50066d857b0SGreg Ungerer .stop = c_stop, 50166d857b0SGreg Ungerer .show = show_cpuinfo, 50266d857b0SGreg Ungerer }; 50366d857b0SGreg Ungerer 50466d857b0SGreg Ungerer #ifdef CONFIG_PROC_HARDWARE 50566d857b0SGreg Ungerer static int hardware_proc_show(struct seq_file *m, void *v) 50666d857b0SGreg Ungerer { 50766d857b0SGreg Ungerer char model[80]; 50866d857b0SGreg Ungerer unsigned long mem; 50966d857b0SGreg Ungerer int i; 51066d857b0SGreg Ungerer 51166d857b0SGreg Ungerer if (mach_get_model) 51266d857b0SGreg Ungerer mach_get_model(model); 51366d857b0SGreg Ungerer else 51466d857b0SGreg Ungerer strcpy(model, "Unknown m68k"); 51566d857b0SGreg Ungerer 51666d857b0SGreg Ungerer seq_printf(m, "Model:\t\t%s\n", model); 51766d857b0SGreg Ungerer for (mem = 0, i = 0; i < m68k_num_memory; i++) 51866d857b0SGreg Ungerer mem += m68k_memory[i].size; 51966d857b0SGreg Ungerer seq_printf(m, "System Memory:\t%ldK\n", mem >> 10); 52066d857b0SGreg Ungerer 52166d857b0SGreg Ungerer if (mach_get_hardware_list) 52266d857b0SGreg Ungerer mach_get_hardware_list(m); 52366d857b0SGreg Ungerer 52466d857b0SGreg Ungerer return 0; 52566d857b0SGreg Ungerer } 52666d857b0SGreg Ungerer 52766d857b0SGreg Ungerer static int hardware_proc_open(struct inode *inode, struct file *file) 52866d857b0SGreg Ungerer { 52966d857b0SGreg Ungerer return single_open(file, hardware_proc_show, NULL); 53066d857b0SGreg Ungerer } 53166d857b0SGreg Ungerer 53266d857b0SGreg Ungerer static const struct file_operations hardware_proc_fops = { 53366d857b0SGreg Ungerer .open = hardware_proc_open, 53466d857b0SGreg Ungerer .read = seq_read, 53566d857b0SGreg Ungerer .llseek = seq_lseek, 53666d857b0SGreg Ungerer .release = single_release, 53766d857b0SGreg Ungerer }; 53866d857b0SGreg Ungerer 53966d857b0SGreg Ungerer static int __init proc_hardware_init(void) 54066d857b0SGreg Ungerer { 54166d857b0SGreg Ungerer proc_create("hardware", 0, NULL, &hardware_proc_fops); 54266d857b0SGreg Ungerer return 0; 54366d857b0SGreg Ungerer } 54466d857b0SGreg Ungerer module_init(proc_hardware_init); 54566d857b0SGreg Ungerer #endif 54666d857b0SGreg Ungerer 54766d857b0SGreg Ungerer void check_bugs(void) 54866d857b0SGreg Ungerer { 54966d857b0SGreg Ungerer #ifndef CONFIG_M68KFPU_EMU 55066d857b0SGreg Ungerer if (m68k_fputype == 0) { 5516074a139SGeert Uytterhoeven pr_emerg("*** YOU DO NOT HAVE A FLOATING POINT UNIT, " 55266d857b0SGreg Ungerer "WHICH IS REQUIRED BY LINUX/M68K ***\n"); 5536074a139SGeert Uytterhoeven pr_emerg("Upgrade your hardware or join the FPU " 55466d857b0SGreg Ungerer "emulation project\n"); 55566d857b0SGreg Ungerer panic("no FPU"); 55666d857b0SGreg Ungerer } 55766d857b0SGreg Ungerer #endif /* !CONFIG_M68KFPU_EMU */ 55866d857b0SGreg Ungerer } 55966d857b0SGreg Ungerer 56066d857b0SGreg Ungerer #ifdef CONFIG_ADB 56166d857b0SGreg Ungerer static int __init adb_probe_sync_enable (char *str) { 56266d857b0SGreg Ungerer extern int __adb_probe_sync; 56366d857b0SGreg Ungerer __adb_probe_sync = 1; 56466d857b0SGreg Ungerer return 1; 56566d857b0SGreg Ungerer } 56666d857b0SGreg Ungerer 56766d857b0SGreg Ungerer __setup("adb_sync", adb_probe_sync_enable); 56866d857b0SGreg Ungerer #endif /* CONFIG_ADB */ 569