]>
Commit | Line | Data |
---|---|---|
74c5aaf6 KT |
1 | diff -urN linux.orig/arch/ppc/boot/Makefile linux/arch/ppc/boot/Makefile |
2 | --- linux.orig/arch/ppc/boot/Makefile Sun Mar 25 18:31:49 2001 | |
3 | +++ linux/arch/ppc/boot/Makefile Fri Jul 12 19:00:55 2002 | |
4 | @@ -69,7 +69,7 @@ | |
5 | zvmlinux.initrd: zvmlinux | |
6 | $(LD) $(ZLINKFLAGS) -o zvmlinux.initrd.tmp $(OBJECTS) | |
7 | $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \ | |
8 | - --add-section=initrd=../coffboot/ramdisk.image.gz \ | |
9 | + --add-section=initrd=ramdisk.image.gz \ | |
10 | --add-section=image=../coffboot/vmlinux.gz \ | |
11 | zvmlinux.initrd.tmp zvmlinux.initrd | |
12 | $(CC) $(CFLAGS) -DINITRD_OFFSET=`sh offset $(OBJDUMP) zvmlinux.initrd initrd` \ | |
13 | @@ -79,7 +79,7 @@ | |
14 | -c -o misc.o misc.c | |
15 | $(LD) $(ZLINKFLAGS) -o zvmlinux.initrd.tmp $(OBJECTS) | |
16 | $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \ | |
17 | - --add-section=initrd=../coffboot/ramdisk.image.gz \ | |
18 | + --add-section=initrd=ramdisk.image.gz \ | |
19 | --add-section=image=../coffboot/vmlinux.gz \ | |
20 | zvmlinux.initrd.tmp $@ | |
21 | rm zvmlinux.initrd.tmp | |
22 | diff -urN linux.orig/arch/ppc/coffboot/Makefile linux/arch/ppc/coffboot/Makefile | |
23 | --- linux.orig/arch/ppc/coffboot/Makefile Sun Mar 25 18:31:49 2001 | |
24 | +++ linux/arch/ppc/coffboot/Makefile Thu Jul 11 15:43:29 2002 | |
25 | @@ -9,13 +9,12 @@ | |
26 | LD = $(CROSS_COMPILE)ld | |
27 | CFLAGS = $(CPPFLAGS) -O -fno-builtin -I$(HPATH) | |
28 | OBJCOPY = $(CROSS_COMPILE)objcopy | |
29 | -OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment | |
30 | -COFF_LD_ARGS = -e _start -T ld.script -Ttext 500000 -Tdata 510000 -Bstatic | |
31 | -CHRP_LD_ARGS = -Ttext 0x01000000 | |
32 | +OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment \ | |
33 | + --add-section=image=vmlinux.gz | |
34 | +LD_ARGS = -e _start -T ld.script -Ttext 500000 -Tdata 510000 -Bstatic | |
35 | GZ = gzip -9 | |
36 | ||
37 | -COFFOBJS = coffcrt0.o start.o coffmain.o misc.o string.o zlib.o image.o | |
38 | -CHRPOBJS = crt0.o start.o chrpmain.o misc.o string.o zlib.o image.o | |
39 | +OBJS = crt0.o start.o main.o misc.o string.o zlib.o | |
40 | LIBS = $(TOPDIR)/lib/lib.a | |
41 | ||
42 | ifeq ($(CONFIG_PPC64),y) | |
43 | @@ -34,81 +33,39 @@ | |
44 | hack-coff: hack-coff.c | |
45 | $(HOSTCC) $(HOSTCFLAGS) -o hack-coff hack-coff.c | |
46 | ||
47 | -znetboot: vmlinux.coff zImage vmlinux.elf | |
48 | - cp vmlinux.coff $(TFTPIMAGE) | |
49 | - cp vmlinux.elf $(TFTPIMAGE).elf | |
50 | - | |
51 | -znetboot.initrd: vmlinux.coff.initrd vmlinux.elf.initrd | |
52 | - cp vmlinux.coff.initrd $(TFTPIMAGE) | |
53 | - cp vmlinux.elf.initrd $(TFTPIMAGE).elf | |
54 | - | |
55 | floppy: zImage | |
56 | # mount -t hfs /dev/fd0 /mnt | |
57 | # cp vmlinux.coff /mnt | |
58 | # umount /mnt | |
59 | ||
60 | -coffboot: $(COFFOBJS) no_initrd.o ld.script | |
61 | - $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) no_initrd.o $(LIBS) | |
62 | - | |
63 | -coffboot.initrd: $(COFFOBJS) initrd.o ld.script | |
64 | - $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) initrd.o $(LIBS) | |
65 | +znetboot: vmlinux.coff | |
66 | + cp vmlinux.coff $(TFTPIMAGE) | |
67 | ||
68 | -piggyback: piggyback.c | |
69 | - $(HOSTCC) $(HOSTCFLAGS) -DKERNELBASE=$(KERNELBASE) -o piggyback piggyback.c | |
70 | +znetboot.initrd: vmlinux.coff.initrd | |
71 | + cp vmlinux.coff.initrd $(TFTPIMAGE) | |
72 | ||
73 | -mknote: mknote.c | |
74 | - $(HOSTCC) $(HOSTCFLAGS) -o mknote mknote.c | |
75 | +coffboot: $(OBJS) ld.script | |
76 | + $(LD) -o coffboot $(LD_ARGS) $(OBJS) $(LIBS) | |
77 | ||
78 | -image.o: piggyback vmlinux.gz | |
79 | - ./piggyback image < vmlinux.gz | $(AS) -o image.o | |
80 | +zImage: vmlinux.coff | |
81 | ||
82 | -initrd.o: ramdisk.image.gz piggyback | |
83 | - ./piggyback initrd < ramdisk.image.gz | $(AS) -o initrd.o | |
84 | +zImage.initrd: vmlinux.coff.initrd | |
85 | ||
86 | -vmlinux.coff: coffboot hack-coff | |
87 | +vmlinux.coff: coffboot hack-coff vmlinux.gz | |
88 | $(OBJCOPY) $(OBJCOPY_ARGS) coffboot $@ | |
89 | ./hack-coff $@ | |
90 | ln -sf vmlinux.coff zImage | |
91 | ||
92 | -vmlinux.coff.initrd: coffboot.initrd hack-coff | |
93 | - $(OBJCOPY) $(OBJCOPY_ARGS) coffboot.initrd $@ | |
94 | +vmlinux.coff.initrd: coffboot hack-coff vmlinux.gz ramdisk.image.gz | |
95 | + $(OBJCOPY) $(OBJCOPY_ARGS) --add-section=initrd=ramdisk.image.gz \ | |
96 | + coffboot $@ | |
97 | ./hack-coff $@ | |
98 | ||
99 | -vmlinux.elf: $(CHRPOBJS) no_initrd.o mknote | |
100 | - $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) no_initrd.o $(LIBS) | |
101 | - ./mknote > note | |
102 | - $(OBJCOPY) $@ $@ --add-section=.note=note -R .comment | |
103 | - | |
104 | -vmlinux.elf.initrd: $(CHRPOBJS) initrd.o mknote | |
105 | - $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) initrd.o $(LIBS) | |
106 | - ./mknote > note | |
107 | - $(OBJCOPY) $@ $@ --add-section=.note=note -R .comment | |
108 | - | |
109 | -micoffboot: dummy.o | |
110 | - $(LD) -o $@ $(COFF_LD_ARGS) dummy.o $(LIBS) | |
111 | - | |
112 | -miboot.image: micoffboot hack-coff vmlinux.gz | |
113 | - $(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=vmlinux.gz micoffboot $@ | |
114 | - ./hack-coff $@ | |
115 | - | |
116 | -miboot.image.initrd: micoffboot hack-coff vmlinux.gz ramdisk.image.gz | |
117 | - $(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=vmlinux.gz \ | |
118 | - --add-section=initrd=ramdisk.image.gz micoffboot $@ | |
119 | - ./hack-coff $@ | |
120 | - | |
121 | -zImage: vmlinux.coff vmlinux.elf miboot.image | |
122 | - | |
123 | -zImage.initrd: vmlinux.coff.initrd vmlinux.elf.initrd miboot.image.initrd | |
124 | - | |
125 | else | |
126 | znetboot: vmlinux.gz | |
127 | ||
128 | znetboot.initrd: vmlinux.gz | |
129 | ||
130 | -miboot.image: vmlinux.gz | |
131 | - | |
132 | -miboot.image.initrd: vmlinux.gz | |
133 | - | |
134 | coffboot: vmlinux.gz | |
135 | ||
136 | zImage: vmlinux.gz | |
137 | @@ -129,7 +86,5 @@ | |
138 | ||
139 | clean: | |
140 | rm -f hack-coff coffboot zImage vmlinux.coff vmlinux.gz | |
141 | - rm -f mknote piggyback vmlinux.elf note | |
142 | - rm -f micoffboot miboot.image | |
143 | ||
144 | fastdep: | |
145 | diff -urN linux.orig/arch/ppc/coffboot/chrpmain.c linux/arch/ppc/coffboot/chrpmain.c | |
146 | --- linux.orig/arch/ppc/coffboot/chrpmain.c Sun Mar 25 18:31:49 2001 | |
147 | +++ linux/arch/ppc/coffboot/chrpmain.c Thu Jan 1 01:00:00 1970 | |
148 | @@ -1,252 +0,0 @@ | |
149 | -/* | |
150 | - * Copyright (C) Paul Mackerras 1997. | |
151 | - * | |
152 | - * This program is free software; you can redistribute it and/or | |
153 | - * modify it under the terms of the GNU General Public License | |
154 | - * as published by the Free Software Foundation; either version | |
155 | - * 2 of the License, or (at your option) any later version. | |
156 | - */ | |
157 | -#include "nonstdio.h" | |
158 | -#include "zlib.h" | |
159 | - | |
160 | -extern void *finddevice(const char *); | |
161 | -extern int getprop(void *, const char *, void *, int); | |
162 | -void gunzip(void *, int, unsigned char *, int *); | |
163 | -void stop_imac_ethernet(void); | |
164 | -void stop_imac_usb(void); | |
165 | - | |
166 | -#define get_16be(x) (*(unsigned short *)(x)) | |
167 | -#define get_32be(x) (*(unsigned *)(x)) | |
168 | - | |
169 | -#define RAM_END (16 << 20) | |
170 | - | |
171 | -#define PROG_START 0x00010000 | |
172 | -#define PROG_SIZE 0x003f0000 | |
173 | - | |
174 | -#define SCRATCH_SIZE (128 << 10) | |
175 | - | |
176 | -char *avail_ram; | |
177 | -char *begin_avail, *end_avail; | |
178 | -char *avail_high; | |
179 | -unsigned int heap_use; | |
180 | -unsigned int heap_max; | |
181 | - | |
182 | -extern char _end[]; | |
183 | -extern char image_data[]; | |
184 | -extern int image_len; | |
185 | -extern char initrd_data[]; | |
186 | -extern int initrd_len; | |
187 | - | |
188 | - | |
189 | -boot(int a1, int a2, void *prom) | |
190 | -{ | |
191 | - int ns, oh, i; | |
192 | - unsigned sa, len; | |
193 | - void *dst; | |
194 | - unsigned char *im; | |
195 | - unsigned initrd_start, initrd_size; | |
196 | - extern char _start; | |
197 | - | |
198 | - printf("chrpboot starting: loaded at 0x%x\n", &_start); | |
199 | - if (initrd_len) { | |
200 | - initrd_size = initrd_len; | |
201 | - initrd_start = (RAM_END - initrd_size) & ~0xFFF; | |
202 | - a1 = initrd_start; | |
203 | - a2 = initrd_size; | |
204 | - claim(initrd_start, RAM_END - initrd_start, 0); | |
205 | - printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n", | |
206 | - initrd_start, initrd_data, initrd_size); | |
207 | - memcpy((char *)initrd_start, initrd_data, initrd_size); | |
208 | - } | |
209 | - im = image_data; | |
210 | - len = image_len; | |
211 | - /* claim 3MB starting at PROG_START */ | |
212 | - claim(PROG_START, PROG_SIZE, 0); | |
213 | - dst = (void *) PROG_START; | |
214 | - if (im[0] == 0x1f && im[1] == 0x8b) { | |
215 | - /* claim some memory for scratch space */ | |
216 | - avail_ram = (char *) claim(0, SCRATCH_SIZE, 0x10); | |
217 | - begin_avail = avail_high = avail_ram; | |
218 | - end_avail = avail_ram + SCRATCH_SIZE; | |
219 | - printf("heap at 0x%x\n", avail_ram); | |
220 | - printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len); | |
221 | - gunzip(dst, PROG_SIZE, im, &len); | |
222 | - printf("done %u bytes\n", len); | |
223 | - printf("%u bytes of heap consumed, max in use %u\n", | |
224 | - avail_high - begin_avail, heap_max); | |
225 | - } else { | |
226 | - memmove(dst, im, len); | |
227 | - } | |
228 | - | |
229 | - flush_cache(dst, len); | |
230 | -#if 0 | |
231 | - stop_imac_ethernet(); | |
232 | - stop_imac_usb(); | |
233 | -#endif | |
234 | - | |
235 | - sa = (unsigned long)PROG_START; | |
236 | - printf("start address = 0x%x\n", sa); | |
237 | - | |
238 | - (*(void (*)())sa)(a1, a2, prom); | |
239 | - | |
240 | - printf("returned?\n"); | |
241 | - | |
242 | - pause(); | |
243 | -} | |
244 | - | |
245 | -#if 0 | |
246 | -#define eieio() asm volatile("eieio"); | |
247 | - | |
248 | -void stop_imac_ethernet(void) | |
249 | -{ | |
250 | - void *macio, *enet; | |
251 | - unsigned int macio_addr[5], enet_reg[6]; | |
252 | - int len; | |
253 | - volatile unsigned int *dbdma; | |
254 | - | |
255 | - macio = finddevice("/pci/mac-io"); | |
256 | - enet = finddevice("/pci/mac-io/ethernet"); | |
257 | - if (macio == NULL || enet == NULL) | |
258 | - return; | |
259 | - len = getprop(macio, "assigned-addresses", macio_addr, sizeof(macio_addr)); | |
260 | - if (len != sizeof(macio_addr)) | |
261 | - return; | |
262 | - len = getprop(enet, "reg", enet_reg, sizeof(enet_reg)); | |
263 | - if (len != sizeof(enet_reg)) | |
264 | - return; | |
265 | - printf("macio base %x, dma at %x & %x\n", | |
266 | - macio_addr[2], enet_reg[2], enet_reg[4]); | |
267 | - | |
268 | - /* hope this is mapped... */ | |
269 | - dbdma = (volatile unsigned int *) (macio_addr[2] + enet_reg[2]); | |
270 | - *dbdma = 0x80; /* clear the RUN bit */ | |
271 | - eieio(); | |
272 | - dbdma = (volatile unsigned int *) (macio_addr[2] + enet_reg[4]); | |
273 | - *dbdma = 0x80; /* clear the RUN bit */ | |
274 | - eieio(); | |
275 | -} | |
276 | - | |
277 | -void stop_imac_usb(void) | |
278 | -{ | |
279 | - void *usb; | |
280 | - unsigned int usb_addr[5]; | |
281 | - int len; | |
282 | - volatile unsigned int *usb_ctrl; | |
283 | - | |
284 | - usb = finddevice("/pci/usb"); | |
285 | - if (usb == NULL) | |
286 | - return; | |
287 | - len = getprop(usb, "assigned-addresses", usb_addr, sizeof(usb_addr)); | |
288 | - if (len != sizeof(usb_addr)) | |
289 | - return; | |
290 | - printf("usb base %x\n", usb_addr[2]); | |
291 | - | |
292 | - usb_ctrl = (volatile unsigned int *) (usb_addr[2] + 8); | |
293 | - *usb_ctrl = 0x01000000; /* cpu_to_le32(1) */ | |
294 | - eieio(); | |
295 | -} | |
296 | -#endif | |
297 | - | |
298 | -struct memchunk { | |
299 | - unsigned int size; | |
300 | - struct memchunk *next; | |
301 | -}; | |
302 | - | |
303 | -static struct memchunk *freechunks; | |
304 | - | |
305 | -void *zalloc(void *x, unsigned items, unsigned size) | |
306 | -{ | |
307 | - void *p; | |
308 | - struct memchunk **mpp, *mp; | |
309 | - | |
310 | - size *= items; | |
311 | - size = (size + 7) & -8; | |
312 | - heap_use += size; | |
313 | - if (heap_use > heap_max) | |
314 | - heap_max = heap_use; | |
315 | - for (mpp = &freechunks; (mp = *mpp) != 0; mpp = &mp->next) { | |
316 | - if (mp->size == size) { | |
317 | - *mpp = mp->next; | |
318 | - return mp; | |
319 | - } | |
320 | - } | |
321 | - p = avail_ram; | |
322 | - avail_ram += size; | |
323 | - if (avail_ram > avail_high) | |
324 | - avail_high = avail_ram; | |
325 | - if (avail_ram > end_avail) { | |
326 | - printf("oops... out of memory\n"); | |
327 | - pause(); | |
328 | - } | |
329 | - return p; | |
330 | -} | |
331 | - | |
332 | -void zfree(void *x, void *addr, unsigned nb) | |
333 | -{ | |
334 | - struct memchunk *mp = addr; | |
335 | - | |
336 | - nb = (nb + 7) & -8; | |
337 | - heap_use -= nb; | |
338 | - if (avail_ram == addr + nb) { | |
339 | - avail_ram = addr; | |
340 | - return; | |
341 | - } | |
342 | - mp->size = nb; | |
343 | - mp->next = freechunks; | |
344 | - freechunks = mp; | |
345 | -} | |
346 | - | |
347 | -#define HEAD_CRC 2 | |
348 | -#define EXTRA_FIELD 4 | |
349 | -#define ORIG_NAME 8 | |
350 | -#define COMMENT 0x10 | |
351 | -#define RESERVED 0xe0 | |
352 | - | |
353 | -#define DEFLATED 8 | |
354 | - | |
355 | -void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp) | |
356 | -{ | |
357 | - z_stream s; | |
358 | - int r, i, flags; | |
359 | - | |
360 | - /* skip header */ | |
361 | - i = 10; | |
362 | - flags = src[3]; | |
363 | - if (src[2] != DEFLATED || (flags & RESERVED) != 0) { | |
364 | - printf("bad gzipped data\n"); | |
365 | - exit(); | |
366 | - } | |
367 | - if ((flags & EXTRA_FIELD) != 0) | |
368 | - i = 12 + src[10] + (src[11] << 8); | |
369 | - if ((flags & ORIG_NAME) != 0) | |
370 | - while (src[i++] != 0) | |
371 | - ; | |
372 | - if ((flags & COMMENT) != 0) | |
373 | - while (src[i++] != 0) | |
374 | - ; | |
375 | - if ((flags & HEAD_CRC) != 0) | |
376 | - i += 2; | |
377 | - if (i >= *lenp) { | |
378 | - printf("gunzip: ran out of data in header\n"); | |
379 | - exit(); | |
380 | - } | |
381 | - | |
382 | - s.zalloc = zalloc; | |
383 | - s.zfree = zfree; | |
384 | - r = inflateInit2(&s, -MAX_WBITS); | |
385 | - if (r != Z_OK) { | |
386 | - printf("inflateInit2 returned %d\n", r); | |
387 | - exit(); | |
388 | - } | |
389 | - s.next_in = src + i; | |
390 | - s.avail_in = *lenp - i; | |
391 | - s.next_out = dst; | |
392 | - s.avail_out = dstlen; | |
393 | - r = inflate(&s, Z_FINISH); | |
394 | - if (r != Z_OK && r != Z_STREAM_END) { | |
395 | - printf("inflate returned %d msg: %s\n", r, s.msg); | |
396 | - exit(); | |
397 | - } | |
398 | - *lenp = s.next_out - (unsigned char *) dst; | |
399 | - inflateEnd(&s); | |
400 | -} | |
401 | diff -urN linux.orig/arch/ppc/coffboot/coffcrt0.S linux/arch/ppc/coffboot/coffcrt0.S | |
402 | --- linux.orig/arch/ppc/coffboot/coffcrt0.S Sun Mar 25 18:31:49 2001 | |
403 | +++ linux/arch/ppc/coffboot/coffcrt0.S Thu Jan 1 01:00:00 1970 | |
404 | @@ -1,24 +0,0 @@ | |
405 | -/* | |
406 | - * Copyright (C) Paul Mackerras 1997. | |
407 | - * | |
408 | - * This program is free software; you can redistribute it and/or | |
409 | - * modify it under the terms of the GNU General Public License | |
410 | - * as published by the Free Software Foundation; either version | |
411 | - * 2 of the License, or (at your option) any later version. | |
412 | - */ | |
413 | - .text | |
414 | - .globl _start | |
415 | -_start: | |
416 | - .long __start,0,0 | |
417 | - | |
418 | - .globl __start | |
419 | -__start: | |
420 | - lis 9,_start@h | |
421 | - lis 8,_etext@ha | |
422 | - addi 8,8,_etext@l | |
423 | -1: dcbf 0,9 | |
424 | - icbi 0,9 | |
425 | - addi 9,9,0x20 | |
426 | - cmplwi 0,9,8 | |
427 | - blt 1b | |
428 | - b start | |
429 | diff -urN linux.orig/arch/ppc/coffboot/coffmain.c linux/arch/ppc/coffboot/coffmain.c | |
430 | --- linux.orig/arch/ppc/coffboot/coffmain.c Sun Mar 25 18:31:49 2001 | |
431 | +++ linux/arch/ppc/coffboot/coffmain.c Thu Jan 1 01:00:00 1970 | |
432 | @@ -1,157 +0,0 @@ | |
433 | -/* | |
434 | - * Copyright (C) Paul Mackerras 1997. | |
435 | - * | |
436 | - * This program is free software; you can redistribute it and/or | |
437 | - * modify it under the terms of the GNU General Public License | |
438 | - * as published by the Free Software Foundation; either version | |
439 | - * 2 of the License, or (at your option) any later version. | |
440 | - */ | |
441 | -#include "nonstdio.h" | |
442 | -#include "zlib.h" | |
443 | - | |
444 | -extern void *finddevice(const char *); | |
445 | -extern int getprop(void *, const char *, void *, int); | |
446 | -extern char *claim(unsigned, unsigned, unsigned); | |
447 | -void gunzip(void *, int, unsigned char *, int *); | |
448 | - | |
449 | -#define get_16be(x) (*(unsigned short *)(x)) | |
450 | -#define get_32be(x) (*(unsigned *)(x)) | |
451 | - | |
452 | -#define RAM_START 0xc0000000 | |
453 | -#define PROG_START RAM_START | |
454 | -#define RAM_END (RAM_START + 0x800000) /* only 8M mapped with BATs */ | |
455 | - | |
456 | -char *avail_ram; | |
457 | -char *end_avail; | |
458 | - | |
459 | -extern char _start[], _end[]; | |
460 | -extern char image_data[]; | |
461 | -extern int image_len; | |
462 | -extern char initrd_data[]; | |
463 | -extern int initrd_len; | |
464 | - | |
465 | - | |
466 | -boot(int a1, int a2, void *prom) | |
467 | -{ | |
468 | - int ns, oh, i; | |
469 | - unsigned sa, len; | |
470 | - void *dst; | |
471 | - unsigned char *im; | |
472 | - unsigned initrd_start, initrd_size; | |
473 | - | |
474 | - printf("coffboot starting: loaded at 0x%x\n", _start); | |
475 | - setup_bats(RAM_START); | |
476 | - if (initrd_len) { | |
477 | - initrd_size = initrd_len; | |
478 | - initrd_start = (RAM_END - initrd_size) & ~0xFFF; | |
479 | - a1 = initrd_start; | |
480 | - a2 = initrd_size; | |
481 | - claim(initrd_start - RAM_START, RAM_END - initrd_start, 0); | |
482 | - printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n", | |
483 | - initrd_start, initrd_data, initrd_size); | |
484 | - memcpy((char *)initrd_start, initrd_data, initrd_size); | |
485 | - } | |
486 | - im = image_data; | |
487 | - len = image_len; | |
488 | - /* claim 3MB starting at 0 */ | |
489 | - claim(0, 3 << 20, 0); | |
490 | - dst = (void *) RAM_START; | |
491 | - if (im[0] == 0x1f && im[1] == 0x8b) { | |
492 | - /* claim 512kB for scratch space */ | |
493 | - avail_ram = claim(0, 512 << 10, 0x10) + RAM_START; | |
494 | - end_avail = avail_ram + (512 << 10); | |
495 | - printf("avail_ram = %x\n", avail_ram); | |
496 | - printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len); | |
497 | - gunzip(dst, 3 << 20, im, &len); | |
498 | - printf("done %u bytes\n", len); | |
499 | - } else { | |
500 | - memmove(dst, im, len); | |
501 | - } | |
502 | - | |
503 | - flush_cache(dst, len); | |
504 | - | |
505 | - sa = (unsigned long)PROG_START; | |
506 | - printf("start address = 0x%x\n", sa); | |
507 | - | |
508 | -#if 0 | |
509 | - pause(); | |
510 | -#endif | |
511 | - (*(void (*)())sa)(a1, a2, prom); | |
512 | - | |
513 | - printf("returned?\n"); | |
514 | - | |
515 | - pause(); | |
516 | -} | |
517 | - | |
518 | -void *zalloc(void *x, unsigned items, unsigned size) | |
519 | -{ | |
520 | - void *p = avail_ram; | |
521 | - | |
522 | - size *= items; | |
523 | - size = (size + 7) & -8; | |
524 | - avail_ram += size; | |
525 | - if (avail_ram > end_avail) { | |
526 | - printf("oops... out of memory\n"); | |
527 | - pause(); | |
528 | - } | |
529 | - return p; | |
530 | -} | |
531 | - | |
532 | -void zfree(void *x, void *addr, unsigned nb) | |
533 | -{ | |
534 | -} | |
535 | - | |
536 | -#define HEAD_CRC 2 | |
537 | -#define EXTRA_FIELD 4 | |
538 | -#define ORIG_NAME 8 | |
539 | -#define COMMENT 0x10 | |
540 | -#define RESERVED 0xe0 | |
541 | - | |
542 | -#define DEFLATED 8 | |
543 | - | |
544 | -void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp) | |
545 | -{ | |
546 | - z_stream s; | |
547 | - int r, i, flags; | |
548 | - | |
549 | - /* skip header */ | |
550 | - i = 10; | |
551 | - flags = src[3]; | |
552 | - if (src[2] != DEFLATED || (flags & RESERVED) != 0) { | |
553 | - printf("bad gzipped data\n"); | |
554 | - exit(); | |
555 | - } | |
556 | - if ((flags & EXTRA_FIELD) != 0) | |
557 | - i = 12 + src[10] + (src[11] << 8); | |
558 | - if ((flags & ORIG_NAME) != 0) | |
559 | - while (src[i++] != 0) | |
560 | - ; | |
561 | - if ((flags & COMMENT) != 0) | |
562 | - while (src[i++] != 0) | |
563 | - ; | |
564 | - if ((flags & HEAD_CRC) != 0) | |
565 | - i += 2; | |
566 | - if (i >= *lenp) { | |
567 | - printf("gunzip: ran out of data in header\n"); | |
568 | - exit(); | |
569 | - } | |
570 | - | |
571 | - s.zalloc = zalloc; | |
572 | - s.zfree = zfree; | |
573 | - r = inflateInit2(&s, -MAX_WBITS); | |
574 | - if (r != Z_OK) { | |
575 | - printf("inflateInit2 returned %d\n", r); | |
576 | - exit(); | |
577 | - } | |
578 | - s.next_in = src + i; | |
579 | - s.avail_in = *lenp - i; | |
580 | - s.next_out = dst; | |
581 | - s.avail_out = dstlen; | |
582 | - r = inflate(&s, Z_FINISH); | |
583 | - if (r != Z_OK && r != Z_STREAM_END) { | |
584 | - printf("inflate returned %d msg: %s\n", r, s.msg); | |
585 | - exit(); | |
586 | - } | |
587 | - *lenp = s.next_out - (unsigned char *) dst; | |
588 | - inflateEnd(&s); | |
589 | -} | |
590 | diff -urN linux.orig/arch/ppc/coffboot/crt0.S linux/arch/ppc/coffboot/crt0.S | |
591 | --- linux.orig/arch/ppc/coffboot/crt0.S Sun Mar 25 18:31:49 2001 | |
592 | +++ linux/arch/ppc/coffboot/crt0.S Thu Jul 11 15:43:29 2002 | |
593 | @@ -9,6 +9,10 @@ | |
594 | .text | |
595 | .globl _start | |
596 | _start: | |
597 | + .long __start,0,0 | |
598 | + | |
599 | + .globl __start | |
600 | +__start: | |
601 | lis 9,_start@h | |
602 | lis 8,_etext@ha | |
603 | addi 8,8,_etext@l | |
604 | diff -urN linux.orig/arch/ppc/coffboot/dummy.c linux/arch/ppc/coffboot/dummy.c | |
605 | --- linux.orig/arch/ppc/coffboot/dummy.c Sun Mar 25 18:31:49 2001 | |
606 | +++ linux/arch/ppc/coffboot/dummy.c Thu Jan 1 01:00:00 1970 | |
607 | @@ -1,4 +0,0 @@ | |
608 | -int main(void) | |
609 | -{ | |
610 | - return 0; | |
611 | -} | |
612 | diff -urN linux.orig/arch/ppc/coffboot/misc.S linux/arch/ppc/coffboot/misc.S | |
613 | --- linux.orig/arch/ppc/coffboot/misc.S Sun Mar 25 18:31:49 2001 | |
614 | +++ linux/arch/ppc/coffboot/misc.S Thu Jul 11 15:43:29 2002 | |
615 | @@ -14,26 +14,23 @@ | |
616 | */ | |
617 | .globl setup_bats | |
618 | setup_bats: | |
619 | - mfpvr 5 | |
620 | - rlwinm 5,5,16,16,31 /* r3 = 1 for 601, 4 for 604 */ | |
621 | - cmpi 0,5,1 | |
622 | - li 0,0 | |
623 | + mr 4,3 | |
624 | + mfpvr 3 | |
625 | + rlwinm 3,3,16,16,31 /* r3 = 1 for 601, 4 for 604 */ | |
626 | + cmpi 0,3,1 | |
627 | bne 4f | |
628 | - mtibatl 3,0 /* invalidate BAT first */ | |
629 | - ori 3,3,4 /* set up BAT registers for 601 */ | |
630 | - li 4,0x7f | |
631 | - mtibatu 3,3 | |
632 | - mtibatl 3,4 | |
633 | - b 5f | |
634 | -4: mtdbatu 3,0 /* invalidate BATs first */ | |
635 | - mtibatu 3,0 | |
636 | - ori 3,3,0xff /* set up BAT registers for 604 */ | |
637 | - li 4,2 | |
638 | - mtdbatl 3,4 | |
639 | - mtdbatu 3,3 | |
640 | - mtibatl 3,4 | |
641 | - mtibatu 3,3 | |
642 | -5: sync | |
643 | + ori 4,4,4 /* set up BAT registers for 601 */ | |
644 | + li 5,0x7f | |
645 | + mtibatu 3,4 | |
646 | + mtibatl 3,5 | |
647 | + isync | |
648 | + blr | |
649 | +4: ori 4,4,0xfe /* set up BAT registers for 604 */ | |
650 | + li 5,2 | |
651 | + mtdbatl 3,5 | |
652 | + mtdbatu 3,4 | |
653 | + mtibatl 3,5 | |
654 | + mtibatu 3,4 | |
655 | isync | |
656 | blr | |
657 | ||
658 | diff -urN linux.orig/arch/ppc/coffboot/mknote.c linux/arch/ppc/coffboot/mknote.c | |
659 | --- linux.orig/arch/ppc/coffboot/mknote.c Sun Mar 25 18:31:49 2001 | |
660 | +++ linux/arch/ppc/coffboot/mknote.c Thu Jan 1 01:00:00 1970 | |
661 | @@ -1,43 +0,0 @@ | |
662 | -/* | |
663 | - * Copyright (C) Cort Dougan 1999. | |
664 | - * | |
665 | - * This program is free software; you can redistribute it and/or | |
666 | - * modify it under the terms of the GNU General Public License | |
667 | - * as published by the Free Software Foundation; either version | |
668 | - * 2 of the License, or (at your option) any later version. | |
669 | - * | |
670 | - * Generate a note section as per the CHRP specification. | |
671 | - * | |
672 | - */ | |
673 | - | |
674 | -#include <stdio.h> | |
675 | - | |
676 | -#define PL(x) printf("%c%c%c%c", ((x)>>24)&0xff, ((x)>>16)&0xff, ((x)>>8)&0xff, (x)&0xff ); | |
677 | - | |
678 | -int main(void) | |
679 | -{ | |
680 | -/* header */ | |
681 | - /* namesz */ | |
682 | - PL(strlen("PowerPC")+1); | |
683 | - /* descrsz */ | |
684 | - PL(6*4); | |
685 | - /* type */ | |
686 | - PL(0x1275); | |
687 | - /* name */ | |
688 | - printf("PowerPC"); printf("%c", 0); | |
689 | - | |
690 | -/* descriptor */ | |
691 | - /* real-mode */ | |
692 | - PL(0xffffffff); | |
693 | - /* real-base */ | |
694 | - PL(0x00c00000); | |
695 | - /* real-size */ | |
696 | - PL(0xffffffff); | |
697 | - /* virt-base */ | |
698 | - PL(0xffffffff); | |
699 | - /* virt-size */ | |
700 | - PL(0xffffffff); | |
701 | - /* load-base */ | |
702 | - PL(0x4000); | |
703 | - return 0; | |
704 | -} | |
705 | diff -urN linux.orig/arch/ppc/coffboot/no_initrd.c linux/arch/ppc/coffboot/no_initrd.c | |
706 | --- linux.orig/arch/ppc/coffboot/no_initrd.c Sun Mar 25 18:31:49 2001 | |
707 | +++ linux/arch/ppc/coffboot/no_initrd.c Thu Jan 1 01:00:00 1970 | |
708 | @@ -1,2 +0,0 @@ | |
709 | -char initrd_data[1]; | |
710 | -int initrd_len = 0; | |
711 | diff -urN linux.orig/arch/ppc/coffboot/piggyback.c linux/arch/ppc/coffboot/piggyback.c | |
712 | --- linux.orig/arch/ppc/coffboot/piggyback.c Sun Mar 25 18:31:49 2001 | |
713 | +++ linux/arch/ppc/coffboot/piggyback.c Thu Jan 1 01:00:00 1970 | |
714 | @@ -1,65 +0,0 @@ | |
715 | -#include <stdio.h> | |
716 | - | |
717 | -extern long ce_exec_config[]; | |
718 | - | |
719 | -main(int argc, char *argv[]) | |
720 | -{ | |
721 | - int i, cnt, pos, len; | |
722 | - unsigned int cksum, val; | |
723 | - unsigned char *lp; | |
724 | - unsigned char buf[8192]; | |
725 | - if (argc != 2) | |
726 | - { | |
727 | - fprintf(stderr, "usage: %s name <in-file >out-file\n", | |
728 | - argv[0]); | |
729 | - exit(1); | |
730 | - } | |
731 | - fprintf(stdout, "#\n"); | |
732 | - fprintf(stdout, "# Miscellaneous data structures:\n"); | |
733 | - fprintf(stdout, "# WARNING - this file is automatically generated!\n"); | |
734 | - fprintf(stdout, "#\n"); | |
735 | - fprintf(stdout, "\n"); | |
736 | - fprintf(stdout, "\t.data\n"); | |
737 | - fprintf(stdout, "\t.globl %s_data\n", argv[1]); | |
738 | - fprintf(stdout, "%s_data:\n", argv[1]); | |
739 | - pos = 0; | |
740 | - cksum = 0; | |
741 | - while ((len = read(0, buf, sizeof(buf))) > 0) | |
742 | - { | |
743 | - cnt = 0; | |
744 | - lp = (unsigned char *)buf; | |
745 | - len = (len + 3) & ~3; /* Round up to longwords */ | |
746 | - for (i = 0; i < len; i += 4) | |
747 | - { | |
748 | - if (cnt == 0) | |
749 | - { | |
750 | - fprintf(stdout, "\t.long\t"); | |
751 | - } | |
752 | - fprintf(stdout, "0x%02X%02X%02X%02X", lp[0], lp[1], lp[2], lp[3]); | |
753 | - val = *(unsigned long *)lp; | |
754 | - cksum ^= val; | |
755 | - lp += 4; | |
756 | - if (++cnt == 4) | |
757 | - { | |
758 | - cnt = 0; | |
759 | - fprintf(stdout, " # %x \n", pos+i-12); | |
760 | - fflush(stdout); | |
761 | - } else | |
762 | - { | |
763 | - fprintf(stdout, ","); | |
764 | - } | |
765 | - } | |
766 | - if (cnt) | |
767 | - { | |
768 | - fprintf(stdout, "0\n"); | |
769 | - } | |
770 | - pos += len; | |
771 | - } | |
772 | - fprintf(stdout, "\t.globl %s_len\n", argv[1]); | |
773 | - fprintf(stdout, "%s_len:\t.long\t0x%x\n", argv[1], pos); | |
774 | - fflush(stdout); | |
775 | - fclose(stdout); | |
776 | - fprintf(stderr, "cksum = %x\n", cksum); | |
777 | - exit(0); | |
778 | -} | |
779 | - | |
780 | diff -urN linux.orig/arch/ppc/coffboot/start.c linux/arch/ppc/coffboot/start.c | |
781 | --- linux.orig/arch/ppc/coffboot/start.c Sun Mar 25 18:31:49 2001 | |
782 | +++ linux/arch/ppc/coffboot/start.c Thu Jul 11 15:43:29 2002 | |
783 | @@ -33,7 +33,7 @@ | |
784 | if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4) | |
785 | exit(); | |
786 | ||
787 | - boot(a1, a2, promptr); | |
788 | + coffboot(a1, a2, promptr); | |
789 | for (;;) | |
790 | exit(); | |
791 | } | |
792 | @@ -62,25 +62,6 @@ | |
793 | return args.actual; | |
794 | } | |
795 | ||
796 | -int writestring(void *f, char *ptr, int nb) | |
797 | -{ | |
798 | - int w = 0, i; | |
799 | - char *ret = "\r"; | |
800 | - | |
801 | - for (i = 0; i < nb; ++i) { | |
802 | - if (ptr[i] == '\n') { | |
803 | - if (i > w) { | |
804 | - write(f, ptr + w, i - w); | |
805 | - w = i; | |
806 | - } | |
807 | - write(f, ret, 1); | |
808 | - } | |
809 | - } | |
810 | - if (w < nb) | |
811 | - write(f, ptr + w, nb - w); | |
812 | - return nb; | |
813 | -} | |
814 | - | |
815 | int | |
816 | read(void *handle, void *ptr, int nb) | |
817 | { | |
818 | @@ -149,29 +130,6 @@ | |
819 | return args.phandle; | |
820 | } | |
821 | ||
822 | -void * | |
823 | -claim(unsigned int virt, unsigned int size, unsigned int align) | |
824 | -{ | |
825 | - struct prom_args { | |
826 | - char *service; | |
827 | - int nargs; | |
828 | - int nret; | |
829 | - unsigned int virt; | |
830 | - unsigned int size; | |
831 | - unsigned int align; | |
832 | - void *ret; | |
833 | - } args; | |
834 | - | |
835 | - args.service = "claim"; | |
836 | - args.nargs = 3; | |
837 | - args.nret = 1; | |
838 | - args.virt = virt; | |
839 | - args.size = size; | |
840 | - args.align = align; | |
841 | - (*prom)(&args); | |
842 | - return args.ret; | |
843 | -} | |
844 | - | |
845 | int | |
846 | getprop(void *phandle, const char *name, void *buf, int buflen) | |
847 | { | |
848 | @@ -203,7 +161,9 @@ | |
849 | { | |
850 | char ch = c; | |
851 | ||
852 | - return writestring(f, &ch, 1) == 1? c: -1; | |
853 | + if (c == '\n') | |
854 | + putc('\r', f); | |
855 | + return write(f, &ch, 1) == 1? c: -1; | |
856 | } | |
857 | ||
858 | int | |
859 | @@ -217,7 +177,7 @@ | |
860 | { | |
861 | int n = strlen(str); | |
862 | ||
863 | - return writestring(f, str, n) == n? 0: -1; | |
864 | + return write(f, str, n) == n? 0: -1; | |
865 | } | |
866 | ||
867 | int | |
868 | @@ -230,7 +190,7 @@ | |
869 | case 1: | |
870 | return ch; | |
871 | case -1: | |
872 | - printk("read(stdin) returned -1\n"); | |
873 | + printk("read(stdin) returned -1\r\n"); | |
874 | return -1; | |
875 | } | |
876 | } | |
877 | @@ -304,7 +264,7 @@ | |
878 | va_start(args, fmt); | |
879 | n = vsprintf(sprint_buf, fmt, args); | |
880 | va_end(args); | |
881 | - writestring(stdout, sprint_buf, n); | |
882 | + write(stdout, sprint_buf, n); | |
883 | } | |
884 | ||
885 | int | |
886 | @@ -316,6 +276,6 @@ | |
887 | va_start(args, fmt); | |
888 | n = vsprintf(sprint_buf, fmt, args); | |
889 | va_end(args); | |
890 | - writestring(stdout, sprint_buf, n); | |
891 | + write(stdout, sprint_buf, n); | |
892 | return n; | |
893 | } | |
894 | diff -urN linux.orig/arch/ppc/common_defconfig linux/arch/ppc/common_defconfig | |
895 | --- linux.orig/arch/ppc/common_defconfig Sun Mar 25 18:31:50 2001 | |
896 | +++ linux/arch/ppc/common_defconfig Fri Jul 12 18:54:54 2002 | |
897 | @@ -16,7 +16,6 @@ | |
898 | # CONFIG_GEMINI is not set | |
899 | # CONFIG_MBX is not set | |
900 | # CONFIG_SMP is not set | |
901 | -CONFIG_ALTIVEC=y | |
902 | CONFIG_6xx=y | |
903 | ||
904 | # | |
905 | diff -urN linux.orig/arch/ppc/config.in linux/arch/ppc/config.in | |
906 | --- linux.orig/arch/ppc/config.in Fri Nov 2 17:39:05 2001 | |
907 | +++ linux/arch/ppc/config.in Thu Jul 11 15:43:29 2002 | |
908 | @@ -22,10 +22,6 @@ | |
909 | ||
910 | bool 'Symmetric multi-processing support' CONFIG_SMP | |
911 | ||
912 | -if [ "$CONFIG_6xx" = "y" ]; then | |
913 | - bool 'Altivec (G4) support' CONFIG_ALTIVEC | |
914 | -fi | |
915 | - | |
916 | if [ "$CONFIG_ALL_PPC" != "y" ]; then | |
917 | define_bool CONFIG_MACH_SPECIFIC y | |
918 | fi | |
919 | diff -urN linux.orig/arch/ppc/kernel/Makefile linux/arch/ppc/kernel/Makefile | |
920 | --- linux.orig/arch/ppc/kernel/Makefile Sun Mar 25 18:31:48 2001 | |
921 | +++ linux/arch/ppc/kernel/Makefile Fri Jul 12 19:09:44 2002 | |
922 | @@ -7,13 +7,8 @@ | |
923 | # | |
924 | # Note 2! The CFLAGS definitions are now in the main makefile... | |
925 | ||
926 | -# Once a gas that groks -mvec is generally available, we'll use it... | |
927 | .S.o: | |
928 | -#ifdef CONFIG_ALTIVEC | |
929 | -# $(CC) $(CFLAGS) -D__ASSEMBLY__ -Wa,-mvec -c $< -o $*.o | |
930 | -#else | |
931 | $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $*.o | |
932 | -#endif | |
933 | ||
934 | O_TARGET := kernel.o | |
935 | OX_OBJS := ppc_ksyms.o setup.o | |
936 | @@ -36,40 +31,20 @@ | |
937 | ||
938 | ifeq ($(CONFIG_MBX),y) | |
939 | O_OBJS += mbx_setup.o mbx_pci.o softemu8xx.o i8259.o ppc8xx_pic.o | |
940 | -endif | |
941 | +else | |
942 | ifeq ($(CONFIG_APUS),y) | |
943 | O_OBJS += apus_setup.o prom.o openpic.o | |
944 | +else | |
945 | +ifneq ($(CONFIG_MBX),y) | |
946 | +O_OBJS += prep_time.o pmac_time.o chrp_time.o \ | |
947 | + pmac_setup.o pmac_support.o \ | |
948 | + prep_pci.o pmac_pci.o chrp_pci.o \ | |
949 | + residual.o prom.o openpic.o feature.o \ | |
950 | + prep_nvram.o open_pic.o i8259.o pmac_pic.o indirect_pci.o \ | |
951 | + gemini_pci.o gemini_prom.o gemini_setup.o | |
952 | +OX_OBJS += chrp_setup.o prep_setup.o | |
953 | +endif | |
954 | endif | |
955 | - | |
956 | -PMAC_OBJS = pmac_time.o pmac_setup.o pmac_support.o pmac_pci.o pmac_pic.o \ | |
957 | - feature.o openpic.o open_pic.o prom.o | |
958 | -CHRP_OBJS = $(PMAC_OBJS) chrp_time.o chrp_pci.o i8259.o indirect_pci.o | |
959 | -CHRPX_OBJS = chrp_setup.o | |
960 | -PREP_OBJS = prep_time.o prep_pci.o residual.o prep_nvram.o i8259.o \ | |
961 | - indirect_pci.o openpic.o open_pic.o prom.o | |
962 | -PREPX_OBJS = prep_setup.o | |
963 | - | |
964 | -ifeq ($(CONFIG_ALL_PPC),y) | |
965 | -O_OBJS += $(sort $(PMAC_OBJS) $(PREP_OBJS) $(CHRP_OBJS)) | |
966 | -OX_OBJS += $(PMACX_OBJS) $(PREPX_OBJS) $(CHRPX_OBJS) | |
967 | -endif | |
968 | -ifeq ($(CONFIG_PMAC),y) | |
969 | -O_OBJS += $(PMAC_OBJS) | |
970 | -OX_OBJS += $(PMACX_OBJS) | |
971 | -endif | |
972 | -ifeq ($(CONFIG_PREP),y) | |
973 | -O_OBJS += $(PREP_OBJS) | |
974 | -OX_OBJS += $(PREPX_OBJS) | |
975 | -endif | |
976 | -ifeq ($(CONFIG_CHRP),y) | |
977 | -O_OBJS += $(CHRP_OBJS) | |
978 | -OX_OBJS += $(CHRPX_OBJS) | |
979 | -endif | |
980 | - | |
981 | -GEMINI_OBJS = $(PREP_OBJS) gemini_pci.o gemini_prom.o gemini_setup.o | |
982 | -ifeq ($(CONFIG_GEMINI),y) | |
983 | -O_OBJS += $(GEMINI_OBJS) | |
984 | -OX_OBJS += $(PREPX_OBJS) | |
985 | endif | |
986 | ||
987 | ifdef CONFIG_SMP | |
988 | diff -urN linux.orig/arch/ppc/kernel/apus_setup.c linux/arch/ppc/kernel/apus_setup.c | |
989 | --- linux.orig/arch/ppc/kernel/apus_setup.c Sun Mar 25 18:31:49 2001 | |
990 | +++ linux/arch/ppc/kernel/apus_setup.c Fri Jul 12 17:02:19 2002 | |
991 | @@ -42,7 +42,7 @@ | |
992 | #include <asm/machdep.h> | |
993 | #include <asm/ide.h> | |
994 | ||
995 | -#include <asm/time.h> | |
996 | +#include "time.h" | |
997 | #include "local_irq.h" | |
998 | ||
999 | unsigned long apus_get_rtc_time(void); | |
1000 | diff -urN linux.orig/arch/ppc/kernel/chrp_pci.c linux/arch/ppc/kernel/chrp_pci.c | |
1001 | --- linux.orig/arch/ppc/kernel/chrp_pci.c Sun Mar 25 18:31:48 2001 | |
1002 | +++ linux/arch/ppc/kernel/chrp_pci.c Thu Jul 11 15:43:29 2002 | |
1003 | @@ -12,6 +12,7 @@ | |
1004 | #include <asm/io.h> | |
1005 | #include <asm/pgtable.h> | |
1006 | #include <asm/irq.h> | |
1007 | +#include <asm/irq-compat.h> | |
1008 | #include <asm/hydra.h> | |
1009 | #include <asm/prom.h> | |
1010 | #include <asm/gg2.h> | |
1011 | @@ -19,7 +20,6 @@ | |
1012 | #include <asm/machdep.h> | |
1013 | ||
1014 | #include "pci.h" | |
1015 | -#include "open_pic.h" | |
1016 | ||
1017 | /* LongTrail */ | |
1018 | #define pci_config_addr(bus, dev, offset) \ | |
1019 | @@ -287,7 +287,7 @@ | |
1020 | for( dev=pci_devices ; dev; dev=dev->next ) | |
1021 | { | |
1022 | if ( dev->irq ) | |
1023 | - dev->irq = dev->irq + open_pic.irq_offset; | |
1024 | + dev->irq = openpic_to_irq( dev->irq ); | |
1025 | /* these need to be absolute addrs for OF and Matrox FB -- Cort */ | |
1026 | if ( dev->vendor == PCI_VENDOR_ID_MATROX ) | |
1027 | { | |
1028 | diff -urN linux.orig/arch/ppc/kernel/chrp_setup.c linux/arch/ppc/kernel/chrp_setup.c | |
1029 | --- linux.orig/arch/ppc/kernel/chrp_setup.c Sun Mar 25 18:31:49 2001 | |
1030 | +++ linux/arch/ppc/kernel/chrp_setup.c Thu Jul 11 16:22:09 2002 | |
1031 | @@ -33,7 +33,6 @@ | |
1032 | #include <linux/pci.h> | |
1033 | #include <linux/openpic.h> | |
1034 | #include <linux/version.h> | |
1035 | -#include <linux/delay.h> | |
1036 | ||
1037 | #include <asm/mmu.h> | |
1038 | #include <asm/processor.h> | |
1039 | @@ -46,11 +45,12 @@ | |
1040 | #include <asm/dma.h> | |
1041 | #include <asm/machdep.h> | |
1042 | #include <asm/irq.h> | |
1043 | +#include <asm/irq-compat.h> | |
1044 | #include <asm/adb.h> | |
1045 | #include <asm/hydra.h> | |
1046 | #include <asm/keyboard.h> | |
1047 | ||
1048 | -#include <asm/time.h> | |
1049 | +#include "time.h" | |
1050 | #include "local_irq.h" | |
1051 | #include "i8259.h" | |
1052 | #include "open_pic.h" | |
1053 | @@ -69,7 +69,7 @@ | |
1054 | int chrp_set_rtc_time(unsigned long nowtime); | |
1055 | unsigned long rtas_event_scan_rate = 0, rtas_event_scan_ct = 0; | |
1056 | void chrp_calibrate_decr(void); | |
1057 | -long chrp_time_init(void); | |
1058 | +void chrp_time_init(void); | |
1059 | ||
1060 | void chrp_setup_pci_ptrs(void); | |
1061 | ||
1062 | @@ -359,6 +359,81 @@ | |
1063 | } | |
1064 | } | |
1065 | ||
1066 | +void | |
1067 | +chrp_do_IRQ(struct pt_regs *regs, | |
1068 | + int cpu, | |
1069 | + int isfake) | |
1070 | +{ | |
1071 | + int irq; | |
1072 | + unsigned long bits = 0; | |
1073 | + int openpic_eoi_done = 0; | |
1074 | + | |
1075 | +#ifdef __SMP__ | |
1076 | + { | |
1077 | + unsigned int loops = 1000000; | |
1078 | + while (test_bit(0, &global_irq_lock)) { | |
1079 | + if (smp_processor_id() == global_irq_holder) { | |
1080 | + printk("uh oh, interrupt while we hold global irq lock!\n"); | |
1081 | +#ifdef CONFIG_XMON | |
1082 | + xmon(0); | |
1083 | +#endif | |
1084 | + break; | |
1085 | + } | |
1086 | + if (loops-- == 0) { | |
1087 | + printk("do_IRQ waiting for irq lock (holder=%d)\n", global_irq_holder); | |
1088 | +#ifdef CONFIG_XMON | |
1089 | + xmon(0); | |
1090 | +#endif | |
1091 | + } | |
1092 | + } | |
1093 | + } | |
1094 | +#endif /* __SMP__ */ | |
1095 | + | |
1096 | + irq = openpic_irq(smp_processor_id()); | |
1097 | + if (irq == IRQ_8259_CASCADE) | |
1098 | + { | |
1099 | + /* | |
1100 | + * This magic address generates a PCI IACK cycle. | |
1101 | + * | |
1102 | + * This should go in the above mask/ack code soon. -- Cort | |
1103 | + */ | |
1104 | + if ( chrp_int_ack_special ) | |
1105 | + irq = *chrp_int_ack_special; | |
1106 | + else | |
1107 | + irq = i8259_irq(0); | |
1108 | + /* | |
1109 | + * Acknowledge as soon as possible to allow i8259 | |
1110 | + * interrupt nesting */ | |
1111 | + openpic_eoi(smp_processor_id()); | |
1112 | + openpic_eoi_done = 1; | |
1113 | + } | |
1114 | + if (irq == OPENPIC_VEC_SPURIOUS) | |
1115 | + { | |
1116 | + /* | |
1117 | + * Spurious interrupts should never be | |
1118 | + * acknowledged | |
1119 | + */ | |
1120 | + ppc_spurious_interrupts++; | |
1121 | + openpic_eoi_done = 1; | |
1122 | + goto out; | |
1123 | + } | |
1124 | + bits = 1UL << irq; | |
1125 | + | |
1126 | + if (irq < 0) | |
1127 | + { | |
1128 | + printk(KERN_DEBUG "Bogus interrupt %d from PC = %lx\n", | |
1129 | + irq, regs->nip); | |
1130 | + ppc_spurious_interrupts++; | |
1131 | + } | |
1132 | + else | |
1133 | + { | |
1134 | + ppc_irq_dispatch_handler( regs, irq ); | |
1135 | + } | |
1136 | +out: | |
1137 | + if (!openpic_eoi_done) | |
1138 | + openpic_eoi(smp_processor_id()); | |
1139 | +} | |
1140 | + | |
1141 | __initfunc(void | |
1142 | chrp_init_IRQ(void)) | |
1143 | { | |
1144 | @@ -373,7 +448,7 @@ | |
1145 | (*(unsigned long *)get_property(np, | |
1146 | "8259-interrupt-acknowledge", NULL)); | |
1147 | } | |
1148 | - open_pic.irq_offset = NUM_8259_INTERRUPTS; | |
1149 | + open_pic.irq_offset = 16; | |
1150 | for ( i = 16 ; i < NR_IRQS ; i++ ) | |
1151 | irq_desc[i].ctl = &open_pic; | |
1152 | openpic_init(1); | |
1153 | @@ -381,7 +456,7 @@ | |
1154 | irq_desc[i].ctl = &i8259_pic; | |
1155 | i8259_init(); | |
1156 | #ifdef CONFIG_XMON | |
1157 | - request_irq(HYDRA_INT_ADB_NMI+open_pic.irq_offset, | |
1158 | + request_irq(openpic_to_irq(HYDRA_INT_ADB_NMI), | |
1159 | xmon_irq, 0, "NMI", 0); | |
1160 | #endif /* CONFIG_XMON */ | |
1161 | #ifdef __SMP__ | |
1162 | @@ -570,7 +645,7 @@ | |
1163 | ppc_md.get_cpuinfo = chrp_get_cpuinfo; | |
1164 | ppc_md.irq_cannonicalize = chrp_irq_cannonicalize; | |
1165 | ppc_md.init_IRQ = chrp_init_IRQ; | |
1166 | - ppc_md.do_IRQ = open_pic_do_IRQ; | |
1167 | + ppc_md.do_IRQ = chrp_do_IRQ; | |
1168 | ||
1169 | ppc_md.init = chrp_init2; | |
1170 | ||
1171 | @@ -612,8 +687,3 @@ | |
1172 | while ( *s ) | |
1173 | call_rtas( "display-character", 1, 1, NULL, *s++ ); | |
1174 | } | |
1175 | - | |
1176 | -void chrp_indicator(int x) | |
1177 | -{ | |
1178 | - call_rtas("set-indicator", 3, 1, NULL, 6, 0, x); | |
1179 | -} | |
1180 | diff -urN linux.orig/arch/ppc/kernel/chrp_time.c linux/arch/ppc/kernel/chrp_time.c | |
1181 | --- linux.orig/arch/ppc/kernel/chrp_time.c Sun Mar 25 18:31:49 2001 | |
1182 | +++ linux/arch/ppc/kernel/chrp_time.c Thu Jul 11 15:43:29 2002 | |
1183 | @@ -25,25 +25,24 @@ | |
1184 | #include <asm/processor.h> | |
1185 | #include <asm/nvram.h> | |
1186 | #include <asm/prom.h> | |
1187 | -#include <asm/time.h> | |
1188 | +#include "time.h" | |
1189 | ||
1190 | static int nvram_as1 = NVRAM_AS1; | |
1191 | static int nvram_as0 = NVRAM_AS0; | |
1192 | static int nvram_data = NVRAM_DATA; | |
1193 | ||
1194 | -__initfunc(long chrp_time_init(void)) | |
1195 | +__initfunc(void chrp_time_init(void)) | |
1196 | { | |
1197 | struct device_node *rtcs; | |
1198 | int base; | |
1199 | ||
1200 | rtcs = find_compatible_devices("rtc", "pnpPNP,b00"); | |
1201 | if (rtcs == NULL || rtcs->addrs == NULL) | |
1202 | - return 0; | |
1203 | + return; | |
1204 | base = rtcs->addrs[0].address; | |
1205 | nvram_as1 = 0; | |
1206 | nvram_as0 = base; | |
1207 | nvram_data = base + 1; | |
1208 | - return 0; | |
1209 | } | |
1210 | ||
1211 | int chrp_cmos_clock_read(int addr) | |
1212 | diff -urN linux.orig/arch/ppc/kernel/gemini_setup.c linux/arch/ppc/kernel/gemini_setup.c | |
1213 | --- linux.orig/arch/ppc/kernel/gemini_setup.c Sun Mar 25 18:31:49 2001 | |
1214 | +++ linux/arch/ppc/kernel/gemini_setup.c Thu Jul 11 15:45:25 2002 | |
1215 | @@ -21,7 +21,6 @@ | |
1216 | #include <linux/blk.h> | |
1217 | #include <linux/console.h> | |
1218 | #include <linux/openpic.h> | |
1219 | -#include <linux/delay.h> | |
1220 | ||
1221 | #include <asm/system.h> | |
1222 | #include <asm/pgtable.h> | |
1223 | @@ -30,9 +29,8 @@ | |
1224 | #include <asm/io.h> | |
1225 | #include <asm/m48t35.h> | |
1226 | #include <asm/gemini.h> | |
1227 | -#include <asm/processor.h> | |
1228 | ||
1229 | -#include <asm/time.h> | |
1230 | +#include "time.h" | |
1231 | #include "local_irq.h" | |
1232 | #include "open_pic.h" | |
1233 | ||
1234 | @@ -168,6 +166,8 @@ | |
1235 | ioremap( GEMINI_MPIC_ADDR, sizeof( struct OpenPIC )); | |
1236 | } | |
1237 | ||
1238 | + | |
1239 | +extern unsigned long loops_per_jiffy; | |
1240 | extern int root_mountflags; | |
1241 | extern char cmd_line[]; | |
1242 | ||
1243 | @@ -258,6 +258,14 @@ | |
1244 | return clock; | |
1245 | } | |
1246 | ||
1247 | + | |
1248 | +#define L2CR_PIPE_LATEWR (0x01800000) /* late-write SRAM */ | |
1249 | +#define L2CR_L2CTL (0x00100000) /* RAM control */ | |
1250 | +#define L2CR_INST_DISABLE (0x00400000) /* disable for insn's */ | |
1251 | +#define L2CR_L2I (0x00200000) /* global invalidate */ | |
1252 | +#define L2CR_L2E (0x80000000) /* enable */ | |
1253 | +#define L2CR_L2WT (0x00080000) /* write-through */ | |
1254 | + | |
1255 | void __init gemini_init_l2(void) | |
1256 | { | |
1257 | unsigned char reg; | |
1258 | @@ -331,7 +339,8 @@ | |
1259 | cache |= L2CR_L2WT; | |
1260 | #endif | |
1261 | cache |= L2CR_PIPE_LATEWR|L2CR_L2CTL|L2CR_INST_DISABLE; | |
1262 | - _set_L2CR(cache|L2CR_L2E); | |
1263 | + _set_L2CR(0); | |
1264 | + _set_L2CR(cache|L2CR_L2I|L2CR_L2E); | |
1265 | } | |
1266 | } | |
1267 | ||
1268 | @@ -381,7 +390,7 @@ | |
1269 | #define gemini_rtc_write(val,x) (writeb((val),(GEMINI_RTC+(x)))) | |
1270 | ||
1271 | /* ensure that the RTC is up and running */ | |
1272 | -long __init gemini_time_init(void) | |
1273 | +void __init gemini_time_init(void) | |
1274 | { | |
1275 | unsigned char reg; | |
1276 | ||
1277 | @@ -392,7 +401,6 @@ | |
1278 | gemini_rtc_write((reg & ~(M48T35_RTC_STOPPED)), M48T35_RTC_CONTROL); | |
1279 | gemini_rtc_write((reg | M48T35_RTC_SET), M48T35_RTC_CONTROL); | |
1280 | } | |
1281 | - return 0; | |
1282 | } | |
1283 | ||
1284 | #undef DEBUG_RTC | |
1285 | diff -urN linux.orig/arch/ppc/kernel/head.S linux/arch/ppc/kernel/head.S | |
1286 | --- linux.orig/arch/ppc/kernel/head.S Fri Nov 2 17:39:05 2001 | |
1287 | +++ linux/arch/ppc/kernel/head.S Thu Jul 11 15:43:29 2002 | |
1288 | @@ -13,7 +13,6 @@ | |
1289 | * Copyright (C) 1996 Paul Mackerras. | |
1290 | * MPC8xx modifications Copyright (C) 1997 Dan Malek (dmalek@jlc.net). | |
1291 | * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk). | |
1292 | - * AltiVec additions by Kumar Gala (kumar.gala@motorola.com). | |
1293 | * | |
1294 | * This file contains the low-level support and setup for the | |
1295 | * PowerPC platform, including trap and interrupt dispatch. | |
1296 | @@ -23,10 +22,6 @@ | |
1297 | * modify it under the terms of the GNU General Public License | |
1298 | * as published by the Free Software Foundation; either version | |
1299 | * 2 of the License, or (at your option) any later version. | |
1300 | - * | |
1301 | - * 2000-04-10. | |
1302 | - * Add sys_rt_sigreturn in DoSyscall Handler. | |
1303 | - * Giovanna Ambrosini (ambrosini@lightning.ch). | |
1304 | * | |
1305 | */ | |
1306 | ||
1307 | @@ -87,28 +82,6 @@ | |
1308 | #define REST_16FPRS(n, base) REST_8FPRS(n, base); REST_8FPRS(n+8, base) | |
1309 | #define REST_32FPRS(n, base) REST_16FPRS(n, base); REST_16FPRS(n+16, base) | |
1310 | ||
1311 | -/* | |
1312 | - * Once a version of gas that understands the AltiVec instructions | |
1313 | - * is freely available, we can do this the normal way... - paulus | |
1314 | - */ | |
1315 | -#define LVX(r,a,b) .long (31<<26)+((r)<<21)+((a)<<16)+((b)<<11)+(103<<1) | |
1316 | -#define STVX(r,a,b) .long (31<<26)+((r)<<21)+((a)<<16)+((b)<<11)+(231<<1) | |
1317 | -#define MFVSCR(r) .long (4<<26)+((r)<<11)+(770<<1) | |
1318 | -#define MTVSCR(r) .long (4<<26)+((r)<<11)+(802<<1) | |
1319 | - | |
1320 | -#define SAVE_VR(n,b,base) li b,TSS_VR0+(16*(n)); STVX(n,b,base) | |
1321 | -#define SAVE_2VR(n,b,base) SAVE_VR(n,b,base); SAVE_VR(n+1,b,base) | |
1322 | -#define SAVE_4VR(n,b,base) SAVE_2VR(n,b,base); SAVE_2VR(n+2,b,base) | |
1323 | -#define SAVE_8VR(n,b,base) SAVE_4VR(n,b,base); SAVE_4VR(n+4,b,base) | |
1324 | -#define SAVE_16VR(n,b,base) SAVE_8VR(n,b,base); SAVE_8VR(n+8,b,base) | |
1325 | -#define SAVE_32VR(n,b,base) SAVE_16VR(n,b,base); SAVE_16VR(n+16,b,base) | |
1326 | -#define REST_VR(n,b,base) li b,TSS_VR0+(16*(n)); LVX(n,b,base) | |
1327 | -#define REST_2VR(n,b,base) REST_VR(n,b,base); REST_VR(n+1,b,base) | |
1328 | -#define REST_4VR(n,b,base) REST_2VR(n,b,base); REST_2VR(n+2,b,base) | |
1329 | -#define REST_8VR(n,b,base) REST_4VR(n,b,base); REST_4VR(n+4,b,base) | |
1330 | -#define REST_16VR(n,b,base) REST_8VR(n,b,base); REST_8VR(n+8,b,base) | |
1331 | -#define REST_32VR(n,b,base) REST_16VR(n,b,base); REST_16VR(n+16,b,base) | |
1332 | - | |
1333 | #define SYNC \ | |
1334 | sync; \ | |
1335 | isync | |
1336 | @@ -262,15 +235,66 @@ | |
1337 | __secondary_start: | |
1338 | /* Switch MMU off, clear BATs and flush TLB */ | |
1339 | bl mmu_off | |
1340 | -mmu_off_return: | |
1341 | bl clear_bats | |
1342 | bl flush_tlbs | |
1343 | - bl setup_init_bats | |
1344 | -#ifndef CONFIG_APUS | |
1345 | -#ifdef CONFIG_BOOTX_TEXT | |
1346 | - bl setup_disp_bat | |
1347 | -#endif | |
1348 | + | |
1349 | +/* Use the first pair of BAT registers to map the 1st 16MB | |
1350 | + * of RAM to KERNELBASE. From this point on we can't safely | |
1351 | + * call OF any more. | |
1352 | + */ | |
1353 | + lis r11,KERNELBASE@h | |
1354 | + mfspr r9,PVR | |
1355 | + rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */ | |
1356 | + cmpi 0,r9,1 | |
1357 | + bne 4f | |
1358 | + ori r11,r11,4 /* set up BAT registers for 601 */ | |
1359 | + li r8,0x7f /* valid, block length = 8MB */ | |
1360 | + oris r9,r11,0x800000@h /* set up BAT reg for 2nd 8M */ | |
1361 | + oris r10,r8,0x800000@h /* set up BAT reg for 2nd 8M */ | |
1362 | + mtspr IBAT0U,r11 /* N.B. 601 has valid bit in */ | |
1363 | + mtspr IBAT0L,r8 /* lower BAT register */ | |
1364 | + mtspr IBAT1U,r9 | |
1365 | + mtspr IBAT1L,r10 | |
1366 | + b 5f | |
1367 | +4: | |
1368 | +#ifdef CONFIG_APUS | |
1369 | + ori r11,r11,BL_8M<<2|0x2 /* set up an 8MB mapping */ | |
1370 | + ori r11,r11,0xfe /* set up an 8MB mapping */ | |
1371 | + lis r8,CYBERBASEp@h | |
1372 | + lwz r8,0(r8) | |
1373 | + addis r8,r8,KERNELBASE@h | |
1374 | + addi r8,r8,2 | |
1375 | +#else | |
1376 | + ori r11,r11,BL_256M<<2|0x2 /* set up BAT registers for 604 */ | |
1377 | + li r8,2 /* R/W access */ | |
1378 | + /* | |
1379 | + * If the MMU is off clear the bats. See clear_bat() -- Cort | |
1380 | + */ | |
1381 | +#ifndef CONFIG_GEMINI | |
1382 | + /* | |
1383 | + * allow secondary cpus to get at all of ram in early bootup | |
1384 | + * since their init_task may be up there -- Cort | |
1385 | + */ | |
1386 | + oris r18,r8,0x10000000@h | |
1387 | + oris r21,r11,(KERNELBASE+0x10000000)@h | |
1388 | + mtspr DBAT1L,r18 /* N.B. 6xx (not 601) have valid */ | |
1389 | + mtspr DBAT1U,r21 /* bit in upper BAT register */ | |
1390 | + mtspr IBAT1L,r18 | |
1391 | + mtspr IBAT1U,r21 | |
1392 | + | |
1393 | + oris r18,r8,0x20000000@h | |
1394 | + oris r21,r11,(KERNELBASE+0x20000000)@h | |
1395 | + mtspr DBAT2L,r18 /* N.B. 6xx (not 601) have valid */ | |
1396 | + mtspr DBAT2U,r21 /* bit in upper BAT register */ | |
1397 | + mtspr IBAT2L,r18 | |
1398 | + mtspr IBAT2U,r21 | |
1399 | +#endif /* ndef CONFIG_GEMINI */ | |
1400 | #endif | |
1401 | + mtspr DBAT0L,r8 /* N.B. 6xx (not 601) have valid */ | |
1402 | + mtspr DBAT0U,r11 /* bit in upper BAT register */ | |
1403 | + mtspr IBAT0L,r8 | |
1404 | + mtspr IBAT0U,r11 | |
1405 | +5: isync | |
1406 | #ifdef CONFIG_APUS | |
1407 | /* Unfortunately the APUS specific instructions bloat the | |
1408 | * code so it cannot fit in the 0x100 bytes available. We have | |
1409 | @@ -396,15 +420,6 @@ | |
1410 | #endif /* CONFIG_8xx */ | |
1411 | b turn_on_mmu | |
1412 | ||
1413 | -/* Hack for sleep on Core99 machines | |
1414 | - */ | |
1415 | -#ifdef CONFIG_POWERMAC | |
1416 | - . = 0x80 | |
1417 | -SleepVector: | |
1418 | - .long 0 | |
1419 | - .long 0 | |
1420 | -#endif /* CONFIG_POWERMAC */ | |
1421 | - | |
1422 | /* | |
1423 | * GCC sometimes accesses words at negative offsets from the stack | |
1424 | * pointer, although the SysV ABI says it shouldn't. To cope with | |
1425 | @@ -477,7 +492,7 @@ | |
1426 | #endif /* CONFIG_GEMINI */ | |
1427 | #else | |
1428 | STD_EXCEPTION(0x100, Reset, UnknownException) | |
1429 | -#endif | |
1430 | +#endif | |
1431 | ||
1432 | /* Machine check */ | |
1433 | STD_EXCEPTION(0x200, MachineCheck, MachineCheckException) | |
1434 | @@ -636,26 +651,7 @@ | |
1435 | STD_EXCEPTION(0xd00, SingleStep, SingleStepException) | |
1436 | ||
1437 | STD_EXCEPTION(0xe00, Trap_0e, UnknownException) | |
1438 | - | |
1439 | -#ifndef CONFIG_ALTIVEC | |
1440 | STD_EXCEPTION(0xf00, Trap_0f, UnknownException) | |
1441 | -#else | |
1442 | -/* | |
1443 | - * The Altivec unavailable trap is at 0x0f20. Foo. | |
1444 | - * We effectively remap it to 0x3000. | |
1445 | - */ | |
1446 | - . = 0xf00 | |
1447 | - b Trap_0f | |
1448 | -trap_0f_cont: | |
1449 | - addi r3,r1,STACK_FRAME_OVERHEAD | |
1450 | - li r20,MSR_KERNEL | |
1451 | - bl transfer_to_handler | |
1452 | - .long UnknownException | |
1453 | - .long int_return | |
1454 | - | |
1455 | - . = 0xf20 | |
1456 | - b AltiVecUnavailable | |
1457 | -#endif /* CONFIG_ALTIVEC */ | |
1458 | ||
1459 | #ifndef CONFIG_8xx | |
1460 | /* | |
1461 | @@ -1173,24 +1169,9 @@ | |
1462 | STD_EXCEPTION(0x2f00, Trap_2f, UnknownException) | |
1463 | ||
1464 | . = 0x3000 | |
1465 | -#ifdef CONFIG_ALTIVEC | |
1466 | -AltiVecUnavailable: | |
1467 | - EXCEPTION_PROLOG | |
1468 | - bne load_up_altivec /* if from user, just load it up */ | |
1469 | - li r20,MSR_KERNEL | |
1470 | - bl transfer_to_handler /* if from kernel, take a trap */ | |
1471 | - .long KernelAltiVec | |
1472 | - .long int_return | |
1473 | - | |
1474 | -/* here are the bits of trap 0xf00 which got displaced */ | |
1475 | -Trap_0f: | |
1476 | - EXCEPTION_PROLOG | |
1477 | - b trap_0f_cont | |
1478 | -#endif /* CONFIG_ALTIVEC */ | |
1479 | - | |
1480 | -#else /* CONFIG_8xx */ | |
1481 | +#else | |
1482 | . = 0x2000 | |
1483 | -#endif /* CONFIG_8xx */ | |
1484 | +#endif | |
1485 | ||
1486 | /* | |
1487 | * This code finishes saving the registers to the exception frame | |
1488 | @@ -1345,7 +1326,11 @@ | |
1489 | /* Construct the high word of the PPC-style PTE */ | |
1490 | mfsrin r5,r3 /* get segment reg for segment */ | |
1491 | rlwinm r5,r5,7,1,24 /* put VSID in 0x7fffff80 bits */ | |
1492 | + | |
1493 | +#ifndef __SMP__ /* do this later for SMP */ | |
1494 | oris r5,r5,0x8000 /* set V (valid) bit */ | |
1495 | +#endif | |
1496 | + | |
1497 | rlwimi r5,r3,10,26,31 /* put in API (abbrev page index) */ | |
1498 | /* Get the address of the primary PTE group in the hash table */ | |
1499 | .globl hash_page_patch_A | |
1500 | @@ -1457,7 +1442,6 @@ | |
1501 | */ | |
1502 | found_empty: | |
1503 | found_slot: | |
1504 | - clrlwi r5,r5,1 /* clear valid bit (0x80000000) */ | |
1505 | stw r5,0(r3) /* clear V (valid) bit in PTE */ | |
1506 | sync | |
1507 | tlbsync | |
1508 | @@ -1509,7 +1493,6 @@ | |
1509 | REST_GPR(20, r21) | |
1510 | REST_2GPRS(22, r21) | |
1511 | lwz r21,GPR21(r21) | |
1512 | - sync | |
1513 | rfi | |
1514 | ||
1515 | #ifdef __SMP__ | |
1516 | @@ -1649,145 +1632,24 @@ | |
1517 | #endif /* __SMP__ */ | |
1518 | blr | |
1519 | ||
1520 | -#ifdef CONFIG_ALTIVEC | |
1521 | -/* Note that the AltiVec support is closely modeled after the FP | |
1522 | - * support. Changes to one are likely to be applicable to the | |
1523 | - * other! */ | |
1524 | -load_up_altivec: | |
1525 | -/* | |
1526 | - * Disable AltiVec for the task which had AltiVec previously, | |
1527 | - * and save its AltiVec registers in its thread_struct. | |
1528 | - * Enables AltiVec for use in the kernel on return. | |
1529 | - * On SMP we know the AltiVec units are free, since we give it up every | |
1530 | - * switch. -- Kumar | |
1531 | - */ | |
1532 | - mfmsr r5 | |
1533 | - oris r5,r5,MSR_VEC@h | |
1534 | - SYNC | |
1535 | - mtmsr r5 /* enable use of AltiVec now */ | |
1536 | - SYNC | |
1537 | -/* | |
1538 | - * For SMP, we don't do lazy AltiVec switching because it just gets too | |
1539 | - * horrendously complex, especially when a task switches from one CPU | |
1540 | - * to another. Instead we call giveup_altivec in switch_to. | |
1541 | - */ | |
1542 | -#ifndef __SMP__ | |
1543 | -#ifndef CONFIG_APUS | |
1544 | - lis r6,-KERNELBASE@h | |
1545 | -#else | |
1546 | - lis r6,CYBERBASEp@h | |
1547 | - lwz r6,0(r6) | |
1548 | -#endif | |
1549 | - addis r3,r6,last_task_used_altivec@ha | |
1550 | - lwz r4,last_task_used_altivec@l(r3) | |
1551 | - cmpi 0,r4,0 | |
1552 | - beq 1f | |
1553 | - add r4,r4,r6 | |
1554 | - addi r4,r4,TSS /* want TSS of last_task_used_altivec */ | |
1555 | - SAVE_32VR(0,r20,r4) | |
1556 | - MFVSCR(vr0) | |
1557 | - li r20,TSS_VSCR | |
1558 | - STVX(vr0,r20,r4) | |
1559 | - lwz r5,PT_REGS(r4) | |
1560 | - add r5,r5,r6 | |
1561 | - lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5) | |
1562 | - lis r20,MSR_VEC@h | |
1563 | - andc r4,r4,r20 /* disable altivec for previous task */ | |
1564 | - stw r4,_MSR-STACK_FRAME_OVERHEAD(r5) | |
1565 | -1: | |
1566 | -#endif /* __SMP__ */ | |
1567 | - /* enable use of AltiVec after return */ | |
1568 | - oris r23,r23,MSR_VEC@h | |
1569 | - mfspr r5,SPRG3 /* current task's TSS (phys) */ | |
1570 | - li r20,TSS_VSCR | |
1571 | - LVX(vr0,r20,r5) | |
1572 | - MTVSCR(vr0) | |
1573 | - REST_32VR(0,r20,r5) | |
1574 | -#ifndef __SMP__ | |
1575 | - subi r4,r5,TSS | |
1576 | - sub r4,r4,r6 | |
1577 | - stw r4,last_task_used_altivec@l(r3) | |
1578 | -#endif /* __SMP__ */ | |
1579 | - /* restore registers and return */ | |
1580 | - lwz r3,_CCR(r21) | |
1581 | - lwz r4,_LINK(r21) | |
1582 | - mtcrf 0xff,r3 | |
1583 | - mtlr r4 | |
1584 | - REST_GPR(1, r21) | |
1585 | - REST_4GPRS(3, r21) | |
1586 | - /* we haven't used ctr or xer */ | |
1587 | - mtspr SRR1,r23 | |
1588 | - mtspr SRR0,r22 | |
1589 | - REST_GPR(20, r21) | |
1590 | - REST_2GPRS(22, r21) | |
1591 | - lwz r21,GPR21(r21) | |
1592 | - SYNC | |
1593 | - rfi | |
1594 | - | |
1595 | -/* | |
1596 | - * AltiVec unavailable trap from kernel - print a message, but let | |
1597 | - * the task use AltiVec in the kernel until it returns to user mode. | |
1598 | - */ | |
1599 | -KernelAltiVec: | |
1600 | - lwz r3,_MSR(r1) | |
1601 | - oris r3,r3,MSR_VEC@h | |
1602 | - stw r3,_MSR(r1) /* enable use of AltiVec after return */ | |
1603 | - lis r3,87f@h | |
1604 | - ori r3,r3,87f@l | |
1605 | - mr r4,r2 /* current */ | |
1606 | - lwz r5,_NIP(r1) | |
1607 | - bl printk | |
1608 | - b int_return | |
1609 | -87: .string "AltiVec used in kernel (task=%p, pc=%x) \n" | |
1610 | - .align 4 | |
1611 | - | |
1612 | -/* | |
1613 | - * giveup_altivec(tsk) | |
1614 | - * Disable AltiVec for the task given as the argument, | |
1615 | - * and save the AltiVec registers in its thread_struct. | |
1616 | - * Enables AltiVec for use in the kernel on return. | |
1617 | - */ | |
1618 | - | |
1619 | - .globl giveup_altivec | |
1620 | -giveup_altivec: | |
1621 | - mfmsr r5 | |
1622 | - oris r5,r5,MSR_VEC@h | |
1623 | - SYNC | |
1624 | - mtmsr r5 /* enable use of AltiVec now */ | |
1625 | - SYNC | |
1626 | - cmpi 0,r3,0 | |
1627 | - beqlr- /* if no previous owner, done */ | |
1628 | - addi r3,r3,TSS /* want TSS of task */ | |
1629 | - lwz r5,PT_REGS(r3) | |
1630 | - cmpi 0,r5,0 | |
1631 | - SAVE_32VR(0, r4, r3) | |
1632 | - MFVSCR(vr0) | |
1633 | - li r4,TSS_VSCR | |
1634 | - STVX(vr0, r4, r3) | |
1635 | - beq 1f | |
1636 | - lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5) | |
1637 | - lis r3,MSR_VEC@h | |
1638 | - andc r4,r4,r3 /* disable AltiVec for previous task */ | |
1639 | - stw r4,_MSR-STACK_FRAME_OVERHEAD(r5) | |
1640 | -1: | |
1641 | -#ifndef __SMP__ | |
1642 | - li r5,0 | |
1643 | - lis r4,last_task_used_altivec@ha | |
1644 | - stw r5,last_task_used_altivec@l(r4) | |
1645 | -#endif /* __SMP__ */ | |
1646 | +#else /* CONFIG_8xx */ | |
1647 | + .globl giveup_fpu | |
1648 | +giveup_fpu: | |
1649 | blr | |
1650 | -#endif /* CONFIG_ALTIVEC */ | |
1651 | +#endif /* CONFIG_8xx */ | |
1652 | ||
1653 | mmu_off: | |
1654 | - addi r4, r3, mmu_off_return - _start | |
1655 | + addi r4, r3, __secondary_start - _start | |
1656 | mfmsr r3 | |
1657 | andi. r0,r3,MSR_DR|MSR_IR /* MMU enabled? */ | |
1658 | - beqlr | |
1659 | - andc r3,r3,r0 | |
1660 | + beq 1f | |
1661 | + ori r3,r3,MSR_DR|MSR_IR | |
1662 | + xori r3,r3,MSR_DR|MSR_IR | |
1663 | mtspr SRR0,r4 | |
1664 | mtspr SRR1,r3 | |
1665 | - SYNC | |
1666 | + sync | |
1667 | rfi | |
1668 | +1: blr | |
1669 | ||
1670 | /* | |
1671 | * This code is jumped to from the startup code to copy | |
1672 | @@ -1798,6 +1660,10 @@ | |
1673 | addi r9,r9,0x6f58 /* translate source addr */ | |
1674 | cmpw r31,r9 /* (we have to on chrp) */ | |
1675 | beq 7f | |
1676 | +#if 0 // still needed ? breaks on me if I don't disable this | |
1677 | + rlwinm r4,r4,0,8,31 /* translate source address */ | |
1678 | + add r4,r4,r3 /* to region mapped with BATs */ | |
1679 | +#endif | |
1680 | 7: addis r9,r26,klimit@ha /* fetch klimit */ | |
1681 | lwz r25,klimit@l(r9) | |
1682 | addis r25,r25,-KERNELBASE@h | |
1683 | @@ -1845,12 +1711,6 @@ | |
1684 | . = 0x4000 | |
1685 | #endif | |
1686 | ||
1687 | -#else /* CONFIG_8xx */ | |
1688 | - .globl giveup_fpu | |
1689 | -giveup_fpu: | |
1690 | - blr | |
1691 | -#endif /* CONFIG_8xx */ | |
1692 | - | |
1693 | turn_on_mmu: | |
1694 | mfmsr r0 | |
1695 | ori r1,r0,MSR_DR|MSR_IR | |
1696 | @@ -1913,7 +1773,7 @@ | |
1697 | mfspr r9,PVR | |
1698 | rlwinm r9,r9,16,16,31 | |
1699 | cmpi 0,r9,1 | |
1700 | - beq 6f /* not needed for 601 */ | |
1701 | + beq 4f /* not needed for 601 */ | |
1702 | mfspr r11,HID0 | |
1703 | andi. r0,r11,HID0_DCE | |
1704 | ori r11,r11,HID0_ICE|HID0_DCE | |
1705 | @@ -1930,24 +1790,14 @@ | |
1706 | cmpi 0,r9,4 /* check for 604 */ | |
1707 | cmpi 1,r9,9 /* or 604e */ | |
1708 | cmpi 2,r9,10 /* or mach5 */ | |
1709 | - cmpi 3,r9,8 /* check for 750 (G3) */ | |
1710 | - cmpi 4,r9,12 /* or 7400 (G4) */ | |
1711 | cror 2,2,6 | |
1712 | cror 2,2,10 | |
1713 | bne 4f | |
1714 | ori r11,r11,HID0_SIED|HID0_BHTE /* for 604[e], enable */ | |
1715 | bne 2,5f | |
1716 | ori r11,r11,HID0_BTCD | |
1717 | - b 5f | |
1718 | -4: | |
1719 | - cror 14,14,18 | |
1720 | - bne 3,6f | |
1721 | - ori r11,r11,HID0_SGE|HID0_BHTE|HID0_BTIC|HID0_ABE /* for g3/g4, enable */ | |
1722 | - rlwinm r11,r11,0,23,21 /* clear HID0_SPD */ | |
1723 | - li r3,0 | |
1724 | - mtspr ICTC,r3 | |
1725 | 5: mtspr HID0,r11 /* superscalar exec & br history tbl */ | |
1726 | -6: | |
1727 | +4: | |
1728 | #endif /* CONFIG_8xx */ | |
1729 | #ifdef __SMP__ | |
1730 | /* if we're the second cpu stack and r2 are different | |
1731 | @@ -2028,10 +1878,10 @@ | |
1732 | li r3,MSR_KERNEL & ~(MSR_IR|MSR_DR) | |
1733 | mtspr SRR0,r4 | |
1734 | mtspr SRR1,r3 | |
1735 | - SYNC | |
1736 | rfi | |
1737 | /* Load up the kernel context */ | |
1738 | 2: | |
1739 | + SYNC /* Force all PTE updates to finish */ | |
1740 | tlbia /* Clear all TLB entries */ | |
1741 | sync /* wait for tlbia/tlbie to finish */ | |
1742 | #ifdef __SMP__ | |
1743 | @@ -2088,7 +1938,6 @@ | |
1744 | #endif /* __SMP__ */ | |
1745 | mtspr SRR0,r3 | |
1746 | mtspr SRR1,r4 | |
1747 | - SYNC | |
1748 | rfi /* enable MMU and jump to start_kernel */ | |
1749 | ||
1750 | /* | |
1751 | @@ -2126,11 +1975,9 @@ | |
1752 | 1: | |
1753 | #endif /* SHOW_SYSCALLS */ | |
1754 | cmpi 0,r0,0x7777 /* Special case for 'sys_sigreturn' */ | |
1755 | - cmpi 1,r0,0x6666 /* Special case for 'sys_rt_sigreturn' */ | |
1756 | beq- 10f | |
1757 | - beq- cr1,16f | |
1758 | - lwz r10,TASK_PTRACE(r2) | |
1759 | - andi. r10,r10,PT_TRACESYS | |
1760 | + lwz r10,TASK_FLAGS(r2) | |
1761 | + andi. r10,r10,PF_TRACESYS | |
1762 | bne- 50f | |
1763 | cmpli 0,r0,NR_syscalls | |
1764 | bge- 66f | |
1765 | @@ -2175,12 +2022,6 @@ | |
1766 | /* sys_sigreturn */ | |
1767 | 10: addi r3,r1,STACK_FRAME_OVERHEAD | |
1768 | bl sys_sigreturn | |
1769 | - cmpi 0,r3,0 /* Check for restarted system call */ | |
1770 | - bge int_return | |
1771 | - b 20b | |
1772 | -/* sys_rt_sigreturn */ | |
1773 | -16: addi r3,r1,STACK_FRAME_OVERHEAD | |
1774 | - bl sys_rt_sigreturn | |
1775 | cmpi 0,r3,0 /* Check for restarted system call */ | |
1776 | bge int_return | |
1777 | b 20b | |
1778 | @@ -2273,9 +2114,6 @@ | |
1779 | mflr r20 /* Return to switch caller */ | |
1780 | mfmsr r22 | |
1781 | li r0,MSR_FP /* Disable floating-point */ | |
1782 | -#ifdef CONFIG_ALTIVEC | |
1783 | - oris r0,r0,MSR_VEC@h | |
1784 | -#endif /* CONFIG_ALTIVEC */ | |
1785 | andc r22,r22,r0 | |
1786 | stw r20,_NIP(r1) | |
1787 | stw r22,_MSR(r1) | |
1788 | @@ -2589,38 +2427,6 @@ | |
1789 | blr | |
1790 | ||
1791 | /* | |
1792 | - * Copy a whole page. We use the dcbz instruction on the destination | |
1793 | - * to reduce memory traffic (it eliminates the unnecessary reads of | |
1794 | - * the destination into cache). This requires that the destination | |
1795 | - * is cacheable. | |
1796 | - */ | |
1797 | -_GLOBAL(copy_page) | |
1798 | - li r0,4096/CACHE_LINE_SIZE | |
1799 | - mtctr r0 | |
1800 | - addi r3,r3,-4 | |
1801 | - addi r4,r4,-4 | |
1802 | - li r5,4 | |
1803 | -1: dcbz r5,r3 | |
1804 | - lwz r6,4(r4) | |
1805 | - lwz r7,8(r4) | |
1806 | - lwz r8,12(r4) | |
1807 | - lwzu r9,16(r4) | |
1808 | - stw r6,4(r3) | |
1809 | - stw r7,8(r3) | |
1810 | - stw r8,12(r3) | |
1811 | - stwu r9,16(r3) | |
1812 | - lwz r6,4(r4) | |
1813 | - lwz r7,8(r4) | |
1814 | - lwz r8,12(r4) | |
1815 | - lwzu r9,16(r4) | |
1816 | - stw r6,4(r3) | |
1817 | - stw r7,8(r3) | |
1818 | - stw r8,12(r3) | |
1819 | - stwu r9,16(r3) | |
1820 | - bdnz 1b | |
1821 | - blr | |
1822 | - | |
1823 | -/* | |
1824 | * Flush entries from the hash table with VSIDs in the range | |
1825 | * given. | |
1826 | */ | |
1827 | @@ -2798,6 +2604,7 @@ | |
1828 | stw r0,20(r1) | |
1829 | lis r4,rtas_data@ha | |
1830 | lwz r4,rtas_data@l(r4) | |
1831 | + addis r4,r4,-KERNELBASE@h | |
1832 | lis r6,1f@ha /* physical return address for rtas */ | |
1833 | addi r6,r6,1f@l | |
1834 | addis r6,r6,-KERNELBASE@h | |
1835 | @@ -2817,7 +2624,6 @@ | |
1836 | mtspr SPRG2,r7 | |
1837 | mtspr SRR0,r8 | |
1838 | mtspr SRR1,r9 | |
1839 | - SYNC | |
1840 | rfi | |
1841 | 1: addis r9,r1,-KERNELBASE@h | |
1842 | lwz r8,20(r9) /* get return address */ | |
1843 | @@ -2826,7 +2632,6 @@ | |
1844 | mtspr SPRG2,r0 | |
1845 | mtspr SRR0,r8 | |
1846 | mtspr SRR1,r9 | |
1847 | - SYNC | |
1848 | rfi /* return to caller */ | |
1849 | #endif /* CONFIG_8xx */ | |
1850 | ||
1851 | @@ -2851,6 +2656,30 @@ | |
1852 | mtlr r4 | |
1853 | blr | |
1854 | #endif /* CONFIG_8xx */ | |
1855 | + | |
1856 | +/* | |
1857 | + * We put a few things here that have to be page-aligned. | |
1858 | + * This stuff goes at the beginning of the data segment, | |
1859 | + * which is page-aligned. | |
1860 | + */ | |
1861 | + .data | |
1862 | + .globl sdata | |
1863 | +sdata: | |
1864 | + .globl empty_zero_page | |
1865 | +empty_zero_page: | |
1866 | + .space 4096 | |
1867 | + | |
1868 | + .globl swapper_pg_dir | |
1869 | +swapper_pg_dir: | |
1870 | + .space 4096 | |
1871 | + | |
1872 | +/* | |
1873 | + * This space gets a copy of optional info passed to us by the bootstrap | |
1874 | + * Used to pass parameters into the kernel like root=/dev/sda1, etc. | |
1875 | + */ | |
1876 | + .globl cmd_line | |
1877 | +cmd_line: | |
1878 | + .space 512 | |
1879 | ||
1880 | /* | |
1881 | * An undocumented "feature" of 604e requires that the v bit | |
1882 | @@ -2895,117 +2724,4 @@ | |
1883 | blt 1b | |
1884 | sync | |
1885 | blr | |
1886 | - | |
1887 | -/* Use the first pair of BAT registers to map the 1st 16MB | |
1888 | - * of RAM to KERNELBASE. From this point on we can't safely | |
1889 | - * call OF any more. | |
1890 | - */ | |
1891 | -setup_init_bats: | |
1892 | - lis r11,KERNELBASE@h | |
1893 | - mfspr r9,PVR | |
1894 | - rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */ | |
1895 | - cmpi 0,r9,1 | |
1896 | - bne 4f | |
1897 | - ori r11,r11,4 /* set up BAT registers for 601 */ | |
1898 | - li r8,0x7f /* valid, block length = 8MB */ | |
1899 | - oris r9,r11,0x800000@h /* set up BAT reg for 2nd 8M */ | |
1900 | - oris r10,r8,0x800000@h /* set up BAT reg for 2nd 8M */ | |
1901 | - mtspr IBAT0U,r11 /* N.B. 601 has valid bit in */ | |
1902 | - mtspr IBAT0L,r8 /* lower BAT register */ | |
1903 | - mtspr IBAT1U,r9 | |
1904 | - mtspr IBAT1L,r10 | |
1905 | - b 5f | |
1906 | -4: | |
1907 | -#ifdef CONFIG_APUS | |
1908 | - ori r11,r11,BL_8M<<2|0x2 /* set up an 8MB mapping */ | |
1909 | - ori r11,r11,0xfe /* set up an 8MB mapping */ | |
1910 | - lis r8,CYBERBASEp@h | |
1911 | - lwz r8,0(r8) | |
1912 | - addis r8,r8,KERNELBASE@h | |
1913 | - addi r8,r8,2 | |
1914 | -#else | |
1915 | - ori r11,r11,BL_256M<<2|0x2 /* set up BAT registers for 604 */ | |
1916 | - li r8,2 /* R/W access */ | |
1917 | - /* | |
1918 | - * If the MMU is off clear the bats. See clear_bat() -- Cort | |
1919 | - */ | |
1920 | -#ifndef CONFIG_GEMINI | |
1921 | - /* | |
1922 | - * allow secondary cpus to get at all of ram in early bootup | |
1923 | - * since their init_task may be up there -- Cort | |
1924 | - */ | |
1925 | - oris r18,r8,0x10000000@h | |
1926 | - oris r21,r11,(KERNELBASE+0x10000000)@h | |
1927 | - mtspr DBAT1L,r18 /* N.B. 6xx (not 601) have valid */ | |
1928 | - mtspr DBAT1U,r21 /* bit in upper BAT register */ | |
1929 | - mtspr IBAT1L,r18 | |
1930 | - mtspr IBAT1U,r21 | |
1931 | ||
1932 | - oris r18,r8,0x20000000@h | |
1933 | - oris r21,r11,(KERNELBASE+0x20000000)@h | |
1934 | - mtspr DBAT2L,r18 /* N.B. 6xx (not 601) have valid */ | |
1935 | - mtspr DBAT2U,r21 /* bit in upper BAT register */ | |
1936 | - mtspr IBAT2L,r18 | |
1937 | - mtspr IBAT2U,r21 | |
1938 | -#endif /* ndef CONFIG_GEMINI */ | |
1939 | -#endif | |
1940 | - mtspr DBAT0L,r8 /* N.B. 6xx (not 601) have valid */ | |
1941 | - mtspr DBAT0U,r11 /* bit in upper BAT register */ | |
1942 | - mtspr IBAT0L,r8 | |
1943 | - mtspr IBAT0U,r11 | |
1944 | -5: isync | |
1945 | - blr | |
1946 | - | |
1947 | -#ifdef CONFIG_BOOTX_TEXT | |
1948 | -setup_disp_bat: | |
1949 | - /* | |
1950 | - * setup the display bat prepared for us in prom.c | |
1951 | - */ | |
1952 | - mflr r8 | |
1953 | - bl reloc_offset | |
1954 | - mtlr r8 | |
1955 | - lis r8, disp_BATL@h | |
1956 | - ori r8, r8, disp_BATL@l | |
1957 | - add r8, r3, r8 | |
1958 | - lwz r8, 0(r8) | |
1959 | - lis r11, disp_BATU@h | |
1960 | - ori r11, r11, disp_BATU@l | |
1961 | - add r11, r3, r11 | |
1962 | - lwz r11, 0(r11) | |
1963 | - mtspr IBAT3L,r8 | |
1964 | - mtspr IBAT3U,r11 | |
1965 | - mfspr r9,PVR | |
1966 | - rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */ | |
1967 | - cmpi 0,r9,1 | |
1968 | - beq 1f | |
1969 | - mtspr DBAT3L,r8 | |
1970 | - mtspr DBAT3U,r11 | |
1971 | -1: | |
1972 | - blr | |
1973 | -#endif | |
1974 | - | |
1975 | -/* | |
1976 | - * We put a few things here that have to be page-aligned. | |
1977 | - * This stuff goes at the beginning of the data segment, | |
1978 | - * which is page-aligned. | |
1979 | - */ | |
1980 | - .data | |
1981 | - .globl sdata | |
1982 | -sdata: | |
1983 | - .globl empty_zero_page | |
1984 | -empty_zero_page: | |
1985 | - .space 4096 | |
1986 | - | |
1987 | - .globl swapper_pg_dir | |
1988 | -swapper_pg_dir: | |
1989 | - .space 4096 | |
1990 | - | |
1991 | -/* | |
1992 | - * This space gets a copy of optional info passed to us by the bootstrap | |
1993 | - * Used to pass parameters into the kernel like root=/dev/sda1, etc. | |
1994 | - */ | |
1995 | - .globl cmd_line | |
1996 | -cmd_line: | |
1997 | - .space 512 | |
1998 | - | |
1999 | - | |
2000 | diff -urN linux.orig/arch/ppc/kernel/irq.c linux/arch/ppc/kernel/irq.c | |
2001 | --- linux.orig/arch/ppc/kernel/irq.c Sun Mar 25 18:31:48 2001 | |
2002 | +++ linux/arch/ppc/kernel/irq.c Thu Jul 11 15:43:29 2002 | |
2003 | @@ -61,9 +61,7 @@ | |
2004 | ||
2005 | #include "local_irq.h" | |
2006 | ||
2007 | -extern atomic_t ipi_recv; | |
2008 | -extern atomic_t ipi_sent; | |
2009 | -void enable_irq(unsigned int irq_nr); | |
2010 | +extern volatile unsigned long ipi_count; | |
2011 | void enable_irq(unsigned int irq_nr); | |
2012 | void disable_irq(unsigned int irq_nr); | |
2013 | ||
2014 | @@ -139,21 +137,20 @@ | |
2015 | if (!handler) | |
2016 | { | |
2017 | /* Free */ | |
2018 | - p = &irq_desc[irq].action; | |
2019 | - while ((action = *p) != NULL && action->dev_id != dev_id) | |
2020 | - p = &action->next; | |
2021 | - if (action == NULL) | |
2022 | - return -ENOENT; | |
2023 | - | |
2024 | - /* Found it - now free it */ | |
2025 | - save_flags(flags); | |
2026 | - cli(); | |
2027 | - *p = action->next; | |
2028 | - if (irq_desc[irq].action == NULL) | |
2029 | - disable_irq(irq); | |
2030 | - restore_flags(flags); | |
2031 | - irq_kfree(action); | |
2032 | - return 0; | |
2033 | + for (p = &irq_desc[irq].action; (action = *p) != NULL; p = &action->next) | |
2034 | + { | |
2035 | + if (action->dev_id == dev_id) | |
2036 | + { | |
2037 | + /* Found it - now free it */ | |
2038 | + save_flags(flags); | |
2039 | + cli(); | |
2040 | + *p = action->next; | |
2041 | + restore_flags(flags); | |
2042 | + irq_kfree(action); | |
2043 | + return 0; | |
2044 | + } | |
2045 | + } | |
2046 | + return -ENOENT; | |
2047 | } | |
2048 | ||
2049 | action = (struct irqaction *) | |
2050 | @@ -244,10 +241,8 @@ | |
2051 | } | |
2052 | #ifdef __SMP__ | |
2053 | /* should this be per processor send/receive? */ | |
2054 | - /* should this be per processor send/receive? */ | |
2055 | - len += sprintf(buf+len, "IPI: (recv/sent) %10lu/%lu\n", | |
2056 | - atomic_read(&ipi_recv), atomic_read(&ipi_sent)); | |
2057 | -#endif /* __SMP__ */ | |
2058 | + len += sprintf(buf+len, "IPI: %10lu\n", ipi_count); | |
2059 | +#endif | |
2060 | len += sprintf(buf+len, "BAD: %10u\n", ppc_spurious_interrupts); | |
2061 | return len; | |
2062 | } | |
2063 | @@ -322,14 +317,10 @@ | |
2064 | atomic_t global_bh_count; | |
2065 | atomic_t global_bh_lock; | |
2066 | ||
2067 | -extern unsigned long *_get_SP(void); | |
2068 | - | |
2069 | static void show(char * str) | |
2070 | { | |
2071 | -#if 0 | |
2072 | int i; | |
2073 | unsigned long *stack; | |
2074 | -#endif | |
2075 | int cpu = smp_processor_id(); | |
2076 | ||
2077 | printk("\n%s, CPU %d:\n", str, cpu); | |
2078 | @@ -341,10 +332,6 @@ | |
2079 | atomic_read(&global_bh_count), | |
2080 | ppc_local_bh_count[0], | |
2081 | ppc_local_bh_count[1]); | |
2082 | -#if 1 | |
2083 | - printk(" CPU: %d last CPU: %d\n", current->processor,current->last_processor); | |
2084 | - print_backtrace (_get_SP()); | |
2085 | -#else | |
2086 | stack = (unsigned long *) &str; | |
2087 | for (i = 40; i ; i--) { | |
2088 | unsigned long x = *++stack; | |
2089 | @@ -352,7 +339,6 @@ | |
2090 | printk("<[%08lx]> ", x); | |
2091 | } | |
2092 | } | |
2093 | -#endif | |
2094 | } | |
2095 | ||
2096 | static inline void wait_on_bh(void) | |
2097 | diff -urN linux.orig/arch/ppc/kernel/local_irq.h linux/arch/ppc/kernel/local_irq.h | |
2098 | --- linux.orig/arch/ppc/kernel/local_irq.h Sun Mar 25 18:31:49 2001 | |
2099 | +++ linux/arch/ppc/kernel/local_irq.h Thu Jul 11 15:43:29 2002 | |
2100 | @@ -26,7 +26,6 @@ | |
2101 | struct irqdesc { | |
2102 | struct irqaction *action; | |
2103 | struct hw_interrupt_type *ctl; | |
2104 | - int level; | |
2105 | }; | |
2106 | ||
2107 | extern struct irqdesc irq_desc[NR_IRQS]; | |
2108 | diff -urN linux.orig/arch/ppc/kernel/mbx_pci.c linux/arch/ppc/kernel/mbx_pci.c | |
2109 | --- linux.orig/arch/ppc/kernel/mbx_pci.c Sun Mar 25 18:31:49 2001 | |
2110 | +++ linux/arch/ppc/kernel/mbx_pci.c Thu Jul 11 15:43:29 2002 | |
2111 | @@ -17,9 +17,7 @@ | |
2112 | ||
2113 | #include <asm/io.h> | |
2114 | #include <asm/mbx.h> | |
2115 | -#include <asm/machdep.h> | |
2116 | ||
2117 | -#include "pci.h" | |
2118 | ||
2119 | /* | |
2120 | * This blows......The MBX uses the Tundra QSpan PCI bridge. When | |
2121 | diff -urN linux.orig/arch/ppc/kernel/mbx_setup.c linux/arch/ppc/kernel/mbx_setup.c | |
2122 | --- linux.orig/arch/ppc/kernel/mbx_setup.c Sun Mar 25 18:31:49 2001 | |
2123 | +++ linux/arch/ppc/kernel/mbx_setup.c Thu Jul 11 15:43:29 2002 | |
2124 | @@ -31,7 +31,6 @@ | |
2125 | #include <linux/init.h> | |
2126 | #include <linux/blk.h> | |
2127 | #include <linux/ioport.h> | |
2128 | -#include <linux/delay.h> | |
2129 | ||
2130 | #include <asm/mmu.h> | |
2131 | #include <asm/processor.h> | |
2132 | @@ -41,25 +40,14 @@ | |
2133 | #include <asm/ide.h> | |
2134 | #include <asm/mbx.h> | |
2135 | #include <asm/machdep.h> | |
2136 | -#include <asm/keyboard.h> | |
2137 | -#include <asm/8xx_immap.h> | |
2138 | -#include <asm/time.h> | |
2139 | ||
2140 | +#include "time.h" | |
2141 | #include "local_irq.h" | |
2142 | ||
2143 | static int mbx_set_rtc_time(unsigned long time); | |
2144 | unsigned long mbx_get_rtc_time(void); | |
2145 | void mbx_calibrate_decr(void); | |
2146 | ||
2147 | -extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); | |
2148 | -extern int pckbd_getkeycode(unsigned int scancode); | |
2149 | -extern int pckbd_translate(unsigned char scancode, unsigned char *keycode, | |
2150 | - char raw_mode); | |
2151 | -extern char pckbd_unexpected_up(unsigned char keycode); | |
2152 | -extern void pckbd_leds(unsigned char leds); | |
2153 | -extern void pckbd_init_hw(void); | |
2154 | -extern unsigned char pckbd_sysrq_xlate[128]; | |
2155 | - | |
2156 | extern int mackbd_setkeycode(unsigned int scancode, unsigned int keycode); | |
2157 | extern int mackbd_getkeycode(unsigned int scancode); | |
2158 | extern int mackbd_translate(unsigned char scancode, unsigned char *keycode, | |
2159 | @@ -68,6 +56,8 @@ | |
2160 | extern void mackbd_leds(unsigned char leds); | |
2161 | extern void mackbd_init_hw(void); | |
2162 | ||
2163 | +extern unsigned long loops_per_jiffy; | |
2164 | + | |
2165 | unsigned long empty_zero_page[1024]; | |
2166 | ||
2167 | #ifdef CONFIG_BLK_DEV_RAM | |
2168 | @@ -463,7 +453,7 @@ | |
2169 | ppc_md.kbd_leds = pckbd_leds; | |
2170 | ppc_md.kbd_init_hw = pckbd_init_hw; | |
2171 | #ifdef CONFIG_MAGIC_SYSRQ | |
2172 | - ppc_md.sysrq_xlate = pckbd_sysrq_xlate; | |
2173 | + ppc_md.kbd_sysrq_xlate = pckbd_sysrq_xlate; | |
2174 | SYSRQ_KEY = 0x54; | |
2175 | #endif | |
2176 | ||
2177 | diff -urN linux.orig/arch/ppc/kernel/misc.S linux/arch/ppc/kernel/misc.S | |
2178 | --- linux.orig/arch/ppc/kernel/misc.S Sun Mar 25 18:37:30 2001 | |
2179 | +++ linux/arch/ppc/kernel/misc.S Thu Jul 11 15:43:29 2002 | |
2180 | @@ -125,33 +125,12 @@ | |
2181 | * Flush MMU TLB | |
2182 | */ | |
2183 | _GLOBAL(_tlbia) | |
2184 | -#if defined(CONFIG_SMP) | |
2185 | - mfmsr r10 | |
2186 | - sync | |
2187 | - rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */ | |
2188 | - mtmsr r0 | |
2189 | - SYNC | |
2190 | - lis r9,hash_table_lock@h | |
2191 | - ori r9,r9,hash_table_lock@l | |
2192 | - lwz r8,PROCESSOR(r2) | |
2193 | - oris r8,r8,10 | |
2194 | -10: lwarx r7,0,r9 | |
2195 | - cmpi 0,r7,0 | |
2196 | - bne- 10b | |
2197 | - stwcx. r8,0,r9 | |
2198 | - bne- 10b | |
2199 | - eieio | |
2200 | -#endif /* CONFIG_SMP */ | |
2201 | sync | |
2202 | tlbia | |
2203 | sync | |
2204 | #ifdef __SMP__ | |
2205 | tlbsync | |
2206 | sync | |
2207 | - li r0,0 | |
2208 | - stw r0,0(r9) /* clear hash_table_lock */ | |
2209 | - mtmsr r10 | |
2210 | - SYNC | |
2211 | #endif | |
2212 | blr | |
2213 | ||
2214 | @@ -159,32 +138,11 @@ | |
2215 | * Flush MMU TLB for a particular address | |
2216 | */ | |
2217 | _GLOBAL(_tlbie) | |
2218 | -#if defined(CONFIG_SMP) | |
2219 | - mfmsr r10 | |
2220 | - sync | |
2221 | - rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */ | |
2222 | - mtmsr r0 | |
2223 | - SYNC | |
2224 | - lis r9,hash_table_lock@h | |
2225 | - ori r9,r9,hash_table_lock@l | |
2226 | - lwz r8,PROCESSOR(r2) | |
2227 | - oris r8,r8,11 | |
2228 | -10: lwarx r7,0,r9 | |
2229 | - cmpi 0,r7,0 | |
2230 | - bne- 10b | |
2231 | - stwcx. r8,0,r9 | |
2232 | - bne- 10b | |
2233 | - eieio | |
2234 | -#endif /* CONFIG_SMP */ | |
2235 | tlbie r3 | |
2236 | sync | |
2237 | -#ifdef CONFIG_SMP | |
2238 | +#ifdef __SMP__ | |
2239 | tlbsync | |
2240 | sync | |
2241 | - li r0,0 | |
2242 | - stw r0,0(r9) /* clear hash_table_lock */ | |
2243 | - mtmsr r10 | |
2244 | - SYNC | |
2245 | #endif | |
2246 | blr | |
2247 | ||
2248 | @@ -317,8 +275,10 @@ | |
2249 | stwcx. r5,0,r3 /* Update with new value */ | |
2250 | bne- 10b /* Retry if "reservation" (i.e. lock) lost */ | |
2251 | SMP_MB | |
2252 | - cntlzw r3,r5 | |
2253 | - srwi r3,r3,5 | |
2254 | + cmpi 0,r5,0 /* Return 'true' IFF 0 */ | |
2255 | + li r3,1 | |
2256 | + beqlr | |
2257 | + li r3,0 | |
2258 | blr | |
2259 | _GLOBAL(atomic_clear_mask) | |
2260 | SMP_WMB /* wmb() */ | |
2261 | @@ -354,10 +314,8 @@ | |
2262 | * The *_ns versions don't do byte-swapping. | |
2263 | */ | |
2264 | _GLOBAL(_insb) | |
2265 | - cmpwi 0,r5,0 | |
2266 | mtctr r5 | |
2267 | subi r4,r4,1 | |
2268 | - blelr- | |
2269 | 00: lbz r5,0(r3) | |
2270 | eieio | |
2271 | stbu r5,1(r4) | |
2272 | @@ -365,10 +323,8 @@ | |
2273 | blr | |
2274 | ||
2275 | _GLOBAL(_outsb) | |
2276 | - cmpwi 0,r5,0 | |
2277 | mtctr r5 | |
2278 | subi r4,r4,1 | |
2279 | - blelr- | |
2280 | 00: lbzu r5,1(r4) | |
2281 | stb r5,0(r3) | |
2282 | eieio | |
2283 | @@ -376,10 +332,8 @@ | |
2284 | blr | |
2285 | ||
2286 | _GLOBAL(_insw) | |
2287 | - cmpwi 0,r5,0 | |
2288 | mtctr r5 | |
2289 | subi r4,r4,2 | |
2290 | - blelr- | |
2291 | 00: lhbrx r5,0,r3 | |
2292 | eieio | |
2293 | sthu r5,2(r4) | |
2294 | @@ -387,10 +341,8 @@ | |
2295 | blr | |
2296 | ||
2297 | _GLOBAL(_outsw) | |
2298 | - cmpwi 0,r5,0 | |
2299 | mtctr r5 | |
2300 | subi r4,r4,2 | |
2301 | - blelr- | |
2302 | 00: lhzu r5,2(r4) | |
2303 | eieio | |
2304 | sthbrx r5,0,r3 | |
2305 | @@ -398,10 +350,8 @@ | |
2306 | blr | |
2307 | ||
2308 | _GLOBAL(_insl) | |
2309 | - cmpwi 0,r5,0 | |
2310 | mtctr r5 | |
2311 | subi r4,r4,4 | |
2312 | - blelr- | |
2313 | 00: lwbrx r5,0,r3 | |
2314 | eieio | |
2315 | stwu r5,4(r4) | |
2316 | @@ -409,10 +359,8 @@ | |
2317 | blr | |
2318 | ||
2319 | _GLOBAL(_outsl) | |
2320 | - cmpwi 0,r5,0 | |
2321 | mtctr r5 | |
2322 | subi r4,r4,4 | |
2323 | - blelr- | |
2324 | 00: lwzu r5,4(r4) | |
2325 | stwbrx r5,0,r3 | |
2326 | eieio | |
2327 | @@ -421,10 +369,8 @@ | |
2328 | ||
2329 | _GLOBAL(ide_insw) | |
2330 | _GLOBAL(_insw_ns) | |
2331 | - cmpwi 0,r5,0 | |
2332 | mtctr r5 | |
2333 | subi r4,r4,2 | |
2334 | - blelr- | |
2335 | 00: lhz r5,0(r3) | |
2336 | eieio | |
2337 | sthu r5,2(r4) | |
2338 | @@ -433,10 +379,8 @@ | |
2339 | ||
2340 | _GLOBAL(ide_outsw) | |
2341 | _GLOBAL(_outsw_ns) | |
2342 | - cmpwi 0,r5,0 | |
2343 | mtctr r5 | |
2344 | subi r4,r4,2 | |
2345 | - blelr- | |
2346 | 00: lhzu r5,2(r4) | |
2347 | sth r5,0(r3) | |
2348 | eieio | |
2349 | @@ -444,10 +388,8 @@ | |
2350 | blr | |
2351 | ||
2352 | _GLOBAL(_insl_ns) | |
2353 | - cmpwi 0,r5,0 | |
2354 | mtctr r5 | |
2355 | subi r4,r4,4 | |
2356 | - blelr- | |
2357 | 00: lwz r5,0(r3) | |
2358 | eieio | |
2359 | stwu r5,4(r4) | |
2360 | @@ -455,10 +397,8 @@ | |
2361 | blr | |
2362 | ||
2363 | _GLOBAL(_outsl_ns) | |
2364 | - cmpwi 0,r5,0 | |
2365 | mtctr r5 | |
2366 | subi r4,r4,4 | |
2367 | - blelr- | |
2368 | 00: lwzu r5,4(r4) | |
2369 | stw r5,0(r3) | |
2370 | eieio | |
2371 | @@ -466,59 +406,48 @@ | |
2372 | blr | |
2373 | ||
2374 | /* | |
2375 | - * Extended precision shifts. | |
2376 | - * | |
2377 | - * Updated to be valid for shift counts from 0 to 63 inclusive. | |
2378 | - * -- Gabriel | |
2379 | + * Extended precision shifts | |
2380 | * | |
2381 | * R3/R4 has 64 bit value | |
2382 | * R5 has shift count | |
2383 | * result in R3/R4 | |
2384 | * | |
2385 | - * ashrdi3: arithmetic right shift (sign propagation) | |
2386 | - * lshrdi3: logical right shift | |
2387 | - * ashldi3: left shift | |
2388 | + * ashrdi3: XXXYYY/ZZZAAA -> SSSXXX/YYYZZZ | |
2389 | + * ashldi3: XXXYYY/ZZZAAA -> YYYZZZ/AAA000 | |
2390 | + * lshrdi3: XXXYYY/ZZZAAA -> 000XXX/YYYZZZ | |
2391 | */ | |
2392 | _GLOBAL(__ashrdi3) | |
2393 | - subfic r6,r5,32 | |
2394 | - srw r4,r4,r5 # LSW = count > 31 ? 0 : LSW >> count | |
2395 | - addi r7,r5,32 # could be xori, or addi with -32 | |
2396 | - slw r6,r3,r6 # t1 = count > 31 ? 0 : MSW << (32-count) | |
2397 | - rlwinm r8,r7,0,32 # t3 = (count < 32) ? 32 : 0 | |
2398 | - sraw r7,r3,r7 # t2 = MSW >> (count-32) | |
2399 | - or r4,r4,r6 # LSW |= t1 | |
2400 | - slw r7,r7,r8 # t2 = (count < 32) ? 0 : t2 | |
2401 | - sraw r3,r3,r5 # MSW = MSW >> count | |
2402 | - or r4,r4,r7 # LSW |= t2 | |
2403 | + li r6,32 | |
2404 | + sub r6,r6,r5 | |
2405 | + slw r7,r3,r6 /* isolate YYY */ | |
2406 | + srw r4,r4,r5 /* isolate ZZZ */ | |
2407 | + or r4,r4,r7 /* YYYZZZ */ | |
2408 | + sraw r3,r3,r5 /* SSSXXX */ | |
2409 | blr | |
2410 | ||
2411 | _GLOBAL(__ashldi3) | |
2412 | - subfic r6,r5,32 | |
2413 | - slw r3,r3,r5 # MSW = count > 31 ? 0 : MSW << count | |
2414 | - addi r7,r5,32 # could be xori, or addi with -32 | |
2415 | - srw r6,r4,r6 # t1 = count > 31 ? 0 : LSW >> (32-count) | |
2416 | - slw r7,r4,r7 # t2 = count < 32 ? 0 : LSW << (count-32) | |
2417 | - or r3,r3,r6 # MSW |= t1 | |
2418 | - slw r4,r4,r5 # LSW = LSW << count | |
2419 | - or r3,r3,r7 # MSW |= t2 | |
2420 | + li r6,32 | |
2421 | + sub r6,r6,r5 | |
2422 | + srw r7,r4,r6 /* isolate ZZZ */ | |
2423 | + slw r4,r4,r5 /* AAA000 */ | |
2424 | + slw r3,r3,r5 /* YYY--- */ | |
2425 | + or r3,r3,r7 /* YYYZZZ */ | |
2426 | blr | |
2427 | ||
2428 | _GLOBAL(__lshrdi3) | |
2429 | - subfic r6,r5,32 | |
2430 | - srw r4,r4,r5 # LSW = count > 31 ? 0 : LSW >> count | |
2431 | - addi r7,r5,32 # could be xori, or addi with -32 | |
2432 | - slw r6,r3,r6 # t1 = count > 31 ? 0 : MSW << (32-count) | |
2433 | - srw r7,r3,r7 # t2 = count < 32 ? 0 : MSW >> (count-32) | |
2434 | - or r4,r4,r6 # LSW |= t1 | |
2435 | - srw r3,r3,r5 # MSW = MSW >> count | |
2436 | - or r4,r4,r7 # LSW |= t2 | |
2437 | + li r6,32 | |
2438 | + sub r6,r6,r5 | |
2439 | + slw r7,r3,r6 /* isolate YYY */ | |
2440 | + srw r4,r4,r5 /* isolate ZZZ */ | |
2441 | + or r4,r4,r7 /* YYYZZZ */ | |
2442 | + srw r3,r3,r5 /* 000XXX */ | |
2443 | blr | |
2444 | ||
2445 | _GLOBAL(abs) | |
2446 | - srawi r4,r3,31 | |
2447 | - xor r3,r3,r4 | |
2448 | - sub r3,r3,r4 | |
2449 | - blr | |
2450 | + cmpi 0,r3,0 | |
2451 | + bge 10f | |
2452 | + neg r3,r3 | |
2453 | +10: blr | |
2454 | ||
2455 | _GLOBAL(_get_SP) | |
2456 | mr r3,r1 /* Close enough */ | |
2457 | @@ -563,14 +492,6 @@ | |
2458 | isync /* Handle erratas in some cases */ | |
2459 | blr | |
2460 | ||
2461 | -_GLOBAL(_get_ICTC) | |
2462 | - mfspr r3,ICTC | |
2463 | - blr | |
2464 | - | |
2465 | -_GLOBAL(_set_ICTC) | |
2466 | - mtspr ICTC,r3 | |
2467 | - blr | |
2468 | - | |
2469 | /* | |
2470 | L2CR functions | |
2471 |