]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * linux/arch/m68k/sun3/config.c | |
3 | * | |
4 | * Copyright (C) 1996,1997 Pekka Pietik{inen | |
5 | * | |
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 | */ | |
10 | ||
1da177e4 LT |
11 | #include <linux/types.h> |
12 | #include <linux/kernel.h> | |
13 | #include <linux/mm.h> | |
14 | #include <linux/tty.h> | |
15 | #include <linux/console.h> | |
16 | #include <linux/init.h> | |
17 | #include <linux/bootmem.h> | |
18 | ||
19 | #include <asm/oplib.h> | |
20 | #include <asm/setup.h> | |
21 | #include <asm/contregs.h> | |
22 | #include <asm/movs.h> | |
23 | #include <asm/pgtable.h> | |
24 | #include <asm/sun3-head.h> | |
25 | #include <asm/sun3mmu.h> | |
26 | #include <asm/rtc.h> | |
27 | #include <asm/machdep.h> | |
28 | #include <asm/intersil.h> | |
29 | #include <asm/irq.h> | |
30 | #include <asm/segment.h> | |
31 | #include <asm/sun3ints.h> | |
32 | ||
33 | extern char _text, _end; | |
34 | ||
35 | char sun3_reserved_pmeg[SUN3_PMEGS_NUM]; | |
36 | ||
37 | extern unsigned long sun3_gettimeoffset(void); | |
1da177e4 LT |
38 | extern void sun3_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); |
39 | extern void sun3_get_model (char* model); | |
40 | extern void idprom_init (void); | |
41 | extern int sun3_hwclk(int set, struct rtc_time *t); | |
42 | ||
43 | volatile char* clock_va; | |
44 | extern volatile unsigned char* sun3_intreg; | |
45 | extern unsigned long availmem; | |
46 | unsigned long num_pages; | |
47 | ||
48 | static int sun3_get_hardware_list(char *buffer) | |
49 | { | |
50 | ||
51 | int len = 0; | |
52 | ||
53 | len += sprintf(buffer + len, "PROM Revision:\t%s\n", | |
54 | romvec->pv_monid); | |
55 | ||
56 | return len; | |
57 | ||
58 | } | |
59 | ||
60 | void __init sun3_init(void) | |
61 | { | |
62 | unsigned char enable_register; | |
63 | int i; | |
64 | ||
65 | m68k_machtype= MACH_SUN3; | |
66 | m68k_cputype = CPU_68020; | |
67 | m68k_fputype = FPU_68881; /* mc68881 actually */ | |
68 | m68k_mmutype = MMU_SUN3; | |
69 | clock_va = (char *) 0xfe06000; /* dark */ | |
70 | sun3_intreg = (unsigned char *) 0xfe0a000; /* magic */ | |
71 | sun3_disable_interrupts(); | |
72 | ||
73 | prom_init((void *)LINUX_OPPROM_BEGVM); | |
74 | ||
75 | GET_CONTROL_BYTE(AC_SENABLE,enable_register); | |
76 | enable_register |= 0x50; /* Enable FPU */ | |
77 | SET_CONTROL_BYTE(AC_SENABLE,enable_register); | |
78 | GET_CONTROL_BYTE(AC_SENABLE,enable_register); | |
79 | ||
80 | /* This code looks suspicious, because it doesn't subtract | |
81 | memory belonging to the kernel from the available space */ | |
82 | ||
83 | ||
84 | memset(sun3_reserved_pmeg, 0, sizeof(sun3_reserved_pmeg)); | |
85 | ||
86 | /* Reserve important PMEGS */ | |
87 | /* FIXME: These should be probed instead of hardcoded */ | |
88 | ||
89 | for (i=0; i<8; i++) /* Kernel PMEGs */ | |
90 | sun3_reserved_pmeg[i] = 1; | |
91 | ||
92 | sun3_reserved_pmeg[247] = 1; /* ROM mapping */ | |
93 | sun3_reserved_pmeg[248] = 1; /* AMD Ethernet */ | |
94 | sun3_reserved_pmeg[251] = 1; /* VB area */ | |
95 | sun3_reserved_pmeg[254] = 1; /* main I/O */ | |
96 | ||
97 | sun3_reserved_pmeg[249] = 1; | |
98 | sun3_reserved_pmeg[252] = 1; | |
99 | sun3_reserved_pmeg[253] = 1; | |
100 | set_fs(KERNEL_DS); | |
101 | } | |
102 | ||
103 | /* Without this, Bad Things happen when something calls arch_reset. */ | |
104 | static void sun3_reboot (void) | |
105 | { | |
106 | prom_reboot ("vmlinux"); | |
107 | } | |
108 | ||
109 | static void sun3_halt (void) | |
110 | { | |
111 | prom_halt (); | |
112 | } | |
113 | ||
114 | /* sun3 bootmem allocation */ | |
115 | ||
116 | void __init sun3_bootmem_alloc(unsigned long memory_start, unsigned long memory_end) | |
117 | { | |
118 | unsigned long start_page; | |
119 | ||
120 | /* align start/end to page boundaries */ | |
121 | memory_start = ((memory_start + (PAGE_SIZE-1)) & PAGE_MASK); | |
122 | memory_end = memory_end & PAGE_MASK; | |
123 | ||
124 | start_page = __pa(memory_start) >> PAGE_SHIFT; | |
125 | num_pages = __pa(memory_end) >> PAGE_SHIFT; | |
126 | ||
127 | high_memory = (void *)memory_end; | |
128 | availmem = memory_start; | |
129 | ||
130 | availmem += init_bootmem_node(NODE_DATA(0), start_page, 0, num_pages); | |
131 | availmem = (availmem + (PAGE_SIZE-1)) & PAGE_MASK; | |
132 | ||
133 | free_bootmem(__pa(availmem), memory_end - (availmem)); | |
134 | } | |
135 | ||
136 | ||
137 | void __init config_sun3(void) | |
138 | { | |
139 | unsigned long memory_start, memory_end; | |
140 | ||
141 | printk("ARCH: SUN3\n"); | |
142 | idprom_init(); | |
143 | ||
144 | /* Subtract kernel memory from available memory */ | |
145 | ||
146 | mach_sched_init = sun3_sched_init; | |
147 | mach_init_IRQ = sun3_init_IRQ; | |
1da177e4 LT |
148 | mach_reset = sun3_reboot; |
149 | mach_gettimeoffset = sun3_gettimeoffset; | |
150 | mach_get_model = sun3_get_model; | |
151 | mach_hwclk = sun3_hwclk; | |
152 | mach_halt = sun3_halt; | |
153 | mach_get_hardware_list = sun3_get_hardware_list; | |
1da177e4 LT |
154 | |
155 | memory_start = ((((int)&_end) + 0x2000) & ~0x1fff); | |
156 | // PROM seems to want the last couple of physical pages. --m | |
157 | memory_end = *(romvec->pv_sun3mem) + PAGE_OFFSET - 2*PAGE_SIZE; | |
158 | ||
159 | m68k_num_memory=1; | |
160 | m68k_memory[0].size=*(romvec->pv_sun3mem); | |
161 | ||
162 | sun3_bootmem_alloc(memory_start, memory_end); | |
163 | } | |
164 | ||
2850bc27 | 165 | void __init sun3_sched_init(irqreturn_t (*timer_routine)(int, void *)) |
1da177e4 LT |
166 | { |
167 | sun3_disable_interrupts(); | |
168 | intersil_clock->cmd_reg=(INTERSIL_RUN|INTERSIL_INT_DISABLE|INTERSIL_24H_MODE); | |
169 | intersil_clock->int_reg=INTERSIL_HZ_100_MASK; | |
170 | intersil_clear(); | |
171 | sun3_enable_irq(5); | |
172 | intersil_clock->cmd_reg=(INTERSIL_RUN|INTERSIL_INT_ENABLE|INTERSIL_24H_MODE); | |
173 | sun3_enable_interrupts(); | |
174 | intersil_clear(); | |
175 | } | |
176 |