Ok. I didn't make 2.4.0 in 2000. Tough. I tried, but we had some
[davej-history.git] / arch / m68k / sun3 / config.c
blobe002d6c04c72314e99cb7887c87606ea9f9801ff
1 /*
2 * linux/arch/m68k/sun3/config.c
4 * Copyright (C) 1996,1997 Pekka Pietik{inen
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
11 #include <stdarg.h>
13 #include <linux/config.h>
14 #include <linux/types.h>
15 #include <linux/kernel.h>
16 #include <linux/mm.h>
17 #include <linux/kd.h>
18 #include <linux/tty.h>
19 #include <linux/console.h>
20 #include <linux/init.h>
21 #include <linux/bootmem.h>
23 #include <asm/oplib.h>
24 #include <asm/setup.h>
25 #include <asm/contregs.h>
26 #include <asm/movs.h>
27 #include <asm/pgtable.h>
28 #include <asm/sun3-head.h>
29 #include <asm/sun3mmu.h>
30 #include <asm/machdep.h>
31 #include <asm/intersil.h>
32 #include <asm/irq.h>
33 #include <asm/segment.h>
35 extern char _text, _end;
37 char sun3_reserved_pmeg[SUN3_PMEGS_NUM];
39 extern unsigned long sun3_gettimeoffset(void);
40 extern int sun3_get_irq_list (char *);
41 extern void sun3_sched_init(void (*handler)(int, void *, struct pt_regs *));
42 extern void sun3_init_IRQ (void);
43 extern void (*sun3_default_handler[]) (int, void *, struct pt_regs *);
44 extern int sun3_request_irq (unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
45 unsigned long flags, const char *devname, void *dev_id);
46 extern void sun3_free_irq (unsigned int irq, void *dev_id);
47 extern void sun3_enable_irq (unsigned int);
48 extern void sun3_disable_irq (unsigned int);
49 extern void sun3_enable_interrupts (void);
50 extern void sun3_disable_interrupts (void);
51 extern void sun3_get_model (char* model);
52 extern void idprom_init (void);
53 extern void sun3_gettod (int *yearp, int *monp, int *dayp,
54 int *hourp, int *minp, int *secp);
55 extern int sun3_hwclk(int set, struct hwclk_time *t);
57 extern void sun_serial_setup(void);
58 volatile char* clock_va;
59 extern unsigned char* sun3_intreg;
60 extern unsigned long availmem;
61 unsigned long num_pages;
63 void __init sun3_init(void)
65 unsigned char enable_register;
66 int i;
68 m68k_machtype= MACH_SUN3;
69 m68k_cputype = CPU_68020;
70 m68k_fputype = FPU_68881; /* mc68881 actually */
71 m68k_mmutype = MMU_SUN3;
72 clock_va = (char *) 0xfe06000; /* dark */
73 sun3_intreg = (unsigned char *) 0xfe0a000; /* magic */
74 sun3_disable_interrupts();
76 prom_init((void *)LINUX_OPPROM_BEGVM);
78 GET_CONTROL_BYTE(AC_SENABLE,enable_register);
79 enable_register |= 0x40; /* Enable FPU */
80 SET_CONTROL_BYTE(AC_SENABLE,enable_register);
81 GET_CONTROL_BYTE(AC_SENABLE,enable_register);
83 /* This code looks suspicious, because it doesn't subtract
84 memory belonging to the kernel from the available space */
87 memset(sun3_reserved_pmeg, 0, sizeof(sun3_reserved_pmeg));
89 /* Reserve important PMEGS */
90 /* FIXME: These should be probed instead of hardcoded */
92 for (i=0; i<8; i++) /* Kernel PMEGs */
93 sun3_reserved_pmeg[i] = 1;
95 sun3_reserved_pmeg[247] = 1; /* ROM mapping */
96 sun3_reserved_pmeg[248] = 1; /* AMD Ethernet */
97 sun3_reserved_pmeg[251] = 1; /* VB area */
98 sun3_reserved_pmeg[254] = 1; /* main I/O */
100 sun3_reserved_pmeg[249] = 1;
101 sun3_reserved_pmeg[252] = 1;
102 sun3_reserved_pmeg[253] = 1;
103 set_fs(KERNEL_DS);
106 /* Without this, Bad Things happen when something calls arch_reset. */
107 static void sun3_reboot (void)
109 prom_reboot ("vmlinux");
112 static void sun3_halt (void)
114 prom_halt ();
117 /* sun3 bootmem allocation */
119 void __init sun3_bootmem_alloc(unsigned long memory_start, unsigned long memory_end)
121 unsigned long start_page;
123 /* align start/end to page boundries */
124 memory_start = ((memory_start + (PAGE_SIZE-1)) & PAGE_MASK);
125 memory_end = memory_end & PAGE_MASK;
127 start_page = __pa(memory_start) >> PAGE_SHIFT;
128 num_pages = __pa(memory_end) >> PAGE_SHIFT;
130 high_memory = (void *)memory_end;
131 availmem = memory_start;
133 availmem += init_bootmem(start_page, num_pages);
134 availmem = (availmem + (PAGE_SIZE-1)) & PAGE_MASK;
136 free_bootmem(__pa(availmem), memory_end - (availmem));
140 void __init config_sun3(void)
142 unsigned long memory_start, memory_end;
144 printk("ARCH: SUN3\n");
145 idprom_init();
147 /* Subtract kernel memory from available memory */
149 mach_sched_init = sun3_sched_init;
150 mach_init_IRQ = sun3_init_IRQ;
151 mach_default_handler = &sun3_default_handler;
152 mach_request_irq = sun3_request_irq;
153 mach_free_irq = sun3_free_irq;
154 // mach_keyb_init = sun3_keyb_init;
155 enable_irq = sun3_enable_irq;
156 disable_irq = sun3_disable_irq;
157 mach_get_irq_list = sun3_get_irq_list;
158 mach_gettod = sun3_gettod;
159 mach_reset = sun3_reboot;
160 mach_gettimeoffset = sun3_gettimeoffset;
161 mach_get_model = sun3_get_model;
162 mach_hwclk = sun3_hwclk;
163 mach_halt = sun3_halt;
164 #ifndef CONFIG_SERIAL_CONSOLE
165 conswitchp = &dummy_con;
166 #endif
168 memory_start = ((((int)&_end) + 0x2000) & ~0x1fff);
169 // PROM seems to want the last couple of physical pages. --m
170 memory_end = *(romvec->pv_sun3mem) + PAGE_OFFSET - 2*PAGE_SIZE;
172 m68k_num_memory=1;
173 m68k_memory[0].size=*(romvec->pv_sun3mem);
175 sun3_bootmem_alloc(memory_start, memory_end);
177 sun_serial_setup();
182 void __init sun3_sched_init(void (*timer_routine)(int, void *, struct pt_regs *))
184 sun3_disable_interrupts();
185 intersil_clock->cmd_reg=(INTERSIL_RUN|INTERSIL_INT_DISABLE|INTERSIL_24H_MODE);
186 intersil_clock->int_reg=INTERSIL_HZ_100_MASK;
187 intersil_clear();
188 sun3_enable_irq(5);
189 intersil_clock->cmd_reg=(INTERSIL_RUN|INTERSIL_INT_ENABLE|INTERSIL_24H_MODE);
190 sun3_enable_interrupts();
191 intersil_clear();