This source file includes following definitions.
- bios32_init
- prom_sync_me
- boot_flags_init
- setup_arch
- sys_ioperm
- get_cpuinfo
1
2
3
4
5
6
7 #include <linux/errno.h>
8 #include <linux/sched.h>
9 #include <linux/kernel.h>
10 #include <linux/mm.h>
11 #include <linux/stddef.h>
12 #include <linux/unistd.h>
13 #include <linux/ptrace.h>
14 #include <linux/malloc.h>
15 #include <linux/ldt.h>
16 #include <linux/user.h>
17 #include <linux/a.out.h>
18 #include <linux/tty.h>
19
20 #include <asm/segment.h>
21 #include <asm/system.h>
22 #include <asm/io.h>
23 #include <asm/kgdb.h>
24 #include <asm/processor.h>
25 #include <asm/oplib.h>
26 #include <asm/page.h>
27 #include <asm/pgtable.h>
28 #include <asm/traps.h>
29 #include <asm/vaddrs.h>
30 #include <asm/kdebug.h>
31
32 struct screen_info screen_info = {
33 0, 0,
34 { 0, 0, },
35 0,
36 0,
37 128,
38 0,0,0,
39 54,
40 0,
41 16
42 };
43
44 char wp_works_ok = 0;
45
46 unsigned long bios32_init(unsigned long memory_start, unsigned long memory_end)
47 {
48 return memory_start;
49 }
50
51
52
53
54
55
56
57 extern unsigned long trapbase;
58
59
60 void prom_sync_me(void)
61 {
62 unsigned long prom_tbr, flags;
63
64 save_flags(flags); cli();
65 __asm__ __volatile__("rd %%tbr, %0\n\t" : "=r" (prom_tbr));
66 __asm__ __volatile__("wr %0, 0x0, %%tbr\n\t"
67 "nop\n\t"
68 "nop\n\t"
69 "nop\n\t" : : "r" (&trapbase));
70
71 prom_printf("PROM SYNC COMMAND...\n");
72 show_free_areas();
73 prom_printf("Returning to prom\n");
74
75 __asm__ __volatile__("wr %0, 0x0, %%tbr\n\t"
76 "nop\n\t"
77 "nop\n\t"
78 "nop\n\t" : : "r" (prom_tbr));
79 restore_flags(flags);
80
81 return;
82 }
83
84 extern void rs_kgdb_hook(int tty_num);
85
86 unsigned int boot_flags;
87 #define BOOTME_DEBUG 0x1
88 #define BOOTME_SINGLE 0x2
89 #define BOOTME_KGDB 0x4
90
91
92
93
94
95 void
96 boot_flags_init(char *commands)
97 {
98 int i;
99 for(i=0; i<strlen(commands); i++) {
100 if(commands[i]=='-') {
101 switch(commands[i+1]) {
102 case 'd':
103 boot_flags |= BOOTME_DEBUG;
104 break;
105 case 's':
106 boot_flags |= BOOTME_SINGLE;
107 break;
108 case 'h':
109 prom_printf("boot_flags_init: Found halt flag, doing so now...\n");
110 halt();
111 break;
112 default:
113 printk("boot_flags_init: Unknown boot arg (-%c)\n",
114 commands[i+1]);
115 break;
116 };
117 } else {
118 if(commands[i]=='k' && commands[i+1]=='g' &&
119 commands[i+2]=='d' && commands[i+3]=='b' &&
120 commands[i+4]=='=' && commands[i+5]=='t' &&
121 commands[i+6]=='t' && commands[i+7]=='y') {
122 printk("KGDB: Using serial line /dev/tty%c for "
123 "session\n", commands[i+8]);
124 boot_flags |= BOOTME_KGDB;
125 if(commands[i+8]=='a')
126 rs_kgdb_hook(0);
127 else if(commands[i+8]=='b')
128 rs_kgdb_hook(1);
129 else {
130 printk("KGDB: whoops bogon tty line "
131 "requested, disabling session\n");
132 boot_flags &= (~BOOTME_KGDB);
133 }
134 }
135 }
136 }
137 return;
138 }
139
140
141
142
143
144
145
146 extern void load_mmu(void);
147 extern int prom_probe_memory(void);
148 extern void probe_vac(void);
149 extern void get_idprom(void);
150 extern unsigned int end_of_phys_memory;
151 extern char cputypval;
152 extern unsigned long start, end, bootup_stack, bootup_kstack;
153
154
155 char sparc_command_line[256];
156 enum sparc_cpu sparc_cpu_model;
157
158 struct tt_entry *sparc_ttable;
159
160 void setup_arch(char **cmdline_p,
161 unsigned long * memory_start_p, unsigned long * memory_end_p)
162 {
163 int total, i;
164
165 sparc_ttable = (struct tt_entry *) &start;
166
167
168 *cmdline_p = prom_getbootargs();
169
170
171 sparc_cpu_model = sun_unknown;
172 if(!strcmp(&cputypval,"sun4c")) { sparc_cpu_model=sun4c; }
173 if(!strcmp(&cputypval,"sun4m")) { sparc_cpu_model=sun4m; }
174 if(!strcmp(&cputypval,"sun4d")) { sparc_cpu_model=sun4d; }
175 if(!strcmp(&cputypval,"sun4e")) { sparc_cpu_model=sun4e; }
176 if(!strcmp(&cputypval,"sun4u")) { sparc_cpu_model=sun4u; }
177 printk("ARCH: ");
178 switch(sparc_cpu_model)
179 {
180 case sun4c:
181 printk("SUN4C\n");
182 probe_vac();
183 break;
184 case sun4m:
185 printk("SUN4M\n");
186 break;
187 case sun4d:
188 printk("SUN4D\n");
189 break;
190 case sun4e:
191 printk("SUN4E\n");
192 break;
193 case sun4u:
194 printk("SUN4U\n");
195 break;
196 default:
197 printk("UNKNOWN!\n");
198 break;
199 };
200
201 boot_flags_init(*cmdline_p);
202 if((boot_flags&BOOTME_DEBUG) && (linux_dbvec!=0) &&
203 ((*(short *)linux_dbvec) != -1)) {
204 printk("Booted under KADB. Syncing trap table.\n");
205 (*(linux_dbvec->teach_debugger))();
206 }
207 if((boot_flags & BOOTME_KGDB)) {
208 set_debug_traps();
209 breakpoint();
210 }
211
212 get_idprom();
213 load_mmu();
214 total = prom_probe_memory();
215 *memory_start_p = (((unsigned long) &end));
216 printk("Physical Memory: %d bytes (in hex %08lx)\n", (int) total,
217 (unsigned long) total);
218
219 for(i=0; sp_banks[i].num_bytes != 0; i++) {
220 #if 0
221 printk("Bank %d: base 0x%x bytes %d\n", i,
222 (unsigned int) sp_banks[i].base_addr,
223 (int) sp_banks[i].num_bytes);
224 #endif
225 end_of_phys_memory = sp_banks[i].base_addr + sp_banks[i].num_bytes;
226 }
227
228 prom_setsync(prom_sync_me);
229
230
231 init_task.mm->mmap->vm_page_prot = PAGE_SHARED;
232
233 *memory_end_p = (end_of_phys_memory + PAGE_OFFSET);
234
235 {
236 extern int serial_console;
237 int idev = prom_query_input_device();
238 int odev = prom_query_output_device();
239 if (idev == PROMDEV_IKBD && odev == PROMDEV_OSCREEN) {
240 serial_console = 0;
241 } else if (idev == PROMDEV_ITTYA && odev == PROMDEV_OTTYA) {
242 serial_console = 1;
243 } else if (idev == PROMDEV_ITTYB && odev == PROMDEV_OTTYB) {
244 prom_printf("Console on ttyb is not supported\n");
245 prom_halt();
246 } else {
247 prom_printf("Inconsistent console\n");
248 prom_halt();
249 }
250 }
251 }
252
253 asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on)
254 {
255 return -EIO;
256 }
257
258
259
260
261
262
263 int get_cpuinfo(char *buffer)
264 {
265 return sprintf(buffer, "Sparc RISC\n");
266 }