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 Thu Jul 11 15:43:29 2002
5 # Adapted for PowerPC by Gary Thomas
6 # modified by Cort (cort@cs.nmt.edu)
10 $(CC) $(CFLAGS) -I$(HPATH) -S -o $*.s $<
13 zvmlinux.initrd: zvmlinux
14 $(LD) $(ZLINKFLAGS) -o zvmlinux.initrd.tmp $(OBJECTS)
15 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
16 - --add-section=initrd=../coffboot/ramdisk.image.gz \
17 + --add-section=initrd=ramdisk.image.gz \
18 --add-section=image=../coffboot/vmlinux.gz \
19 zvmlinux.initrd.tmp zvmlinux.initrd
20 $(CC) $(CFLAGS) -DINITRD_OFFSET=`sh offset $(OBJDUMP) zvmlinux.initrd initrd` \
23 $(LD) $(ZLINKFLAGS) -o zvmlinux.initrd.tmp $(OBJECTS)
24 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
25 - --add-section=initrd=../coffboot/ramdisk.image.gz \
26 + --add-section=initrd=ramdisk.image.gz \
27 --add-section=image=../coffboot/vmlinux.gz \
28 zvmlinux.initrd.tmp $@
29 rm zvmlinux.initrd.tmp
30 diff -urN linux.orig/arch/ppc/boot/vreset.c linux/arch/ppc/boot/vreset.c
31 --- linux.orig/arch/ppc/boot/vreset.c Sun Mar 25 18:31:49 2001
32 +++ linux/arch/ppc/boot/vreset.c Thu Jul 11 15:43:29 2002
34 * Adapted for IBM portables by:
36 * Multi-console support:
37 - * Terje Malmedal <terje.malmedal@usit.uio.no>
42 diff -urN linux.orig/arch/ppc/chrpboot/main.c linux/arch/ppc/chrpboot/main.c
43 --- linux.orig/arch/ppc/chrpboot/main.c Sun Mar 25 18:31:50 2001
44 +++ linux/arch/ppc/chrpboot/main.c Thu Jul 11 15:43:29 2002
46 #define get_32be(x) (*(unsigned *)(x))
48 #define RAM_START 0x00000000
49 -#define RAM_END (64<<20)
50 +#define RAM_END (8<<20)
52 -#define BOOT_START ((unsigned long)_start)
53 -#define BOOT_END ((unsigned long)(_end + 0xFFF) & ~0xFFF)
54 +#define RAM_FREE ((unsigned long)(_end+0x1000)&~0xFFF)
55 #define PROG_START 0x00010000
60 -extern char _start[], _end[];
62 extern char image_data[];
64 extern char initrd_data[];
68 unsigned initrd_start, initrd_size;
70 - printf("chrpboot starting: loaded at 0x%x\n\r", _start);
73 + printf("chrpboot starting: loaded at 0x%x\n\r", &_start);
76 initrd_size = initrd_len;
77 initrd_start = (RAM_END - initrd_size) & ~0xFFF;
80 - claim(initrd_start, RAM_END - initrd_start, 0);
81 - printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n",
82 - initrd_start, initrd_data, initrd_size);
83 + printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n\r", initrd_start,
84 + initrd_data,initrd_size);
85 memcpy((char *)initrd_start, initrd_data, initrd_size);
87 + end_avail = (char *)initrd_start;
89 + end_avail = (char *) RAM_END;
92 - /* try and claim our text/data in case of OF bugs */
93 - claim(BOOT_START, BOOT_END - BOOT_START, 0);
94 - /* claim 4MB starting at PROG_START */
95 - claim(PROG_START, (4<<20) - PROG_START, 0);
96 dst = (void *) PROG_START;
97 if (im[0] == 0x1f && im[1] == 0x8b) {
98 - /* claim 512kB for scratch space */
99 - avail_ram = (char *) claim(0, 512 << 10, 0x10);
100 - end_avail = avail_ram + (512 << 10);
101 - printf("avail_ram = %x\n", avail_ram);
102 + avail_ram = (char *)RAM_FREE;
103 printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len);
104 gunzip(dst, 0x400000, im, &len);
105 printf("done %u bytes\n\r", len);
106 diff -urN linux.orig/arch/ppc/chrpboot/misc.S linux/arch/ppc/chrpboot/misc.S
107 --- linux.orig/arch/ppc/chrpboot/misc.S Sun Mar 25 18:31:50 2001
108 +++ linux/arch/ppc/chrpboot/misc.S Thu Jul 11 15:43:29 2002
113 - * Use the BAT0 registers to map the 1st 8 or 64MB of RAM to 0x90000000.
114 + * Use the BAT0 registers to map the 1st 8MB of RAM to 0x90000000.
119 ori 4,4,4 /* set up BAT registers for 601 */
122 -4: ori 4,4,0x7ff /* set up BAT registers for 604 */
123 +4: ori 4,4,0xff /* set up BAT registers for 604 */
127 diff -urN linux.orig/arch/ppc/chrpboot/start.c linux/arch/ppc/chrpboot/start.c
128 --- linux.orig/arch/ppc/chrpboot/start.c Sun Mar 25 18:31:50 2001
129 +++ linux/arch/ppc/chrpboot/start.c Thu Jul 11 15:43:29 2002
135 -claim(unsigned int virt, unsigned int size, unsigned int align)
143 - unsigned int align;
147 - args.service = "claim";
152 - args.align = align;
158 getprop(void *phandle, const char *name, void *buf, int buflen)
160 diff -urN linux.orig/arch/ppc/coffboot/Makefile linux/arch/ppc/coffboot/Makefile
161 --- linux.orig/arch/ppc/coffboot/Makefile Sun Mar 25 18:31:49 2001
162 +++ linux/arch/ppc/coffboot/Makefile Thu Jul 11 15:43:29 2002
164 LD = $(CROSS_COMPILE)ld
165 CFLAGS = $(CPPFLAGS) -O -fno-builtin -I$(HPATH)
166 OBJCOPY = $(CROSS_COMPILE)objcopy
167 -OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
168 -COFF_LD_ARGS = -e _start -T ld.script -Ttext 500000 -Tdata 510000 -Bstatic
169 -CHRP_LD_ARGS = -Ttext 0x01000000
170 +OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment \
171 + --add-section=image=vmlinux.gz
172 +LD_ARGS = -e _start -T ld.script -Ttext 500000 -Tdata 510000 -Bstatic
175 -COFFOBJS = coffcrt0.o start.o coffmain.o misc.o string.o zlib.o image.o
176 -CHRPOBJS = crt0.o start.o chrpmain.o misc.o string.o zlib.o image.o
177 +OBJS = crt0.o start.o main.o misc.o string.o zlib.o
178 LIBS = $(TOPDIR)/lib/lib.a
180 ifeq ($(CONFIG_PPC64),y)
182 hack-coff: hack-coff.c
183 $(HOSTCC) $(HOSTCFLAGS) -o hack-coff hack-coff.c
185 -znetboot: vmlinux.coff zImage vmlinux.elf
186 - cp vmlinux.coff $(TFTPIMAGE)
187 - cp vmlinux.elf $(TFTPIMAGE).elf
189 -znetboot.initrd: vmlinux.coff.initrd vmlinux.elf.initrd
190 - cp vmlinux.coff.initrd $(TFTPIMAGE)
191 - cp vmlinux.elf.initrd $(TFTPIMAGE).elf
194 # mount -t hfs /dev/fd0 /mnt
195 # cp vmlinux.coff /mnt
198 -coffboot: $(COFFOBJS) no_initrd.o ld.script
199 - $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) no_initrd.o $(LIBS)
201 -coffboot.initrd: $(COFFOBJS) initrd.o ld.script
202 - $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) initrd.o $(LIBS)
203 +znetboot: vmlinux.coff
204 + cp vmlinux.coff $(TFTPIMAGE)
206 -piggyback: piggyback.c
207 - $(HOSTCC) $(HOSTCFLAGS) -DKERNELBASE=$(KERNELBASE) -o piggyback piggyback.c
208 +znetboot.initrd: vmlinux.coff.initrd
209 + cp vmlinux.coff.initrd $(TFTPIMAGE)
212 - $(HOSTCC) $(HOSTCFLAGS) -o mknote mknote.c
213 +coffboot: $(OBJS) ld.script
214 + $(LD) -o coffboot $(LD_ARGS) $(OBJS) $(LIBS)
216 -image.o: piggyback vmlinux.gz
217 - ./piggyback image < vmlinux.gz | $(AS) -o image.o
218 +zImage: vmlinux.coff
220 -initrd.o: ramdisk.image.gz piggyback
221 - ./piggyback initrd < ramdisk.image.gz | $(AS) -o initrd.o
222 +zImage.initrd: vmlinux.coff.initrd
224 -vmlinux.coff: coffboot hack-coff
225 +vmlinux.coff: coffboot hack-coff vmlinux.gz
226 $(OBJCOPY) $(OBJCOPY_ARGS) coffboot $@
228 ln -sf vmlinux.coff zImage
230 -vmlinux.coff.initrd: coffboot.initrd hack-coff
231 - $(OBJCOPY) $(OBJCOPY_ARGS) coffboot.initrd $@
232 +vmlinux.coff.initrd: coffboot hack-coff vmlinux.gz ramdisk.image.gz
233 + $(OBJCOPY) $(OBJCOPY_ARGS) --add-section=initrd=ramdisk.image.gz \
237 -vmlinux.elf: $(CHRPOBJS) no_initrd.o mknote
238 - $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) no_initrd.o $(LIBS)
240 - $(OBJCOPY) $@ $@ --add-section=.note=note -R .comment
242 -vmlinux.elf.initrd: $(CHRPOBJS) initrd.o mknote
243 - $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) initrd.o $(LIBS)
245 - $(OBJCOPY) $@ $@ --add-section=.note=note -R .comment
248 - $(LD) -o $@ $(COFF_LD_ARGS) dummy.o $(LIBS)
250 -miboot.image: micoffboot hack-coff vmlinux.gz
251 - $(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=vmlinux.gz micoffboot $@
254 -miboot.image.initrd: micoffboot hack-coff vmlinux.gz ramdisk.image.gz
255 - $(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=vmlinux.gz \
256 - --add-section=initrd=ramdisk.image.gz micoffboot $@
259 -zImage: vmlinux.coff vmlinux.elf miboot.image
261 -zImage.initrd: vmlinux.coff.initrd vmlinux.elf.initrd miboot.image.initrd
266 znetboot.initrd: vmlinux.gz
268 -miboot.image: vmlinux.gz
270 -miboot.image.initrd: vmlinux.gz
278 rm -f hack-coff coffboot zImage vmlinux.coff vmlinux.gz
279 - rm -f mknote piggyback vmlinux.elf note
280 - rm -f micoffboot miboot.image
283 diff -urN linux.orig/arch/ppc/coffboot/chrpmain.c linux/arch/ppc/coffboot/chrpmain.c
284 --- linux.orig/arch/ppc/coffboot/chrpmain.c Sun Mar 25 18:31:49 2001
285 +++ linux/arch/ppc/coffboot/chrpmain.c Thu Jan 1 01:00:00 1970
288 - * Copyright (C) Paul Mackerras 1997.
290 - * This program is free software; you can redistribute it and/or
291 - * modify it under the terms of the GNU General Public License
292 - * as published by the Free Software Foundation; either version
293 - * 2 of the License, or (at your option) any later version.
295 -#include "nonstdio.h"
298 -extern void *finddevice(const char *);
299 -extern int getprop(void *, const char *, void *, int);
300 -void gunzip(void *, int, unsigned char *, int *);
301 -void stop_imac_ethernet(void);
302 -void stop_imac_usb(void);
304 -#define get_16be(x) (*(unsigned short *)(x))
305 -#define get_32be(x) (*(unsigned *)(x))
307 -#define RAM_END (16 << 20)
309 -#define PROG_START 0x00010000
310 -#define PROG_SIZE 0x003f0000
312 -#define SCRATCH_SIZE (128 << 10)
315 -char *begin_avail, *end_avail;
317 -unsigned int heap_use;
318 -unsigned int heap_max;
321 -extern char image_data[];
322 -extern int image_len;
323 -extern char initrd_data[];
324 -extern int initrd_len;
327 -boot(int a1, int a2, void *prom)
333 - unsigned initrd_start, initrd_size;
334 - extern char _start;
336 - printf("chrpboot starting: loaded at 0x%x\n", &_start);
338 - initrd_size = initrd_len;
339 - initrd_start = (RAM_END - initrd_size) & ~0xFFF;
342 - claim(initrd_start, RAM_END - initrd_start, 0);
343 - printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n",
344 - initrd_start, initrd_data, initrd_size);
345 - memcpy((char *)initrd_start, initrd_data, initrd_size);
349 - /* claim 3MB starting at PROG_START */
350 - claim(PROG_START, PROG_SIZE, 0);
351 - dst = (void *) PROG_START;
352 - if (im[0] == 0x1f && im[1] == 0x8b) {
353 - /* claim some memory for scratch space */
354 - avail_ram = (char *) claim(0, SCRATCH_SIZE, 0x10);
355 - begin_avail = avail_high = avail_ram;
356 - end_avail = avail_ram + SCRATCH_SIZE;
357 - printf("heap at 0x%x\n", avail_ram);
358 - printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len);
359 - gunzip(dst, PROG_SIZE, im, &len);
360 - printf("done %u bytes\n", len);
361 - printf("%u bytes of heap consumed, max in use %u\n",
362 - avail_high - begin_avail, heap_max);
364 - memmove(dst, im, len);
367 - flush_cache(dst, len);
369 - stop_imac_ethernet();
373 - sa = (unsigned long)PROG_START;
374 - printf("start address = 0x%x\n", sa);
376 - (*(void (*)())sa)(a1, a2, prom);
378 - printf("returned?\n");
384 -#define eieio() asm volatile("eieio");
386 -void stop_imac_ethernet(void)
388 - void *macio, *enet;
389 - unsigned int macio_addr[5], enet_reg[6];
391 - volatile unsigned int *dbdma;
393 - macio = finddevice("/pci/mac-io");
394 - enet = finddevice("/pci/mac-io/ethernet");
395 - if (macio == NULL || enet == NULL)
397 - len = getprop(macio, "assigned-addresses", macio_addr, sizeof(macio_addr));
398 - if (len != sizeof(macio_addr))
400 - len = getprop(enet, "reg", enet_reg, sizeof(enet_reg));
401 - if (len != sizeof(enet_reg))
403 - printf("macio base %x, dma at %x & %x\n",
404 - macio_addr[2], enet_reg[2], enet_reg[4]);
406 - /* hope this is mapped... */
407 - dbdma = (volatile unsigned int *) (macio_addr[2] + enet_reg[2]);
408 - *dbdma = 0x80; /* clear the RUN bit */
410 - dbdma = (volatile unsigned int *) (macio_addr[2] + enet_reg[4]);
411 - *dbdma = 0x80; /* clear the RUN bit */
415 -void stop_imac_usb(void)
418 - unsigned int usb_addr[5];
420 - volatile unsigned int *usb_ctrl;
422 - usb = finddevice("/pci/usb");
425 - len = getprop(usb, "assigned-addresses", usb_addr, sizeof(usb_addr));
426 - if (len != sizeof(usb_addr))
428 - printf("usb base %x\n", usb_addr[2]);
430 - usb_ctrl = (volatile unsigned int *) (usb_addr[2] + 8);
431 - *usb_ctrl = 0x01000000; /* cpu_to_le32(1) */
438 - struct memchunk *next;
441 -static struct memchunk *freechunks;
443 -void *zalloc(void *x, unsigned items, unsigned size)
446 - struct memchunk **mpp, *mp;
449 - size = (size + 7) & -8;
451 - if (heap_use > heap_max)
452 - heap_max = heap_use;
453 - for (mpp = &freechunks; (mp = *mpp) != 0; mpp = &mp->next) {
454 - if (mp->size == size) {
461 - if (avail_ram > avail_high)
462 - avail_high = avail_ram;
463 - if (avail_ram > end_avail) {
464 - printf("oops... out of memory\n");
470 -void zfree(void *x, void *addr, unsigned nb)
472 - struct memchunk *mp = addr;
474 - nb = (nb + 7) & -8;
476 - if (avail_ram == addr + nb) {
481 - mp->next = freechunks;
486 -#define EXTRA_FIELD 4
488 -#define COMMENT 0x10
489 -#define RESERVED 0xe0
493 -void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
501 - if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
502 - printf("bad gzipped data\n");
505 - if ((flags & EXTRA_FIELD) != 0)
506 - i = 12 + src[10] + (src[11] << 8);
507 - if ((flags & ORIG_NAME) != 0)
508 - while (src[i++] != 0)
510 - if ((flags & COMMENT) != 0)
511 - while (src[i++] != 0)
513 - if ((flags & HEAD_CRC) != 0)
516 - printf("gunzip: ran out of data in header\n");
522 - r = inflateInit2(&s, -MAX_WBITS);
524 - printf("inflateInit2 returned %d\n", r);
527 - s.next_in = src + i;
528 - s.avail_in = *lenp - i;
530 - s.avail_out = dstlen;
531 - r = inflate(&s, Z_FINISH);
532 - if (r != Z_OK && r != Z_STREAM_END) {
533 - printf("inflate returned %d msg: %s\n", r, s.msg);
536 - *lenp = s.next_out - (unsigned char *) dst;
539 diff -urN linux.orig/arch/ppc/coffboot/coffcrt0.S linux/arch/ppc/coffboot/coffcrt0.S
540 --- linux.orig/arch/ppc/coffboot/coffcrt0.S Sun Mar 25 18:31:49 2001
541 +++ linux/arch/ppc/coffboot/coffcrt0.S Thu Jan 1 01:00:00 1970
544 - * Copyright (C) Paul Mackerras 1997.
546 - * This program is free software; you can redistribute it and/or
547 - * modify it under the terms of the GNU General Public License
548 - * as published by the Free Software Foundation; either version
549 - * 2 of the License, or (at your option) any later version.
567 diff -urN linux.orig/arch/ppc/coffboot/coffmain.c linux/arch/ppc/coffboot/coffmain.c
568 --- linux.orig/arch/ppc/coffboot/coffmain.c Sun Mar 25 18:31:49 2001
569 +++ linux/arch/ppc/coffboot/coffmain.c Thu Jan 1 01:00:00 1970
572 - * Copyright (C) Paul Mackerras 1997.
574 - * This program is free software; you can redistribute it and/or
575 - * modify it under the terms of the GNU General Public License
576 - * as published by the Free Software Foundation; either version
577 - * 2 of the License, or (at your option) any later version.
579 -#include "nonstdio.h"
582 -extern void *finddevice(const char *);
583 -extern int getprop(void *, const char *, void *, int);
584 -extern char *claim(unsigned, unsigned, unsigned);
585 -void gunzip(void *, int, unsigned char *, int *);
587 -#define get_16be(x) (*(unsigned short *)(x))
588 -#define get_32be(x) (*(unsigned *)(x))
590 -#define RAM_START 0xc0000000
591 -#define PROG_START RAM_START
592 -#define RAM_END (RAM_START + 0x800000) /* only 8M mapped with BATs */
597 -extern char _start[], _end[];
598 -extern char image_data[];
599 -extern int image_len;
600 -extern char initrd_data[];
601 -extern int initrd_len;
604 -boot(int a1, int a2, void *prom)
610 - unsigned initrd_start, initrd_size;
612 - printf("coffboot starting: loaded at 0x%x\n", _start);
613 - setup_bats(RAM_START);
615 - initrd_size = initrd_len;
616 - initrd_start = (RAM_END - initrd_size) & ~0xFFF;
619 - claim(initrd_start - RAM_START, RAM_END - initrd_start, 0);
620 - printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n",
621 - initrd_start, initrd_data, initrd_size);
622 - memcpy((char *)initrd_start, initrd_data, initrd_size);
626 - /* claim 3MB starting at 0 */
627 - claim(0, 3 << 20, 0);
628 - dst = (void *) RAM_START;
629 - if (im[0] == 0x1f && im[1] == 0x8b) {
630 - /* claim 512kB for scratch space */
631 - avail_ram = claim(0, 512 << 10, 0x10) + RAM_START;
632 - end_avail = avail_ram + (512 << 10);
633 - printf("avail_ram = %x\n", avail_ram);
634 - printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len);
635 - gunzip(dst, 3 << 20, im, &len);
636 - printf("done %u bytes\n", len);
638 - memmove(dst, im, len);
641 - flush_cache(dst, len);
643 - sa = (unsigned long)PROG_START;
644 - printf("start address = 0x%x\n", sa);
649 - (*(void (*)())sa)(a1, a2, prom);
651 - printf("returned?\n");
656 -void *zalloc(void *x, unsigned items, unsigned size)
658 - void *p = avail_ram;
661 - size = (size + 7) & -8;
663 - if (avail_ram > end_avail) {
664 - printf("oops... out of memory\n");
670 -void zfree(void *x, void *addr, unsigned nb)
675 -#define EXTRA_FIELD 4
677 -#define COMMENT 0x10
678 -#define RESERVED 0xe0
682 -void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
690 - if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
691 - printf("bad gzipped data\n");
694 - if ((flags & EXTRA_FIELD) != 0)
695 - i = 12 + src[10] + (src[11] << 8);
696 - if ((flags & ORIG_NAME) != 0)
697 - while (src[i++] != 0)
699 - if ((flags & COMMENT) != 0)
700 - while (src[i++] != 0)
702 - if ((flags & HEAD_CRC) != 0)
705 - printf("gunzip: ran out of data in header\n");
711 - r = inflateInit2(&s, -MAX_WBITS);
713 - printf("inflateInit2 returned %d\n", r);
716 - s.next_in = src + i;
717 - s.avail_in = *lenp - i;
719 - s.avail_out = dstlen;
720 - r = inflate(&s, Z_FINISH);
721 - if (r != Z_OK && r != Z_STREAM_END) {
722 - printf("inflate returned %d msg: %s\n", r, s.msg);
725 - *lenp = s.next_out - (unsigned char *) dst;
728 diff -urN linux.orig/arch/ppc/coffboot/crt0.S linux/arch/ppc/coffboot/crt0.S
729 --- linux.orig/arch/ppc/coffboot/crt0.S Sun Mar 25 18:31:49 2001
730 +++ linux/arch/ppc/coffboot/crt0.S Thu Jul 11 15:43:29 2002
742 diff -urN linux.orig/arch/ppc/coffboot/dummy.c linux/arch/ppc/coffboot/dummy.c
743 --- linux.orig/arch/ppc/coffboot/dummy.c Sun Mar 25 18:31:49 2001
744 +++ linux/arch/ppc/coffboot/dummy.c Thu Jan 1 01:00:00 1970
750 diff -urN linux.orig/arch/ppc/coffboot/misc.S linux/arch/ppc/coffboot/misc.S
751 --- linux.orig/arch/ppc/coffboot/misc.S Sun Mar 25 18:31:49 2001
752 +++ linux/arch/ppc/coffboot/misc.S Thu Jul 11 15:43:29 2002
758 - rlwinm 5,5,16,16,31 /* r3 = 1 for 601, 4 for 604 */
763 + rlwinm 3,3,16,16,31 /* r3 = 1 for 601, 4 for 604 */
766 - mtibatl 3,0 /* invalidate BAT first */
767 - ori 3,3,4 /* set up BAT registers for 601 */
772 -4: mtdbatu 3,0 /* invalidate BATs first */
774 - ori 3,3,0xff /* set up BAT registers for 604 */
781 + ori 4,4,4 /* set up BAT registers for 601 */
787 +4: ori 4,4,0xfe /* set up BAT registers for 604 */
796 diff -urN linux.orig/arch/ppc/coffboot/mknote.c linux/arch/ppc/coffboot/mknote.c
797 --- linux.orig/arch/ppc/coffboot/mknote.c Sun Mar 25 18:31:49 2001
798 +++ linux/arch/ppc/coffboot/mknote.c Thu Jan 1 01:00:00 1970
801 - * Copyright (C) Cort Dougan 1999.
803 - * This program is free software; you can redistribute it and/or
804 - * modify it under the terms of the GNU General Public License
805 - * as published by the Free Software Foundation; either version
806 - * 2 of the License, or (at your option) any later version.
808 - * Generate a note section as per the CHRP specification.
814 -#define PL(x) printf("%c%c%c%c", ((x)>>24)&0xff, ((x)>>16)&0xff, ((x)>>8)&0xff, (x)&0xff );
820 - PL(strlen("PowerPC")+1);
826 - printf("PowerPC"); printf("%c", 0);
843 diff -urN linux.orig/arch/ppc/coffboot/no_initrd.c linux/arch/ppc/coffboot/no_initrd.c
844 --- linux.orig/arch/ppc/coffboot/no_initrd.c Sun Mar 25 18:31:49 2001
845 +++ linux/arch/ppc/coffboot/no_initrd.c Thu Jan 1 01:00:00 1970
847 -char initrd_data[1];
849 diff -urN linux.orig/arch/ppc/coffboot/piggyback.c linux/arch/ppc/coffboot/piggyback.c
850 --- linux.orig/arch/ppc/coffboot/piggyback.c Sun Mar 25 18:31:49 2001
851 +++ linux/arch/ppc/coffboot/piggyback.c Thu Jan 1 01:00:00 1970
855 -extern long ce_exec_config[];
857 -main(int argc, char *argv[])
859 - int i, cnt, pos, len;
860 - unsigned int cksum, val;
862 - unsigned char buf[8192];
865 - fprintf(stderr, "usage: %s name <in-file >out-file\n",
869 - fprintf(stdout, "#\n");
870 - fprintf(stdout, "# Miscellaneous data structures:\n");
871 - fprintf(stdout, "# WARNING - this file is automatically generated!\n");
872 - fprintf(stdout, "#\n");
873 - fprintf(stdout, "\n");
874 - fprintf(stdout, "\t.data\n");
875 - fprintf(stdout, "\t.globl %s_data\n", argv[1]);
876 - fprintf(stdout, "%s_data:\n", argv[1]);
879 - while ((len = read(0, buf, sizeof(buf))) > 0)
882 - lp = (unsigned char *)buf;
883 - len = (len + 3) & ~3; /* Round up to longwords */
884 - for (i = 0; i < len; i += 4)
888 - fprintf(stdout, "\t.long\t");
890 - fprintf(stdout, "0x%02X%02X%02X%02X", lp[0], lp[1], lp[2], lp[3]);
891 - val = *(unsigned long *)lp;
897 - fprintf(stdout, " # %x \n", pos+i-12);
901 - fprintf(stdout, ",");
906 - fprintf(stdout, "0\n");
910 - fprintf(stdout, "\t.globl %s_len\n", argv[1]);
911 - fprintf(stdout, "%s_len:\t.long\t0x%x\n", argv[1], pos);
914 - fprintf(stderr, "cksum = %x\n", cksum);
918 diff -urN linux.orig/arch/ppc/coffboot/start.c linux/arch/ppc/coffboot/start.c
919 --- linux.orig/arch/ppc/coffboot/start.c Sun Mar 25 18:31:49 2001
920 +++ linux/arch/ppc/coffboot/start.c Thu Jul 11 15:43:29 2002
922 if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
925 - boot(a1, a2, promptr);
926 + coffboot(a1, a2, promptr);
934 -int writestring(void *f, char *ptr, int nb)
939 - for (i = 0; i < nb; ++i) {
940 - if (ptr[i] == '\n') {
942 - write(f, ptr + w, i - w);
949 - write(f, ptr + w, nb - w);
954 read(void *handle, void *ptr, int nb)
961 -claim(unsigned int virt, unsigned int size, unsigned int align)
969 - unsigned int align;
973 - args.service = "claim";
978 - args.align = align;
984 getprop(void *phandle, const char *name, void *buf, int buflen)
990 - return writestring(f, &ch, 1) == 1? c: -1;
993 + return write(f, &ch, 1) == 1? c: -1;
1001 - return writestring(f, str, n) == n? 0: -1;
1002 + return write(f, str, n) == n? 0: -1;
1010 - printk("read(stdin) returned -1\n");
1011 + printk("read(stdin) returned -1\r\n");
1016 va_start(args, fmt);
1017 n = vsprintf(sprint_buf, fmt, args);
1019 - writestring(stdout, sprint_buf, n);
1020 + write(stdout, sprint_buf, n);
1025 va_start(args, fmt);
1026 n = vsprintf(sprint_buf, fmt, args);
1028 - writestring(stdout, sprint_buf, n);
1029 + write(stdout, sprint_buf, n);
1032 diff -urN linux.orig/arch/ppc/common_defconfig linux/arch/ppc/common_defconfig
1033 --- linux.orig/arch/ppc/common_defconfig Sun Mar 25 18:31:50 2001
1034 +++ linux/arch/ppc/common_defconfig Thu Jul 11 15:43:29 2002
1037 -# Automatically generated make config: don't edit
1038 +# Automatically generated by make menuconfig: don't edit
1043 # CONFIG_GEMINI is not set
1044 # CONFIG_MBX is not set
1045 # CONFIG_SMP is not set
1052 CONFIG_EXPERIMENTAL=y
1054 -# CONFIG_MODVERSIONS is not set
1055 +CONFIG_MODVERSIONS=y
1058 # CONFIG_PCI_QUIRKS is not set
1060 # CONFIG_BSD_PROCESS_ACCT is not set
1063 -CONFIG_BINFMT_MISC=y
1064 +# CONFIG_BINFMT_MISC is not set
1065 # CONFIG_BINFMT_JAVA is not set
1067 -# CONFIG_PARPORT_PC is not set
1068 +# CONFIG_PARPORT is not set
1069 CONFIG_VGA_CONSOLE=y
1071 +CONFIG_FB_COMPAT_XPMAC=y
1073 CONFIG_MAC_KEYBOARD=y
1076 -# CONFIG_PPC_RTC is not set
1077 +# CONFIG_SERIAL_CONSOLE is not set
1079 CONFIG_PROC_DEVICETREE=y
1080 # CONFIG_TOTALMP is not set
1084 CONFIG_BLK_DEV_IDE=y
1087 -# Please see Documentation/ide.txt for help/info on IDE drives
1089 # CONFIG_BLK_DEV_HD_IDE is not set
1090 CONFIG_BLK_DEV_IDEDISK=y
1091 CONFIG_BLK_DEV_IDECD=y
1093 # CONFIG_BLK_DEV_IDESCSI is not set
1094 # CONFIG_BLK_DEV_CMD640 is not set
1095 # CONFIG_BLK_DEV_RZ1000 is not set
1096 -CONFIG_BLK_DEV_IDEPCI=y
1097 -CONFIG_BLK_DEV_IDEDMA=y
1098 -# CONFIG_BLK_DEV_OFFBOARD is not set
1099 -CONFIG_IDEDMA_AUTO=y
1100 -# CONFIG_BLK_DEV_OPTI621 is not set
1101 -# CONFIG_BLK_DEV_TRM290 is not set
1102 -# CONFIG_BLK_DEV_NS87415 is not set
1103 -# CONFIG_BLK_DEV_VIA82C586 is not set
1104 -CONFIG_BLK_DEV_CMD646=y
1105 -# CONFIG_BLK_DEV_CS5530 is not set
1106 -# CONFIG_BLK_DEV_SL82C105 is not set
1107 +# CONFIG_BLK_DEV_IDEPCI is not set
1108 +CONFIG_BLK_DEV_SL82C105=y
1109 CONFIG_BLK_DEV_IDE_PMAC=y
1110 CONFIG_BLK_DEV_IDEDMA_PMAC=y
1111 CONFIG_BLK_DEV_IDEDMA=y
1112 CONFIG_PMAC_IDEDMA_AUTO=y
1113 # CONFIG_IDE_CHIPSETS is not set
1116 -# Additional Block Devices
1118 CONFIG_BLK_DEV_LOOP=y
1119 # CONFIG_BLK_DEV_NBD is not set
1120 # CONFIG_BLK_DEV_MD is not set
1121 CONFIG_BLK_DEV_RAM=y
1122 -CONFIG_BLK_DEV_RAM_SIZE=4096
1123 CONFIG_BLK_DEV_INITRD=y
1124 # CONFIG_BLK_DEV_XD is not set
1125 # CONFIG_BLK_DEV_DAC960 is not set
1126 -CONFIG_PARIDE_PARPORT=m
1127 +CONFIG_PARIDE_PARPORT=y
1128 # CONFIG_PARIDE is not set
1129 # CONFIG_BLK_CPQ_DA is not set
1130 # CONFIG_BLK_DEV_HD is not set
1131 @@ -115,44 +96,22 @@
1133 # CONFIG_RTNETLINK is not set
1134 # CONFIG_NETLINK_DEV is not set
1136 +# CONFIG_FIREWALL is not set
1137 # CONFIG_FILTER is not set
1140 CONFIG_IP_MULTICAST=y
1141 # CONFIG_IP_ADVANCED_ROUTER is not set
1142 # CONFIG_IP_PNP is not set
1143 -CONFIG_IP_FIREWALL=y
1144 -# CONFIG_IP_FIREWALL_NETLINK is not set
1145 -CONFIG_IP_TRANSPARENT_PROXY=y
1146 -CONFIG_IP_MASQUERADE=y
1149 -# Protocol-specific masquerading support will be built as modules.
1151 -# CONFIG_IP_MASQUERADE_ICMP is not set
1154 -# Protocol-specific masquerading support will be built as modules.
1156 -# CONFIG_IP_MASQUERADE_MOD is not set
1157 # CONFIG_IP_ROUTER is not set
1158 # CONFIG_NET_IPIP is not set
1159 # CONFIG_NET_IPGRE is not set
1160 # CONFIG_IP_MROUTE is not set
1162 CONFIG_SYN_COOKIES=y
1165 -# (it is safe to leave these untouched)
1169 # CONFIG_IPV6 is not set
1174 # CONFIG_IPX is not set
1176 # CONFIG_X25 is not set
1177 @@ -174,19 +133,11 @@
1183 -# SCSI support type (disk, tape, CD-ROM)
1188 CONFIG_BLK_DEV_SR_VENDOR=y
1189 -# CONFIG_CHR_DEV_SG is not set
1192 -# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
1194 +CONFIG_CHR_DEV_SG=y
1195 # CONFIG_SCSI_MULTI_LUN is not set
1196 CONFIG_SCSI_CONSTANTS=y
1197 # CONFIG_SCSI_LOGGING is not set
1200 # SCSI low-level drivers
1202 -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
1203 # CONFIG_SCSI_7000FASST is not set
1204 # CONFIG_SCSI_ACARD is not set
1205 # CONFIG_SCSI_AHA152X is not set
1206 @@ -220,13 +170,11 @@
1207 # CONFIG_SCSI_GENERIC_NCR5380 is not set
1208 # CONFIG_SCSI_INITIO is not set
1209 # CONFIG_SCSI_INIA100 is not set
1210 -# CONFIG_SCSI_PPA is not set
1211 -# CONFIG_SCSI_IMM is not set
1212 # CONFIG_SCSI_NCR53C406A is not set
1213 # CONFIG_SCSI_SYM53C416 is not set
1214 # CONFIG_SCSI_SIM710 is not set
1215 # CONFIG_SCSI_NCR53C7xx is not set
1216 -CONFIG_SCSI_NCR53C8XX=y
1217 +# CONFIG_SCSI_NCR53C8XX is not set
1218 CONFIG_SCSI_SYM53C8XX=y
1219 CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS=8
1220 CONFIG_SCSI_NCR53C8XX_MAX_TAGS=32
1222 # CONFIG_SCSI_NCR53C8XX_PROFILE is not set
1223 # CONFIG_SCSI_NCR53C8XX_IOMAPPED is not set
1224 # CONFIG_SCSI_NCR53C8XX_PQS_PDS is not set
1225 -CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT=y
1226 +# CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT is not set
1227 # CONFIG_SCSI_PAS16 is not set
1228 # CONFIG_SCSI_PCI2000 is not set
1229 # CONFIG_SCSI_PCI2220I is not set
1232 # CONFIG_ARCNET is not set
1233 # CONFIG_DUMMY is not set
1234 -# CONFIG_BONDING is not set
1235 # CONFIG_EQUALIZER is not set
1236 # CONFIG_ETHERTAP is not set
1237 # CONFIG_NET_SB1000 is not set
1238 @@ -272,25 +219,24 @@
1240 CONFIG_NET_ETHERNET=y
1242 -# CONFIG_MACE_AAUI_PORT is not set
1245 # CONFIG_NCR885E is not set
1246 # CONFIG_NET_VENDOR_3COM is not set
1247 # CONFIG_LANCE is not set
1248 # CONFIG_NET_VENDOR_SMC is not set
1249 # CONFIG_NET_VENDOR_RACAL is not set
1250 # CONFIG_RTL8139 is not set
1251 +# CONFIG_YELLOWFIN is not set
1252 # CONFIG_NET_ISA is not set
1255 +# CONFIG_ACENIC is not set
1256 # CONFIG_AC3200 is not set
1257 # CONFIG_APRICOT is not set
1258 # CONFIG_CS89x0 is not set
1259 # CONFIG_DM9102 is not set
1261 # CONFIG_DEC_ELCP is not set
1262 -# CONFIG_DEC_ELCP_OLD is not set
1263 # CONFIG_DGRS is not set
1264 # CONFIG_EEXPRESS_PRO100 is not set
1265 # CONFIG_LNE390 is not set
1266 @@ -303,14 +249,6 @@
1267 # CONFIG_EPIC100 is not set
1268 # CONFIG_ZNET is not set
1269 # CONFIG_NET_POCKET is not set
1272 -# Ethernet (1000 Mbit)
1274 -# CONFIG_ACENIC is not set
1275 -# CONFIG_HAMACHI is not set
1276 -# CONFIG_YELLOWFIN is not set
1277 -# CONFIG_SK98LIN is not set
1278 # CONFIG_FDDI is not set
1279 # CONFIG_HIPPI is not set
1281 @@ -320,12 +258,7 @@
1282 # CONFIG_LTPC is not set
1283 # CONFIG_COPS is not set
1284 # CONFIG_IPDDP is not set
1285 -# CONFIG_PLIP is not set
1289 -# CCP compressors for PPP are only built as modules.
1291 # CONFIG_SLIP is not set
1292 # CONFIG_NET_RADIO is not set
1294 @@ -343,10 +276,7 @@
1295 # CONFIG_HOSTESS_SV11 is not set
1296 # CONFIG_COSA is not set
1297 # CONFIG_SEALEVEL_4021 is not set
1298 -# CONFIG_SYNCLINK_SYNCPPP is not set
1299 -# CONFIG_LANMEDIA is not set
1300 # CONFIG_COMX is not set
1301 -# CONFIG_HDLC is not set
1302 # CONFIG_DLCI is not set
1303 # CONFIG_SBNI is not set
1305 @@ -356,11 +286,6 @@
1306 # CONFIG_HAMRADIO is not set
1309 -# IrDA (infrared) support
1311 -# CONFIG_IRDA is not set
1316 # CONFIG_ISDN is not set
1319 CONFIG_DUMMY_CONSOLE=y
1320 # CONFIG_FB_PM2 is not set
1324 CONFIG_FB_PLATINUM=y
1325 @@ -383,12 +307,12 @@
1328 # CONFIG_FB_S3TRIO is not set
1329 -CONFIG_FB_COMPAT_XPMAC=y
1331 -CONFIG_FB_MATROX_MILLENIUM=y
1332 +# CONFIG_FB_MATROX_MILLENIUM is not set
1333 CONFIG_FB_MATROX_MYSTIQUE=y
1334 CONFIG_FB_MATROX_G100=y
1335 -CONFIG_FB_MATROX_MULTIHEAD=y
1336 +# CONFIG_FB_MATROX_MULTIHEAD is not set
1338 # CONFIG_FB_VIRTUAL is not set
1339 # CONFIG_FBCON_ADVANCED is not set
1342 # CONFIG_SERIAL_NONSTANDARD is not set
1343 CONFIG_UNIX98_PTYS=y
1344 CONFIG_UNIX98_PTY_COUNT=256
1345 -# CONFIG_PRINTER is not set
1349 @@ -427,11 +350,6 @@
1351 # CONFIG_82C710_MOUSE is not set
1352 # CONFIG_PC110_PAD is not set
1357 -# CONFIG_JOYSTICK is not set
1358 # CONFIG_QIC02_TAPE is not set
1359 # CONFIG_WATCHDOG is not set
1361 @@ -441,16 +359,20 @@
1364 # CONFIG_VIDEO_DEV is not set
1369 +# CONFIG_JOYSTICK is not set
1370 # CONFIG_DTLK is not set
1373 # Ftape, the floppy tape device driver
1375 # CONFIG_FTAPE is not set
1376 -# CONFIG_TOSHIBA is not set
1380 +# USB drivers - not for the faint of heart
1382 # CONFIG_USB is not set
1384 @@ -462,10 +384,10 @@
1385 # CONFIG_ADFS_FS is not set
1386 # CONFIG_AFFS_FS is not set
1392 # CONFIG_UMSDOS_FS is not set
1396 # CONFIG_JOLIET is not set
1397 # CONFIG_MINIX_FS is not set
1400 # Native Language Support
1402 -CONFIG_NLS_DEFAULT="cp437"
1403 CONFIG_NLS_CODEPAGE_437=y
1404 # CONFIG_NLS_CODEPAGE_737 is not set
1405 # CONFIG_NLS_CODEPAGE_775 is not set
1406 @@ -522,10 +443,6 @@
1407 # CONFIG_NLS_CODEPAGE_866 is not set
1408 # CONFIG_NLS_CODEPAGE_869 is not set
1409 # CONFIG_NLS_CODEPAGE_874 is not set
1410 -# CONFIG_NLS_CODEPAGE_932 is not set
1411 -# CONFIG_NLS_CODEPAGE_936 is not set
1412 -# CONFIG_NLS_CODEPAGE_949 is not set
1413 -# CONFIG_NLS_CODEPAGE_950 is not set
1414 # CONFIG_NLS_ISO8859_1 is not set
1415 # CONFIG_NLS_ISO8859_2 is not set
1416 # CONFIG_NLS_ISO8859_3 is not set
1417 @@ -536,17 +453,55 @@
1418 # CONFIG_NLS_ISO8859_8 is not set
1419 # CONFIG_NLS_ISO8859_9 is not set
1420 # CONFIG_NLS_ISO8859_14 is not set
1421 -CONFIG_NLS_ISO8859_15=y
1422 +# CONFIG_NLS_ISO8859_15 is not set
1423 # CONFIG_NLS_KOI8_R is not set
1428 -# CONFIG_SOUND is not set
1431 +# CONFIG_SOUND_CMPCI is not set
1432 +# CONFIG_SOUND_ES1370 is not set
1433 +# CONFIG_SOUND_ES1371 is not set
1434 +# CONFIG_SOUND_MAESTRO is not set
1435 +# CONFIG_SOUND_ESSSOLO1 is not set
1436 +# CONFIG_SOUND_SONICVIBES is not set
1437 +# CONFIG_SOUND_MSNDCLAS is not set
1438 +# CONFIG_SOUND_MSNDPIN is not set
1440 +# CONFIG_SOUND_DMAP is not set
1441 +# CONFIG_SOUND_PAS is not set
1442 +# CONFIG_SOUND_SB is not set
1443 +# CONFIG_SOUND_GUS is not set
1444 +# CONFIG_SOUND_MPU401 is not set
1445 +# CONFIG_SOUND_PSS is not set
1446 +# CONFIG_SOUND_MSS is not set
1447 +# CONFIG_SOUND_SSCAPE is not set
1448 +# CONFIG_SOUND_TRIX is not set
1449 +# CONFIG_SOUND_VIA82CXXX is not set
1450 +# CONFIG_SOUND_MAD16 is not set
1451 +# CONFIG_SOUND_WAVEFRONT is not set
1452 +CONFIG_SOUND_CS4232=m
1453 +# CONFIG_SOUND_OPL3SA2 is not set
1454 +# CONFIG_SOUND_MAUI is not set
1455 +# CONFIG_SOUND_SGALAXY is not set
1456 +# CONFIG_SOUND_AD1816 is not set
1457 +# CONFIG_SOUND_OPL3SA1 is not set
1458 +# CONFIG_SOUND_SOFTOSS is not set
1459 +# CONFIG_SOUND_YM3812 is not set
1460 +# CONFIG_SOUND_VMIDI is not set
1461 +# CONFIG_SOUND_UART6850 is not set
1462 +# CONFIG_SOUND_NM256 is not set
1465 +# Additional low level sound drivers
1467 +# CONFIG_LOWLEVEL_SOUND is not set
1472 -CONFIG_MAGIC_SYSRQ=y
1473 +# CONFIG_MAGIC_SYSRQ is not set
1474 # CONFIG_KGDB is not set
1475 # CONFIG_XMON is not set
1476 diff -urN linux.orig/arch/ppc/config.in linux/arch/ppc/config.in
1477 --- linux.orig/arch/ppc/config.in Fri Nov 2 17:39:05 2001
1478 +++ linux/arch/ppc/config.in Thu Jul 11 15:43:29 2002
1481 bool 'Symmetric multi-processing support' CONFIG_SMP
1483 -if [ "$CONFIG_6xx" = "y" ]; then
1484 - bool 'Altivec (G4) support' CONFIG_ALTIVEC
1487 if [ "$CONFIG_ALL_PPC" != "y" ]; then
1488 define_bool CONFIG_MACH_SPECIFIC y
1490 diff -urN linux.orig/arch/ppc/defconfig linux/arch/ppc/defconfig
1491 --- linux.orig/arch/ppc/defconfig Sun Mar 25 18:31:49 2001
1492 +++ linux/arch/ppc/defconfig Thu Jul 11 15:43:29 2002
1495 -# Automatically generated make config: don't edit
1496 +# Automatically generated by make menuconfig: don't edit
1504 -# CONFIG_PPC64 is not set
1505 # CONFIG_8xx is not set
1507 +# CONFIG_PMAC is not set
1508 # CONFIG_PREP is not set
1509 # CONFIG_CHRP is not set
1510 -# CONFIG_ALL_PPC is not set
1512 # CONFIG_APUS is not set
1513 +# CONFIG_GEMINI is not set
1514 # CONFIG_MBX is not set
1515 # CONFIG_SMP is not set
1516 -CONFIG_MACH_SPECIFIC=y
1522 CONFIG_EXPERIMENTAL=y
1524 -# CONFIG_MODVERSIONS is not set
1525 +CONFIG_MODVERSIONS=y
1528 # CONFIG_PCI_QUIRKS is not set
1530 # CONFIG_BSD_PROCESS_ACCT is not set
1533 -CONFIG_BINFMT_MISC=m
1534 +# CONFIG_BINFMT_MISC is not set
1535 # CONFIG_BINFMT_JAVA is not set
1537 -# CONFIG_PARPORT_PC is not set
1538 -# CONFIG_VGA_CONSOLE is not set
1539 +# CONFIG_PARPORT is not set
1540 +CONFIG_VGA_CONSOLE=y
1542 CONFIG_FB_COMPAT_XPMAC=y
1545 # CONFIG_TOTALMP is not set
1547 # CONFIG_MOTOROLA_HOTSWAP is not set
1548 +# CONFIG_CMDLINE_BOOL is not set
1551 # Plug and Play support
1556 -# CONFIG_BLK_DEV_FD is not set
1557 +CONFIG_BLK_DEV_FD=y
1558 CONFIG_BLK_DEV_IDE=y
1561 -# Please see Documentation/ide.txt for help/info on IDE drives
1563 # CONFIG_BLK_DEV_HD_IDE is not set
1564 CONFIG_BLK_DEV_IDEDISK=y
1565 CONFIG_BLK_DEV_IDECD=y
1567 # CONFIG_BLK_DEV_IDESCSI is not set
1568 # CONFIG_BLK_DEV_CMD640 is not set
1569 # CONFIG_BLK_DEV_RZ1000 is not set
1570 -CONFIG_BLK_DEV_IDEPCI=y
1571 -CONFIG_BLK_DEV_IDEDMA=y
1572 -# CONFIG_BLK_DEV_OFFBOARD is not set
1573 -CONFIG_IDEDMA_AUTO=y
1574 -# CONFIG_BLK_DEV_OPTI621 is not set
1575 -# CONFIG_BLK_DEV_TRM290 is not set
1576 -# CONFIG_BLK_DEV_NS87415 is not set
1577 -# CONFIG_BLK_DEV_VIA82C586 is not set
1578 -CONFIG_BLK_DEV_CMD646=y
1579 -# CONFIG_BLK_DEV_SL82C105 is not set
1580 +# CONFIG_BLK_DEV_IDEPCI is not set
1581 +CONFIG_BLK_DEV_SL82C105=y
1582 CONFIG_BLK_DEV_IDE_PMAC=y
1583 CONFIG_BLK_DEV_IDEDMA_PMAC=y
1584 CONFIG_BLK_DEV_IDEDMA=y
1585 CONFIG_PMAC_IDEDMA_AUTO=y
1586 # CONFIG_IDE_CHIPSETS is not set
1589 -# Additional Block Devices
1591 CONFIG_BLK_DEV_LOOP=y
1592 # CONFIG_BLK_DEV_NBD is not set
1593 # CONFIG_BLK_DEV_MD is not set
1595 CONFIG_BLK_DEV_INITRD=y
1596 # CONFIG_BLK_DEV_XD is not set
1597 # CONFIG_BLK_DEV_DAC960 is not set
1598 -CONFIG_PARIDE_PARPORT=m
1599 +CONFIG_PARIDE_PARPORT=y
1600 # CONFIG_PARIDE is not set
1601 # CONFIG_BLK_CPQ_DA is not set
1602 # CONFIG_BLK_DEV_HD is not set
1603 @@ -125,18 +108,10 @@
1604 # CONFIG_NET_IPGRE is not set
1605 # CONFIG_IP_MROUTE is not set
1607 -# CONFIG_SYN_COOKIES is not set
1610 -# (it is safe to leave these untouched)
1612 +CONFIG_SYN_COOKIES=y
1615 # CONFIG_IPV6 is not set
1620 # CONFIG_IPX is not set
1622 # CONFIG_X25 is not set
1623 @@ -158,19 +133,11 @@
1629 -# SCSI support type (disk, tape, CD-ROM)
1634 CONFIG_BLK_DEV_SR_VENDOR=y
1635 -# CONFIG_CHR_DEV_SG is not set
1638 -# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
1640 +CONFIG_CHR_DEV_SG=y
1641 # CONFIG_SCSI_MULTI_LUN is not set
1642 CONFIG_SCSI_CONSTANTS=y
1643 # CONFIG_SCSI_LOGGING is not set
1645 CONFIG_AIC7XXX_CMDS_PER_DEVICE=8
1646 CONFIG_AIC7XXX_PROC_STATS=y
1647 CONFIG_AIC7XXX_RESET_DELAY=15
1648 +# CONFIG_SCSI_IPS is not set
1649 # CONFIG_SCSI_ADVANSYS is not set
1650 # CONFIG_SCSI_IN2000 is not set
1651 # CONFIG_SCSI_AM53C974 is not set
1652 @@ -202,12 +170,11 @@
1653 # CONFIG_SCSI_GENERIC_NCR5380 is not set
1654 # CONFIG_SCSI_INITIO is not set
1655 # CONFIG_SCSI_INIA100 is not set
1656 -# CONFIG_SCSI_PPA is not set
1657 -# CONFIG_SCSI_IMM is not set
1658 # CONFIG_SCSI_NCR53C406A is not set
1659 # CONFIG_SCSI_SYM53C416 is not set
1660 +# CONFIG_SCSI_SIM710 is not set
1661 # CONFIG_SCSI_NCR53C7xx is not set
1662 -CONFIG_SCSI_NCR53C8XX=y
1663 +# CONFIG_SCSI_NCR53C8XX is not set
1664 CONFIG_SCSI_SYM53C8XX=y
1665 CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS=8
1666 CONFIG_SCSI_NCR53C8XX_MAX_TAGS=32
1668 # CONFIG_SCSI_NCR53C8XX_PROFILE is not set
1669 # CONFIG_SCSI_NCR53C8XX_IOMAPPED is not set
1670 # CONFIG_SCSI_NCR53C8XX_PQS_PDS is not set
1671 -CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT=y
1672 +# CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT is not set
1673 # CONFIG_SCSI_PAS16 is not set
1674 # CONFIG_SCSI_PCI2000 is not set
1675 # CONFIG_SCSI_PCI2220I is not set
1676 @@ -253,21 +220,21 @@
1677 CONFIG_NET_ETHERNET=y
1681 +# CONFIG_NCR885E is not set
1682 # CONFIG_NET_VENDOR_3COM is not set
1683 # CONFIG_LANCE is not set
1684 # CONFIG_NET_VENDOR_SMC is not set
1685 # CONFIG_NET_VENDOR_RACAL is not set
1686 # CONFIG_RTL8139 is not set
1687 -# CONFIG_SIS900 is not set
1688 # CONFIG_YELLOWFIN is not set
1689 # CONFIG_NET_ISA is not set
1691 -# CONFIG_PCNET32 is not set
1693 # CONFIG_ACENIC is not set
1694 # CONFIG_AC3200 is not set
1695 # CONFIG_APRICOT is not set
1696 # CONFIG_CS89x0 is not set
1697 +# CONFIG_DM9102 is not set
1699 # CONFIG_DEC_ELCP is not set
1700 # CONFIG_DGRS is not set
1702 # CONFIG_NE2K_PCI is not set
1703 # CONFIG_TLAN is not set
1704 # CONFIG_VIA_RHINE is not set
1705 +# CONFIG_SIS900 is not set
1706 # CONFIG_ES3210 is not set
1707 # CONFIG_EPIC100 is not set
1708 # CONFIG_ZNET is not set
1709 @@ -290,12 +258,7 @@
1710 # CONFIG_LTPC is not set
1711 # CONFIG_COPS is not set
1712 # CONFIG_IPDDP is not set
1713 -# CONFIG_PLIP is not set
1717 -# CCP compressors for PPP are only built as modules.
1719 # CONFIG_SLIP is not set
1720 # CONFIG_NET_RADIO is not set
1723 # CONFIG_HOSTESS_SV11 is not set
1724 # CONFIG_COSA is not set
1725 # CONFIG_SEALEVEL_4021 is not set
1726 +# CONFIG_COMX is not set
1727 # CONFIG_DLCI is not set
1728 +# CONFIG_SBNI is not set
1731 # Amateur Radio support
1732 @@ -339,12 +304,14 @@
1734 CONFIG_FB_PLATINUM=y
1735 CONFIG_FB_VALKYRIE=y
1740 # CONFIG_FB_S3TRIO is not set
1741 -# CONFIG_FB_MATROX is not set
1743 +# CONFIG_FB_MATROX_MILLENIUM is not set
1744 +CONFIG_FB_MATROX_MYSTIQUE=y
1745 +CONFIG_FB_MATROX_G100=y
1746 +# CONFIG_FB_MATROX_MULTIHEAD is not set
1748 # CONFIG_FB_VIRTUAL is not set
1749 # CONFIG_FBCON_ADVANCED is not set
1750 @@ -367,13 +334,22 @@
1754 -# CONFIG_SERIAL is not set
1756 # CONFIG_SERIAL_EXTENDED is not set
1757 # CONFIG_SERIAL_NONSTANDARD is not set
1758 CONFIG_UNIX98_PTYS=y
1759 CONFIG_UNIX98_PTY_COUNT=256
1760 -# CONFIG_PRINTER is not set
1761 -# CONFIG_MOUSE is not set
1767 +# CONFIG_ATIXL_BUSMOUSE is not set
1768 +# CONFIG_BUSMOUSE is not set
1769 +# CONFIG_MS_BUSMOUSE is not set
1771 +# CONFIG_82C710_MOUSE is not set
1772 +# CONFIG_PC110_PAD is not set
1773 # CONFIG_QIC02_TAPE is not set
1774 # CONFIG_WATCHDOG is not set
1776 @@ -408,10 +384,10 @@
1777 # CONFIG_ADFS_FS is not set
1778 # CONFIG_AFFS_FS is not set
1784 # CONFIG_UMSDOS_FS is not set
1788 # CONFIG_JOLIET is not set
1789 # CONFIG_MINIX_FS is not set
1791 # CONFIG_NLS_ISO8859_8 is not set
1792 # CONFIG_NLS_ISO8859_9 is not set
1793 # CONFIG_NLS_ISO8859_14 is not set
1794 -CONFIG_NLS_ISO8859_15=y
1795 +# CONFIG_NLS_ISO8859_15 is not set
1796 # CONFIG_NLS_KOI8_R is not set
1799 @@ -485,13 +461,43 @@
1803 +# CONFIG_SOUND_CMPCI is not set
1804 # CONFIG_SOUND_ES1370 is not set
1805 # CONFIG_SOUND_ES1371 is not set
1806 +# CONFIG_SOUND_MAESTRO is not set
1807 # CONFIG_SOUND_ESSSOLO1 is not set
1808 # CONFIG_SOUND_SONICVIBES is not set
1809 # CONFIG_SOUND_MSNDCLAS is not set
1810 # CONFIG_SOUND_MSNDPIN is not set
1811 -# CONFIG_SOUND_OSS is not set
1813 +# CONFIG_SOUND_DMAP is not set
1814 +# CONFIG_SOUND_PAS is not set
1815 +# CONFIG_SOUND_SB is not set
1816 +# CONFIG_SOUND_GUS is not set
1817 +# CONFIG_SOUND_MPU401 is not set
1818 +# CONFIG_SOUND_PSS is not set
1819 +# CONFIG_SOUND_MSS is not set
1820 +# CONFIG_SOUND_SSCAPE is not set
1821 +# CONFIG_SOUND_TRIX is not set
1822 +# CONFIG_SOUND_VIA82CXXX is not set
1823 +# CONFIG_SOUND_MAD16 is not set
1824 +# CONFIG_SOUND_WAVEFRONT is not set
1825 +CONFIG_SOUND_CS4232=m
1826 +# CONFIG_SOUND_OPL3SA2 is not set
1827 +# CONFIG_SOUND_MAUI is not set
1828 +# CONFIG_SOUND_SGALAXY is not set
1829 +# CONFIG_SOUND_AD1816 is not set
1830 +# CONFIG_SOUND_OPL3SA1 is not set
1831 +# CONFIG_SOUND_SOFTOSS is not set
1832 +# CONFIG_SOUND_YM3812 is not set
1833 +# CONFIG_SOUND_VMIDI is not set
1834 +# CONFIG_SOUND_UART6850 is not set
1835 +# CONFIG_SOUND_NM256 is not set
1838 +# Additional low level sound drivers
1840 +# CONFIG_LOWLEVEL_SOUND is not set
1844 diff -urN linux.orig/arch/ppc/kernel/Makefile linux/arch/ppc/kernel/Makefile
1845 --- linux.orig/arch/ppc/kernel/Makefile Sun Mar 25 18:31:48 2001
1846 +++ linux/arch/ppc/kernel/Makefile Thu Jul 11 15:43:29 2002
1849 # Note 2! The CFLAGS definitions are now in the main makefile...
1851 -# Once a gas that groks -mvec is generally available, we'll use it...
1853 -#ifdef CONFIG_ALTIVEC
1854 -# $(CC) $(CFLAGS) -D__ASSEMBLY__ -Wa,-mvec -c $< -o $*.o
1856 $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $*.o
1859 O_TARGET := kernel.o
1860 OX_OBJS := ppc_ksyms.o setup.o
1863 ifeq ($(CONFIG_MBX),y)
1864 O_OBJS += mbx_setup.o mbx_pci.o softemu8xx.o i8259.o ppc8xx_pic.o
1867 ifeq ($(CONFIG_APUS),y)
1868 O_OBJS += apus_setup.o prom.o openpic.o
1870 +ifneq ($(CONFIG_MBX),y)
1871 +O_OBJS += prep_time.o pmac_time.o chrp_time.o \
1872 + pmac_setup.o pmac_support.o \
1873 + prep_pci.o pmac_pci.o chrp_pci.o \
1874 + residual.o prom.o openpic.o feature.o \
1875 + prep_nvram.o open_pic.o i8259.o pmac_pic.o indirect_pci.o \
1876 + gemini_pci.o gemini_prom.o gemini_setup.o
1877 +OX_OBJS += chrp_setup.o prep_setup.o
1881 -PMAC_OBJS = pmac_time.o pmac_setup.o pmac_support.o pmac_pci.o pmac_pic.o \
1882 - feature.o openpic.o open_pic.o prom.o
1883 -CHRP_OBJS = $(PMAC_OBJS) chrp_time.o chrp_pci.o i8259.o indirect_pci.o
1884 -CHRPX_OBJS = chrp_setup.o
1885 -PREP_OBJS = prep_time.o prep_pci.o residual.o prep_nvram.o i8259.o \
1886 - indirect_pci.o openpic.o open_pic.o prom.o
1887 -PREPX_OBJS = prep_setup.o
1889 -ifeq ($(CONFIG_ALL_PPC),y)
1890 -O_OBJS += $(sort $(PMAC_OBJS) $(PREP_OBJS) $(CHRP_OBJS))
1891 -OX_OBJS += $(PMACX_OBJS) $(PREPX_OBJS) $(CHRPX_OBJS)
1893 -ifeq ($(CONFIG_PMAC),y)
1894 -O_OBJS += $(PMAC_OBJS)
1895 -OX_OBJS += $(PMACX_OBJS)
1897 -ifeq ($(CONFIG_PREP),y)
1898 -O_OBJS += $(PREP_OBJS)
1899 -OX_OBJS += $(PREPX_OBJS)
1901 -ifeq ($(CONFIG_CHRP),y)
1902 -O_OBJS += $(CHRP_OBJS)
1903 -OX_OBJS += $(CHRPX_OBJS)
1906 -GEMINI_OBJS = $(PREP_OBJS) gemini_pci.o gemini_prom.o gemini_setup.o
1907 -ifeq ($(CONFIG_GEMINI),y)
1908 -O_OBJS += $(GEMINI_OBJS)
1909 -OX_OBJS += $(PREPX_OBJS)
1914 $(TOPDIR)/include/asm/ptrace.h
1915 $(CC) ${CFLAGS} -S mk_defs.c
1916 cp ppc_defs.head ppc_defs.h
1917 - chmod 755 ppc_defs.h
1918 - grep '^#define' mk_defs.s >> ppc_defs.h
1919 + grep '^#define' mk_defs.s >>ppc_defs.h
1922 find_name : find_name.c
1923 $(HOSTCC) -o find_name find_name.c
1926 - $(HOSTCC) ${CFLAGS} -D__KERNEL__ -I../../../include -o checks checks.c
1927 + $(HOSTCC) ${CFLAGS} -D__KERNEL__ -o checks checks.c
1930 include $(TOPDIR)/Rules.make
1931 diff -urN linux.orig/arch/ppc/kernel/apus_setup.c linux/arch/ppc/kernel/apus_setup.c
1932 --- linux.orig/arch/ppc/kernel/apus_setup.c Sun Mar 25 18:31:49 2001
1933 +++ linux/arch/ppc/kernel/apus_setup.c Thu Jul 11 15:43:29 2002
1935 #include <asm/machdep.h>
1936 #include <asm/ide.h>
1938 -#include <asm/time.h>
1940 #include "local_irq.h"
1942 unsigned long apus_get_rtc_time(void);
1944 ppc_md.kbd_unexpected_up = NULL;
1945 ppc_md.kbd_leds = NULL;
1946 ppc_md.kbd_init_hw = NULL;
1947 - ppc_md.sysrq_xlate = NULL;
1948 + ppc_md.kbd_sysrq_xlate = NULL;
1950 #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
1951 ppc_ide_md.insw = apus_ide_insw;
1952 diff -urN linux.orig/arch/ppc/kernel/checks.c linux/arch/ppc/kernel/checks.c
1953 --- linux.orig/arch/ppc/kernel/checks.c Sun Mar 25 18:31:48 2001
1954 +++ linux/arch/ppc/kernel/checks.c Thu Jul 11 15:43:29 2002
1956 -#include <linux/config.h>
1957 #include <linux/errno.h>
1958 #include <linux/sched.h>
1959 #include <linux/kernel.h>
1960 diff -urN linux.orig/arch/ppc/kernel/chrp_pci.c linux/arch/ppc/kernel/chrp_pci.c
1961 --- linux.orig/arch/ppc/kernel/chrp_pci.c Sun Mar 25 18:31:48 2001
1962 +++ linux/arch/ppc/kernel/chrp_pci.c Thu Jul 11 15:43:29 2002
1965 #include <asm/pgtable.h>
1966 #include <asm/irq.h>
1967 +#include <asm/irq-compat.h>
1968 #include <asm/hydra.h>
1969 #include <asm/prom.h>
1970 #include <asm/gg2.h>
1972 #include <asm/machdep.h>
1975 -#include "open_pic.h"
1978 #define pci_config_addr(bus, dev, offset) \
1980 for( dev=pci_devices ; dev; dev=dev->next )
1983 - dev->irq = dev->irq + open_pic.irq_offset;
1984 + dev->irq = openpic_to_irq( dev->irq );
1985 /* these need to be absolute addrs for OF and Matrox FB -- Cort */
1986 if ( dev->vendor == PCI_VENDOR_ID_MATROX )
1988 diff -urN linux.orig/arch/ppc/kernel/chrp_setup.c linux/arch/ppc/kernel/chrp_setup.c
1989 --- linux.orig/arch/ppc/kernel/chrp_setup.c Sun Mar 25 18:31:49 2001
1990 +++ linux/arch/ppc/kernel/chrp_setup.c Thu Jul 11 16:22:09 2002
1992 #include <linux/pci.h>
1993 #include <linux/openpic.h>
1994 #include <linux/version.h>
1995 -#include <linux/delay.h>
1997 #include <asm/mmu.h>
1998 #include <asm/processor.h>
2000 #include <asm/dma.h>
2001 #include <asm/machdep.h>
2002 #include <asm/irq.h>
2003 +#include <asm/irq-compat.h>
2004 #include <asm/adb.h>
2005 #include <asm/hydra.h>
2006 #include <asm/keyboard.h>
2008 -#include <asm/time.h>
2010 #include "local_irq.h"
2012 #include "open_pic.h"
2014 int chrp_set_rtc_time(unsigned long nowtime);
2015 unsigned long rtas_event_scan_rate = 0, rtas_event_scan_ct = 0;
2016 void chrp_calibrate_decr(void);
2017 -long chrp_time_init(void);
2018 +void chrp_time_init(void);
2020 void chrp_setup_pci_ptrs(void);
2022 @@ -359,6 +359,81 @@
2027 +chrp_do_IRQ(struct pt_regs *regs,
2032 + unsigned long bits = 0;
2033 + int openpic_eoi_done = 0;
2037 + unsigned int loops = 1000000;
2038 + while (test_bit(0, &global_irq_lock)) {
2039 + if (smp_processor_id() == global_irq_holder) {
2040 + printk("uh oh, interrupt while we hold global irq lock!\n");
2046 + if (loops-- == 0) {
2047 + printk("do_IRQ waiting for irq lock (holder=%d)\n", global_irq_holder);
2054 +#endif /* __SMP__ */
2056 + irq = openpic_irq(smp_processor_id());
2057 + if (irq == IRQ_8259_CASCADE)
2060 + * This magic address generates a PCI IACK cycle.
2062 + * This should go in the above mask/ack code soon. -- Cort
2064 + if ( chrp_int_ack_special )
2065 + irq = *chrp_int_ack_special;
2067 + irq = i8259_irq(0);
2069 + * Acknowledge as soon as possible to allow i8259
2070 + * interrupt nesting */
2071 + openpic_eoi(smp_processor_id());
2072 + openpic_eoi_done = 1;
2074 + if (irq == OPENPIC_VEC_SPURIOUS)
2077 + * Spurious interrupts should never be
2080 + ppc_spurious_interrupts++;
2081 + openpic_eoi_done = 1;
2084 + bits = 1UL << irq;
2088 + printk(KERN_DEBUG "Bogus interrupt %d from PC = %lx\n",
2090 + ppc_spurious_interrupts++;
2094 + ppc_irq_dispatch_handler( regs, irq );
2097 + if (!openpic_eoi_done)
2098 + openpic_eoi(smp_processor_id());
2102 chrp_init_IRQ(void))
2105 (*(unsigned long *)get_property(np,
2106 "8259-interrupt-acknowledge", NULL));
2108 - open_pic.irq_offset = NUM_8259_INTERRUPTS;
2109 + open_pic.irq_offset = 16;
2110 for ( i = 16 ; i < NR_IRQS ; i++ )
2111 irq_desc[i].ctl = &open_pic;
2114 irq_desc[i].ctl = &i8259_pic;
2117 - request_irq(HYDRA_INT_ADB_NMI+open_pic.irq_offset,
2118 + request_irq(openpic_to_irq(HYDRA_INT_ADB_NMI),
2119 xmon_irq, 0, "NMI", 0);
2120 #endif /* CONFIG_XMON */
2123 ppc_md.get_cpuinfo = chrp_get_cpuinfo;
2124 ppc_md.irq_cannonicalize = chrp_irq_cannonicalize;
2125 ppc_md.init_IRQ = chrp_init_IRQ;
2126 - ppc_md.do_IRQ = open_pic_do_IRQ;
2127 + ppc_md.do_IRQ = chrp_do_IRQ;
2129 ppc_md.init = chrp_init2;
2133 call_rtas( "display-character", 1, 1, NULL, *s++ );
2136 -void chrp_indicator(int x)
2138 - call_rtas("set-indicator", 3, 1, NULL, 6, 0, x);
2140 diff -urN linux.orig/arch/ppc/kernel/chrp_time.c linux/arch/ppc/kernel/chrp_time.c
2141 --- linux.orig/arch/ppc/kernel/chrp_time.c Sun Mar 25 18:31:49 2001
2142 +++ linux/arch/ppc/kernel/chrp_time.c Thu Jul 11 15:43:29 2002
2144 #include <asm/processor.h>
2145 #include <asm/nvram.h>
2146 #include <asm/prom.h>
2147 -#include <asm/time.h>
2150 static int nvram_as1 = NVRAM_AS1;
2151 static int nvram_as0 = NVRAM_AS0;
2152 static int nvram_data = NVRAM_DATA;
2154 -__initfunc(long chrp_time_init(void))
2155 +__initfunc(void chrp_time_init(void))
2157 struct device_node *rtcs;
2160 rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
2161 if (rtcs == NULL || rtcs->addrs == NULL)
2164 base = rtcs->addrs[0].address;
2167 nvram_data = base + 1;
2171 int chrp_cmos_clock_read(int addr)
2172 diff -urN linux.orig/arch/ppc/kernel/gemini_setup.c linux/arch/ppc/kernel/gemini_setup.c
2173 --- linux.orig/arch/ppc/kernel/gemini_setup.c Sun Mar 25 18:31:49 2001
2174 +++ linux/arch/ppc/kernel/gemini_setup.c Thu Jul 11 15:45:25 2002
2176 #include <linux/blk.h>
2177 #include <linux/console.h>
2178 #include <linux/openpic.h>
2179 -#include <linux/delay.h>
2181 #include <asm/system.h>
2182 #include <asm/pgtable.h>
2185 #include <asm/m48t35.h>
2186 #include <asm/gemini.h>
2187 -#include <asm/processor.h>
2189 -#include <asm/time.h>
2191 #include "local_irq.h"
2192 #include "open_pic.h"
2195 ioremap( GEMINI_MPIC_ADDR, sizeof( struct OpenPIC ));
2199 +extern unsigned long loops_per_jiffy;
2200 extern int root_mountflags;
2201 extern char cmd_line[];
2203 @@ -258,6 +258,14 @@
2208 +#define L2CR_PIPE_LATEWR (0x01800000) /* late-write SRAM */
2209 +#define L2CR_L2CTL (0x00100000) /* RAM control */
2210 +#define L2CR_INST_DISABLE (0x00400000) /* disable for insn's */
2211 +#define L2CR_L2I (0x00200000) /* global invalidate */
2212 +#define L2CR_L2E (0x80000000) /* enable */
2213 +#define L2CR_L2WT (0x00080000) /* write-through */
2215 void __init gemini_init_l2(void)
2221 cache |= L2CR_PIPE_LATEWR|L2CR_L2CTL|L2CR_INST_DISABLE;
2222 - _set_L2CR(cache|L2CR_L2E);
2224 + _set_L2CR(cache|L2CR_L2I|L2CR_L2E);
2229 #define gemini_rtc_write(val,x) (writeb((val),(GEMINI_RTC+(x))))
2231 /* ensure that the RTC is up and running */
2232 -long __init gemini_time_init(void)
2233 +void __init gemini_time_init(void)
2238 gemini_rtc_write((reg & ~(M48T35_RTC_STOPPED)), M48T35_RTC_CONTROL);
2239 gemini_rtc_write((reg | M48T35_RTC_SET), M48T35_RTC_CONTROL);
2245 diff -urN linux.orig/arch/ppc/kernel/head.S linux/arch/ppc/kernel/head.S
2246 --- linux.orig/arch/ppc/kernel/head.S Fri Nov 2 17:39:05 2001
2247 +++ linux/arch/ppc/kernel/head.S Thu Jul 11 15:43:29 2002
2249 * Copyright (C) 1996 Paul Mackerras.
2250 * MPC8xx modifications Copyright (C) 1997 Dan Malek (dmalek@jlc.net).
2251 * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
2252 - * AltiVec additions by Kumar Gala (kumar.gala@motorola.com).
2254 * This file contains the low-level support and setup for the
2255 * PowerPC platform, including trap and interrupt dispatch.
2257 * modify it under the terms of the GNU General Public License
2258 * as published by the Free Software Foundation; either version
2259 * 2 of the License, or (at your option) any later version.
2262 - * Add sys_rt_sigreturn in DoSyscall Handler.
2263 - * Giovanna Ambrosini (ambrosini@lightning.ch).
2268 #define REST_16FPRS(n, base) REST_8FPRS(n, base); REST_8FPRS(n+8, base)
2269 #define REST_32FPRS(n, base) REST_16FPRS(n, base); REST_16FPRS(n+16, base)
2272 - * Once a version of gas that understands the AltiVec instructions
2273 - * is freely available, we can do this the normal way... - paulus
2275 -#define LVX(r,a,b) .long (31<<26)+((r)<<21)+((a)<<16)+((b)<<11)+(103<<1)
2276 -#define STVX(r,a,b) .long (31<<26)+((r)<<21)+((a)<<16)+((b)<<11)+(231<<1)
2277 -#define MFVSCR(r) .long (4<<26)+((r)<<11)+(770<<1)
2278 -#define MTVSCR(r) .long (4<<26)+((r)<<11)+(802<<1)
2280 -#define SAVE_VR(n,b,base) li b,TSS_VR0+(16*(n)); STVX(n,b,base)
2281 -#define SAVE_2VR(n,b,base) SAVE_VR(n,b,base); SAVE_VR(n+1,b,base)
2282 -#define SAVE_4VR(n,b,base) SAVE_2VR(n,b,base); SAVE_2VR(n+2,b,base)
2283 -#define SAVE_8VR(n,b,base) SAVE_4VR(n,b,base); SAVE_4VR(n+4,b,base)
2284 -#define SAVE_16VR(n,b,base) SAVE_8VR(n,b,base); SAVE_8VR(n+8,b,base)
2285 -#define SAVE_32VR(n,b,base) SAVE_16VR(n,b,base); SAVE_16VR(n+16,b,base)
2286 -#define REST_VR(n,b,base) li b,TSS_VR0+(16*(n)); LVX(n,b,base)
2287 -#define REST_2VR(n,b,base) REST_VR(n,b,base); REST_VR(n+1,b,base)
2288 -#define REST_4VR(n,b,base) REST_2VR(n,b,base); REST_2VR(n+2,b,base)
2289 -#define REST_8VR(n,b,base) REST_4VR(n,b,base); REST_4VR(n+4,b,base)
2290 -#define REST_16VR(n,b,base) REST_8VR(n,b,base); REST_8VR(n+8,b,base)
2291 -#define REST_32VR(n,b,base) REST_16VR(n,b,base); REST_16VR(n+16,b,base)
2296 @@ -262,15 +235,66 @@
2298 /* Switch MMU off, clear BATs and flush TLB */
2303 - bl setup_init_bats
2304 -#ifndef CONFIG_APUS
2305 -#ifdef CONFIG_BOOTX_TEXT
2309 +/* Use the first pair of BAT registers to map the 1st 16MB
2310 + * of RAM to KERNELBASE. From this point on we can't safely
2311 + * call OF any more.
2313 + lis r11,KERNELBASE@h
2315 + rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
2318 + ori r11,r11,4 /* set up BAT registers for 601 */
2319 + li r8,0x7f /* valid, block length = 8MB */
2320 + oris r9,r11,0x800000@h /* set up BAT reg for 2nd 8M */
2321 + oris r10,r8,0x800000@h /* set up BAT reg for 2nd 8M */
2322 + mtspr IBAT0U,r11 /* N.B. 601 has valid bit in */
2323 + mtspr IBAT0L,r8 /* lower BAT register */
2329 + ori r11,r11,BL_8M<<2|0x2 /* set up an 8MB mapping */
2330 + ori r11,r11,0xfe /* set up an 8MB mapping */
2331 + lis r8,CYBERBASEp@h
2333 + addis r8,r8,KERNELBASE@h
2336 + ori r11,r11,BL_256M<<2|0x2 /* set up BAT registers for 604 */
2337 + li r8,2 /* R/W access */
2339 + * If the MMU is off clear the bats. See clear_bat() -- Cort
2341 +#ifndef CONFIG_GEMINI
2343 + * allow secondary cpus to get at all of ram in early bootup
2344 + * since their init_task may be up there -- Cort
2346 + oris r18,r8,0x10000000@h
2347 + oris r21,r11,(KERNELBASE+0x10000000)@h
2348 + mtspr DBAT1L,r18 /* N.B. 6xx (not 601) have valid */
2349 + mtspr DBAT1U,r21 /* bit in upper BAT register */
2353 + oris r18,r8,0x20000000@h
2354 + oris r21,r11,(KERNELBASE+0x20000000)@h
2355 + mtspr DBAT2L,r18 /* N.B. 6xx (not 601) have valid */
2356 + mtspr DBAT2U,r21 /* bit in upper BAT register */
2359 +#endif /* ndef CONFIG_GEMINI */
2361 + mtspr DBAT0L,r8 /* N.B. 6xx (not 601) have valid */
2362 + mtspr DBAT0U,r11 /* bit in upper BAT register */
2367 /* Unfortunately the APUS specific instructions bloat the
2368 * code so it cannot fit in the 0x100 bytes available. We have
2369 @@ -396,15 +420,6 @@
2370 #endif /* CONFIG_8xx */
2373 -/* Hack for sleep on Core99 machines
2375 -#ifdef CONFIG_POWERMAC
2380 -#endif /* CONFIG_POWERMAC */
2383 * GCC sometimes accesses words at negative offsets from the stack
2384 * pointer, although the SysV ABI says it shouldn't. To cope with
2386 #endif /* CONFIG_GEMINI */
2388 STD_EXCEPTION(0x100, Reset, UnknownException)
2393 STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
2394 @@ -636,26 +651,7 @@
2395 STD_EXCEPTION(0xd00, SingleStep, SingleStepException)
2397 STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
2399 -#ifndef CONFIG_ALTIVEC
2400 STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
2403 - * The Altivec unavailable trap is at 0x0f20. Foo.
2404 - * We effectively remap it to 0x3000.
2409 - addi r3,r1,STACK_FRAME_OVERHEAD
2411 - bl transfer_to_handler
2412 - .long UnknownException
2416 - b AltiVecUnavailable
2417 -#endif /* CONFIG_ALTIVEC */
2421 @@ -1173,24 +1169,9 @@
2422 STD_EXCEPTION(0x2f00, Trap_2f, UnknownException)
2425 -#ifdef CONFIG_ALTIVEC
2426 -AltiVecUnavailable:
2428 - bne load_up_altivec /* if from user, just load it up */
2430 - bl transfer_to_handler /* if from kernel, take a trap */
2431 - .long KernelAltiVec
2434 -/* here are the bits of trap 0xf00 which got displaced */
2438 -#endif /* CONFIG_ALTIVEC */
2440 -#else /* CONFIG_8xx */
2443 -#endif /* CONFIG_8xx */
2447 * This code finishes saving the registers to the exception frame
2448 @@ -1345,7 +1326,11 @@
2449 /* Construct the high word of the PPC-style PTE */
2450 mfsrin r5,r3 /* get segment reg for segment */
2451 rlwinm r5,r5,7,1,24 /* put VSID in 0x7fffff80 bits */
2453 +#ifndef __SMP__ /* do this later for SMP */
2454 oris r5,r5,0x8000 /* set V (valid) bit */
2457 rlwimi r5,r3,10,26,31 /* put in API (abbrev page index) */
2458 /* Get the address of the primary PTE group in the hash table */
2459 .globl hash_page_patch_A
2460 @@ -1457,7 +1442,6 @@
2464 - clrlwi r5,r5,1 /* clear valid bit (0x80000000) */
2465 stw r5,0(r3) /* clear V (valid) bit in PTE */
2468 @@ -1509,7 +1493,6 @@
2476 @@ -1649,145 +1632,24 @@
2477 #endif /* __SMP__ */
2480 -#ifdef CONFIG_ALTIVEC
2481 -/* Note that the AltiVec support is closely modeled after the FP
2482 - * support. Changes to one are likely to be applicable to the
2486 - * Disable AltiVec for the task which had AltiVec previously,
2487 - * and save its AltiVec registers in its thread_struct.
2488 - * Enables AltiVec for use in the kernel on return.
2489 - * On SMP we know the AltiVec units are free, since we give it up every
2490 - * switch. -- Kumar
2493 - oris r5,r5,MSR_VEC@h
2495 - mtmsr r5 /* enable use of AltiVec now */
2498 - * For SMP, we don't do lazy AltiVec switching because it just gets too
2499 - * horrendously complex, especially when a task switches from one CPU
2500 - * to another. Instead we call giveup_altivec in switch_to.
2503 -#ifndef CONFIG_APUS
2504 - lis r6,-KERNELBASE@h
2506 - lis r6,CYBERBASEp@h
2509 - addis r3,r6,last_task_used_altivec@ha
2510 - lwz r4,last_task_used_altivec@l(r3)
2514 - addi r4,r4,TSS /* want TSS of last_task_used_altivec */
2515 - SAVE_32VR(0,r20,r4)
2519 - lwz r5,PT_REGS(r4)
2521 - lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5)
2523 - andc r4,r4,r20 /* disable altivec for previous task */
2524 - stw r4,_MSR-STACK_FRAME_OVERHEAD(r5)
2526 -#endif /* __SMP__ */
2527 - /* enable use of AltiVec after return */
2528 - oris r23,r23,MSR_VEC@h
2529 - mfspr r5,SPRG3 /* current task's TSS (phys) */
2533 - REST_32VR(0,r20,r5)
2537 - stw r4,last_task_used_altivec@l(r3)
2538 -#endif /* __SMP__ */
2539 - /* restore registers and return */
2545 - REST_4GPRS(3, r21)
2546 - /* we haven't used ctr or xer */
2550 - REST_2GPRS(22, r21)
2551 - lwz r21,GPR21(r21)
2556 - * AltiVec unavailable trap from kernel - print a message, but let
2557 - * the task use AltiVec in the kernel until it returns to user mode.
2561 - oris r3,r3,MSR_VEC@h
2562 - stw r3,_MSR(r1) /* enable use of AltiVec after return */
2565 - mr r4,r2 /* current */
2569 -87: .string "AltiVec used in kernel (task=%p, pc=%x) \n"
2573 - * giveup_altivec(tsk)
2574 - * Disable AltiVec for the task given as the argument,
2575 - * and save the AltiVec registers in its thread_struct.
2576 - * Enables AltiVec for use in the kernel on return.
2579 - .globl giveup_altivec
2582 - oris r5,r5,MSR_VEC@h
2584 - mtmsr r5 /* enable use of AltiVec now */
2587 - beqlr- /* if no previous owner, done */
2588 - addi r3,r3,TSS /* want TSS of task */
2589 - lwz r5,PT_REGS(r3)
2591 - SAVE_32VR(0, r4, r3)
2596 - lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5)
2598 - andc r4,r4,r3 /* disable AltiVec for previous task */
2599 - stw r4,_MSR-STACK_FRAME_OVERHEAD(r5)
2603 - lis r4,last_task_used_altivec@ha
2604 - stw r5,last_task_used_altivec@l(r4)
2605 -#endif /* __SMP__ */
2606 +#else /* CONFIG_8xx */
2610 -#endif /* CONFIG_ALTIVEC */
2611 +#endif /* CONFIG_8xx */
2614 - addi r4, r3, mmu_off_return - _start
2615 + addi r4, r3, __secondary_start - _start
2617 andi. r0,r3,MSR_DR|MSR_IR /* MMU enabled? */
2621 + ori r3,r3,MSR_DR|MSR_IR
2622 + xori r3,r3,MSR_DR|MSR_IR
2631 * This code is jumped to from the startup code to copy
2632 @@ -1798,6 +1660,10 @@
2633 addi r9,r9,0x6f58 /* translate source addr */
2634 cmpw r31,r9 /* (we have to on chrp) */
2636 +#if 0 // still needed ? breaks on me if I don't disable this
2637 + rlwinm r4,r4,0,8,31 /* translate source address */
2638 + add r4,r4,r3 /* to region mapped with BATs */
2640 7: addis r9,r26,klimit@ha /* fetch klimit */
2641 lwz r25,klimit@l(r9)
2642 addis r25,r25,-KERNELBASE@h
2643 @@ -1845,12 +1711,6 @@
2647 -#else /* CONFIG_8xx */
2651 -#endif /* CONFIG_8xx */
2655 ori r1,r0,MSR_DR|MSR_IR
2656 @@ -1913,7 +1773,7 @@
2658 rlwinm r9,r9,16,16,31
2660 - beq 6f /* not needed for 601 */
2661 + beq 4f /* not needed for 601 */
2663 andi. r0,r11,HID0_DCE
2664 ori r11,r11,HID0_ICE|HID0_DCE
2665 @@ -1930,24 +1790,14 @@
2666 cmpi 0,r9,4 /* check for 604 */
2667 cmpi 1,r9,9 /* or 604e */
2668 cmpi 2,r9,10 /* or mach5 */
2669 - cmpi 3,r9,8 /* check for 750 (G3) */
2670 - cmpi 4,r9,12 /* or 7400 (G4) */
2674 ori r11,r11,HID0_SIED|HID0_BHTE /* for 604[e], enable */
2676 ori r11,r11,HID0_BTCD
2681 - ori r11,r11,HID0_SGE|HID0_BHTE|HID0_BTIC|HID0_ABE /* for g3/g4, enable */
2682 - rlwinm r11,r11,0,23,21 /* clear HID0_SPD */
2685 5: mtspr HID0,r11 /* superscalar exec & br history tbl */
2688 #endif /* CONFIG_8xx */
2690 /* if we're the second cpu stack and r2 are different
2691 @@ -2028,10 +1878,10 @@
2692 li r3,MSR_KERNEL & ~(MSR_IR|MSR_DR)
2697 /* Load up the kernel context */
2699 + SYNC /* Force all PTE updates to finish */
2700 tlbia /* Clear all TLB entries */
2701 sync /* wait for tlbia/tlbie to finish */
2703 @@ -2088,7 +1938,6 @@
2704 #endif /* __SMP__ */
2708 rfi /* enable MMU and jump to start_kernel */
2711 @@ -2126,11 +1975,9 @@
2713 #endif /* SHOW_SYSCALLS */
2714 cmpi 0,r0,0x7777 /* Special case for 'sys_sigreturn' */
2715 - cmpi 1,r0,0x6666 /* Special case for 'sys_rt_sigreturn' */
2718 - lwz r10,TASK_PTRACE(r2)
2719 - andi. r10,r10,PT_TRACESYS
2720 + lwz r10,TASK_FLAGS(r2)
2721 + andi. r10,r10,PF_TRACESYS
2723 cmpli 0,r0,NR_syscalls
2725 @@ -2175,12 +2022,6 @@
2727 10: addi r3,r1,STACK_FRAME_OVERHEAD
2729 - cmpi 0,r3,0 /* Check for restarted system call */
2732 -/* sys_rt_sigreturn */
2733 -16: addi r3,r1,STACK_FRAME_OVERHEAD
2734 - bl sys_rt_sigreturn
2735 cmpi 0,r3,0 /* Check for restarted system call */
2738 @@ -2273,9 +2114,6 @@
2739 mflr r20 /* Return to switch caller */
2741 li r0,MSR_FP /* Disable floating-point */
2742 -#ifdef CONFIG_ALTIVEC
2743 - oris r0,r0,MSR_VEC@h
2744 -#endif /* CONFIG_ALTIVEC */
2748 @@ -2589,38 +2427,6 @@
2752 - * Copy a whole page. We use the dcbz instruction on the destination
2753 - * to reduce memory traffic (it eliminates the unnecessary reads of
2754 - * the destination into cache). This requires that the destination
2758 - li r0,4096/CACHE_LINE_SIZE
2784 * Flush entries from the hash table with VSIDs in the range
2787 @@ -2798,6 +2604,7 @@
2790 lwz r4,rtas_data@l(r4)
2791 + addis r4,r4,-KERNELBASE@h
2792 lis r6,1f@ha /* physical return address for rtas */
2794 addis r6,r6,-KERNELBASE@h
2795 @@ -2817,7 +2624,6 @@
2801 1: addis r9,r1,-KERNELBASE@h
2802 lwz r8,20(r9) /* get return address */
2803 @@ -2826,7 +2632,6 @@
2808 rfi /* return to caller */
2809 #endif /* CONFIG_8xx */
2811 @@ -2851,6 +2656,30 @@
2814 #endif /* CONFIG_8xx */
2817 + * We put a few things here that have to be page-aligned.
2818 + * This stuff goes at the beginning of the data segment,
2819 + * which is page-aligned.
2824 + .globl empty_zero_page
2828 + .globl swapper_pg_dir
2833 + * This space gets a copy of optional info passed to us by the bootstrap
2834 + * Used to pass parameters into the kernel like root=/dev/sda1, etc.
2841 * An undocumented "feature" of 604e requires that the v bit
2842 @@ -2895,117 +2724,4 @@
2847 -/* Use the first pair of BAT registers to map the 1st 16MB
2848 - * of RAM to KERNELBASE. From this point on we can't safely
2849 - * call OF any more.
2852 - lis r11,KERNELBASE@h
2854 - rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
2857 - ori r11,r11,4 /* set up BAT registers for 601 */
2858 - li r8,0x7f /* valid, block length = 8MB */
2859 - oris r9,r11,0x800000@h /* set up BAT reg for 2nd 8M */
2860 - oris r10,r8,0x800000@h /* set up BAT reg for 2nd 8M */
2861 - mtspr IBAT0U,r11 /* N.B. 601 has valid bit in */
2862 - mtspr IBAT0L,r8 /* lower BAT register */
2868 - ori r11,r11,BL_8M<<2|0x2 /* set up an 8MB mapping */
2869 - ori r11,r11,0xfe /* set up an 8MB mapping */
2870 - lis r8,CYBERBASEp@h
2872 - addis r8,r8,KERNELBASE@h
2875 - ori r11,r11,BL_256M<<2|0x2 /* set up BAT registers for 604 */
2876 - li r8,2 /* R/W access */
2878 - * If the MMU is off clear the bats. See clear_bat() -- Cort
2880 -#ifndef CONFIG_GEMINI
2882 - * allow secondary cpus to get at all of ram in early bootup
2883 - * since their init_task may be up there -- Cort
2885 - oris r18,r8,0x10000000@h
2886 - oris r21,r11,(KERNELBASE+0x10000000)@h
2887 - mtspr DBAT1L,r18 /* N.B. 6xx (not 601) have valid */
2888 - mtspr DBAT1U,r21 /* bit in upper BAT register */
2892 - oris r18,r8,0x20000000@h
2893 - oris r21,r11,(KERNELBASE+0x20000000)@h
2894 - mtspr DBAT2L,r18 /* N.B. 6xx (not 601) have valid */
2895 - mtspr DBAT2U,r21 /* bit in upper BAT register */
2898 -#endif /* ndef CONFIG_GEMINI */
2900 - mtspr DBAT0L,r8 /* N.B. 6xx (not 601) have valid */
2901 - mtspr DBAT0U,r11 /* bit in upper BAT register */
2907 -#ifdef CONFIG_BOOTX_TEXT
2910 - * setup the display bat prepared for us in prom.c
2915 - lis r8, disp_BATL@h
2916 - ori r8, r8, disp_BATL@l
2919 - lis r11, disp_BATU@h
2920 - ori r11, r11, disp_BATU@l
2926 - rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
2936 - * We put a few things here that have to be page-aligned.
2937 - * This stuff goes at the beginning of the data segment,
2938 - * which is page-aligned.
2943 - .globl empty_zero_page
2947 - .globl swapper_pg_dir
2952 - * This space gets a copy of optional info passed to us by the bootstrap
2953 - * Used to pass parameters into the kernel like root=/dev/sda1, etc.
2960 diff -urN linux.orig/arch/ppc/kernel/irq.c linux/arch/ppc/kernel/irq.c
2961 --- linux.orig/arch/ppc/kernel/irq.c Sun Mar 25 18:31:48 2001
2962 +++ linux/arch/ppc/kernel/irq.c Thu Jul 11 15:43:29 2002
2965 #include "local_irq.h"
2967 -extern atomic_t ipi_recv;
2968 -extern atomic_t ipi_sent;
2969 -void enable_irq(unsigned int irq_nr);
2970 +extern volatile unsigned long ipi_count;
2971 void enable_irq(unsigned int irq_nr);
2972 void disable_irq(unsigned int irq_nr);
2974 @@ -139,21 +137,20 @@
2978 - p = &irq_desc[irq].action;
2979 - while ((action = *p) != NULL && action->dev_id != dev_id)
2980 - p = &action->next;
2981 - if (action == NULL)
2984 - /* Found it - now free it */
2985 - save_flags(flags);
2987 - *p = action->next;
2988 - if (irq_desc[irq].action == NULL)
2990 - restore_flags(flags);
2991 - irq_kfree(action);
2993 + for (p = &irq_desc[irq].action; (action = *p) != NULL; p = &action->next)
2995 + if (action->dev_id == dev_id)
2997 + /* Found it - now free it */
2998 + save_flags(flags);
3000 + *p = action->next;
3001 + restore_flags(flags);
3002 + irq_kfree(action);
3009 action = (struct irqaction *)
3010 @@ -244,10 +241,8 @@
3013 /* should this be per processor send/receive? */
3014 - /* should this be per processor send/receive? */
3015 - len += sprintf(buf+len, "IPI: (recv/sent) %10lu/%lu\n",
3016 - atomic_read(&ipi_recv), atomic_read(&ipi_sent));
3017 -#endif /* __SMP__ */
3018 + len += sprintf(buf+len, "IPI: %10lu\n", ipi_count);
3020 len += sprintf(buf+len, "BAD: %10u\n", ppc_spurious_interrupts);
3023 @@ -322,14 +317,10 @@
3024 atomic_t global_bh_count;
3025 atomic_t global_bh_lock;
3027 -extern unsigned long *_get_SP(void);
3029 static void show(char * str)
3033 unsigned long *stack;
3035 int cpu = smp_processor_id();
3037 printk("\n%s, CPU %d:\n", str, cpu);
3038 @@ -341,10 +332,6 @@
3039 atomic_read(&global_bh_count),
3040 ppc_local_bh_count[0],
3041 ppc_local_bh_count[1]);
3043 - printk(" CPU: %d last CPU: %d\n", current->processor,current->last_processor);
3044 - print_backtrace (_get_SP());
3046 stack = (unsigned long *) &str;
3047 for (i = 40; i ; i--) {
3048 unsigned long x = *++stack;
3050 printk("<[%08lx]> ", x);
3056 static inline void wait_on_bh(void)
3057 diff -urN linux.orig/arch/ppc/kernel/local_irq.h linux/arch/ppc/kernel/local_irq.h
3058 --- linux.orig/arch/ppc/kernel/local_irq.h Sun Mar 25 18:31:49 2001
3059 +++ linux/arch/ppc/kernel/local_irq.h Thu Jul 11 15:43:29 2002
3062 struct irqaction *action;
3063 struct hw_interrupt_type *ctl;
3067 extern struct irqdesc irq_desc[NR_IRQS];
3068 diff -urN linux.orig/arch/ppc/kernel/mbx_pci.c linux/arch/ppc/kernel/mbx_pci.c
3069 --- linux.orig/arch/ppc/kernel/mbx_pci.c Sun Mar 25 18:31:49 2001
3070 +++ linux/arch/ppc/kernel/mbx_pci.c Thu Jul 11 15:43:29 2002
3074 #include <asm/mbx.h>
3075 -#include <asm/machdep.h>
3080 * This blows......The MBX uses the Tundra QSpan PCI bridge. When
3081 diff -urN linux.orig/arch/ppc/kernel/mbx_setup.c linux/arch/ppc/kernel/mbx_setup.c
3082 --- linux.orig/arch/ppc/kernel/mbx_setup.c Sun Mar 25 18:31:49 2001
3083 +++ linux/arch/ppc/kernel/mbx_setup.c Thu Jul 11 15:43:29 2002
3085 #include <linux/init.h>
3086 #include <linux/blk.h>
3087 #include <linux/ioport.h>
3088 -#include <linux/delay.h>
3090 #include <asm/mmu.h>
3091 #include <asm/processor.h>
3093 #include <asm/ide.h>
3094 #include <asm/mbx.h>
3095 #include <asm/machdep.h>
3096 -#include <asm/keyboard.h>
3097 -#include <asm/8xx_immap.h>
3098 -#include <asm/time.h>
3101 #include "local_irq.h"
3103 static int mbx_set_rtc_time(unsigned long time);
3104 unsigned long mbx_get_rtc_time(void);
3105 void mbx_calibrate_decr(void);
3107 -extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
3108 -extern int pckbd_getkeycode(unsigned int scancode);
3109 -extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
3111 -extern char pckbd_unexpected_up(unsigned char keycode);
3112 -extern void pckbd_leds(unsigned char leds);
3113 -extern void pckbd_init_hw(void);
3114 -extern unsigned char pckbd_sysrq_xlate[128];
3116 extern int mackbd_setkeycode(unsigned int scancode, unsigned int keycode);
3117 extern int mackbd_getkeycode(unsigned int scancode);
3118 extern int mackbd_translate(unsigned char scancode, unsigned char *keycode,
3120 extern void mackbd_leds(unsigned char leds);
3121 extern void mackbd_init_hw(void);
3123 +extern unsigned long loops_per_jiffy;
3125 unsigned long empty_zero_page[1024];
3127 #ifdef CONFIG_BLK_DEV_RAM
3129 ppc_md.kbd_leds = pckbd_leds;
3130 ppc_md.kbd_init_hw = pckbd_init_hw;
3131 #ifdef CONFIG_MAGIC_SYSRQ
3132 - ppc_md.sysrq_xlate = pckbd_sysrq_xlate;
3133 + ppc_md.kbd_sysrq_xlate = pckbd_sysrq_xlate;
3137 diff -urN linux.orig/arch/ppc/kernel/misc.S linux/arch/ppc/kernel/misc.S
3138 --- linux.orig/arch/ppc/kernel/misc.S Sun Mar 25 18:37:30 2001
3139 +++ linux/arch/ppc/kernel/misc.S Thu Jul 11 15:43:29 2002
3140 @@ -125,33 +125,12 @@
3144 -#if defined(CONFIG_SMP)
3147 - rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */
3150 - lis r9,hash_table_lock@h
3151 - ori r9,r9,hash_table_lock@l
3152 - lwz r8,PROCESSOR(r2)
3160 -#endif /* CONFIG_SMP */
3168 - stw r0,0(r9) /* clear hash_table_lock */
3174 @@ -159,32 +138,11 @@
3175 * Flush MMU TLB for a particular address
3178 -#if defined(CONFIG_SMP)
3181 - rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */
3184 - lis r9,hash_table_lock@h
3185 - ori r9,r9,hash_table_lock@l
3186 - lwz r8,PROCESSOR(r2)
3194 -#endif /* CONFIG_SMP */
3202 - stw r0,0(r9) /* clear hash_table_lock */
3208 @@ -317,8 +275,10 @@
3209 stwcx. r5,0,r3 /* Update with new value */
3210 bne- 10b /* Retry if "reservation" (i.e. lock) lost */
3214 + cmpi 0,r5,0 /* Return 'true' IFF 0 */
3219 _GLOBAL(atomic_clear_mask)
3221 @@ -354,10 +314,8 @@
3222 * The *_ns versions don't do byte-swapping.
3232 @@ -365,10 +323,8 @@
3243 @@ -376,10 +332,8 @@
3254 @@ -387,10 +341,8 @@
3265 @@ -398,10 +350,8 @@
3276 @@ -409,10 +359,8 @@
3287 @@ -421,10 +369,8 @@
3298 @@ -433,10 +379,8 @@
3309 @@ -444,10 +388,8 @@
3320 @@ -455,10 +397,8 @@
3331 @@ -466,59 +406,48 @@
3335 - * Extended precision shifts.
3337 - * Updated to be valid for shift counts from 0 to 63 inclusive.
3339 + * Extended precision shifts
3341 * R3/R4 has 64 bit value
3342 * R5 has shift count
3345 - * ashrdi3: arithmetic right shift (sign propagation)
3346 - * lshrdi3: logical right shift
3347 - * ashldi3: left shift
3348 + * ashrdi3: XXXYYY/ZZZAAA -> SSSXXX/YYYZZZ
3349 + * ashldi3: XXXYYY/ZZZAAA -> YYYZZZ/AAA000
3350 + * lshrdi3: XXXYYY/ZZZAAA -> 000XXX/YYYZZZ
3354 - srw r4,r4,r5 # LSW = count > 31 ? 0 : LSW >> count
3355 - addi r7,r5,32 # could be xori, or addi with -32
3356 - slw r6,r3,r6 # t1 = count > 31 ? 0 : MSW << (32-count)
3357 - rlwinm r8,r7,0,32 # t3 = (count < 32) ? 32 : 0
3358 - sraw r7,r3,r7 # t2 = MSW >> (count-32)
3359 - or r4,r4,r6 # LSW |= t1
3360 - slw r7,r7,r8 # t2 = (count < 32) ? 0 : t2
3361 - sraw r3,r3,r5 # MSW = MSW >> count
3362 - or r4,r4,r7 # LSW |= t2
3365 + slw r7,r3,r6 /* isolate YYY */
3366 + srw r4,r4,r5 /* isolate ZZZ */
3367 + or r4,r4,r7 /* YYYZZZ */
3368 + sraw r3,r3,r5 /* SSSXXX */
3373 - slw r3,r3,r5 # MSW = count > 31 ? 0 : MSW << count
3374 - addi r7,r5,32 # could be xori, or addi with -32
3375 - srw r6,r4,r6 # t1 = count > 31 ? 0 : LSW >> (32-count)
3376 - slw r7,r4,r7 # t2 = count < 32 ? 0 : LSW << (count-32)
3377 - or r3,r3,r6 # MSW |= t1
3378 - slw r4,r4,r5 # LSW = LSW << count
3379 - or r3,r3,r7 # MSW |= t2
3382 + srw r7,r4,r6 /* isolate ZZZ */
3383 + slw r4,r4,r5 /* AAA000 */
3384 + slw r3,r3,r5 /* YYY--- */
3385 + or r3,r3,r7 /* YYYZZZ */
3390 - srw r4,r4,r5 # LSW = count > 31 ? 0 : LSW >> count
3391 - addi r7,r5,32 # could be xori, or addi with -32
3392 - slw r6,r3,r6 # t1 = count > 31 ? 0 : MSW << (32-count)
3393 - srw r7,r3,r7 # t2 = count < 32 ? 0 : MSW >> (count-32)
3394 - or r4,r4,r6 # LSW |= t1
3395 - srw r3,r3,r5 # MSW = MSW >> count
3396 - or r4,r4,r7 # LSW |= t2
3399 + slw r7,r3,r6 /* isolate YYY */
3400 + srw r4,r4,r5 /* isolate ZZZ */
3401 + or r4,r4,r7 /* YYYZZZ */
3402 + srw r3,r3,r5 /* 000XXX */
3416 mr r3,r1 /* Close enough */
3417 @@ -563,14 +492,6 @@
3418 isync /* Handle erratas in some cases */
3431 Copyright © 1997-1998 by PowerLogix R & D, Inc.
3432 @@ -592,17 +513,6 @@
3434 Thur, Dec. 12, 1998.
3435 - First public release, contributed by PowerLogix.
3437 - Sat, Aug. 7, 1999.
3438 - - Terry: Made sure code disabled interrupts before running. (Previously
3439 - it was assumed interrupts were already disabled).
3440 - - Terry: Updated for tentative G4 support. 4MB of memory is now flushed
3441 - instead of 2MB. (Prob. only 3 is necessary).
3442 - - Terry: Updated for workaround to HID0[DPM] processor bug
3443 - during global invalidates.
3445 - Thu, July 13, 2000.
3446 - - Terry: Added isync to correct for an errata.
3448 Author: Terry Greeniaus (tgree@phys.ualberta.ca)
3449 Please e-mail updates to this file to me, thanks!
3450 @@ -641,94 +551,80 @@
3451 causes cache pushes from the L1 cache to go to the L2 cache
3452 instead of to main memory.
3455 - * Summary: this procedure ignores the L2I bit in the value passed in,
3456 - * flushes the cache if it was already enabled, always invalidates the
3457 - * cache, then enables the cache if the L2E bit is set in the value
3463 - /* Make sure this is a 750 or 7400 chip */
3464 + /* Make sure this is a 750 chip */
3466 rlwinm r4,r4,16,16,31
3468 - cmpwi cr1,r4,0x000c
3472 - /* Turn off interrupts and data relocation. */
3473 - mfmsr r7 /* Save MSR in r7 */
3474 - rlwinm r4,r7,0,17,15
3475 - rlwinm r4,r4,0,28,26 /* Turn off DR bit */
3482 + /* Get the current enable bit of the L2CR into r4 */
3486 + /* See if we want to perform a global inval this time. */
3487 + rlwinm r6,r3,0,10,10 /* r6 contains the new invalidate bit */
3488 + rlwinm. r5,r3,0,0,0 /* r5 contains the new enable bit */
3489 + rlwinm r3,r3,0,11,9 /* Turn off the invalidate bit */
3490 + rlwimi r3,r4,0,0,0 /* Keep the enable bit the same as it was. */
3491 + bne dontDisableCache /* Only disable the cache if L2CRApply
3492 + has the enable bit off */
3495 + /* Disable the cache. First, we turn off interrupts.
3496 + An interrupt while we are flushing the cache could bring
3497 + in data which may not get properly flushed. */
3498 + rlwinm r4,r7,0,17,15 /* Turn off EE bit */
3503 - /* Get the current enable bit of the L2CR into r4 */
3506 - /* Tweak some bits */
3507 - rlwinm r5,r3,0,0,0 /* r5 contains the new enable bit */
3508 - rlwinm r3,r3,0,11,9 /* Turn off the invalidate bit */
3509 - rlwinm r3,r3,0,1,31 /* Turn off the enable bit */
3511 - /* Check to see if we need to flush */
3512 - rlwinm. r4,r4,0,0,0
3515 - /* Flush the cache. First, read the first 4MB of memory (physical) to
3516 - * put new data in the cache. (Actually we only need
3517 - * the size of the L2 cache plus the size of the L1 cache, but 4MB will
3518 - * cover everything just to be safe).
3521 - /**** Might be a good idea to set L2DO here - to prevent instructions
3522 - from getting into the cache. But since we invalidate
3523 - the next time we enable the cache it doesn't really matter.
3528 + Now, read the first 2MB of memory to put new data in the cache.
3529 + (Actually we only need the size of the L2 cache plus the size
3530 + of the L1 cache, but 2MB will cover everything just to be safe).
3537 - addi r4,r4,32 /* Go to start of next cache line */
3538 + lis r4,KERNELBASE@h
3540 + addi r4,r4,0x0020 /* Go to start of next cache line */
3543 - /* Now, flush the first 4MB of memory */
3545 + /* Now, flush the first 2MB of memory */
3549 + lis r4,KERNELBASE@h
3553 - addi r4,r4,32 /* Go to start of next cache line */
3557 - /* Set up the L2CR configuration bits (and switch L2 off) */
3559 + addi r4,r4,0x0020 /* Go to start of next cache line */
3562 + /* Turn off the L2CR enable bit. */
3563 + rlwinm r3,r3,0,1,31
3566 + /* Set up the L2CR configuration bits */
3571 - /* Before we perform the global invalidation, we must disable dynamic
3572 - * power management via HID0[DPM] to work around a processor bug where
3573 - * DPM can possibly interfere with the state machine in the processor
3574 - * that invalidates the L2 cache tags.
3576 - mfspr r8,HID0 /* Save HID0 in r8 */
3577 - rlwinm r4,r8,0,12,10 /* Turn off HID0[DPM] */
3579 - mtspr HID0,r4 /* Disable DPM */
3580 + /* Reenable interrupts if necessary. */
3588 /* Perform a global invalidation */
3593 - isync /* For errata */
3595 /* Wait for the invalidation to complete */
3597 @@ -740,38 +636,25 @@
3601 - /* Restore HID0[DPM] to whatever it was before */
3607 /* See if we need to enable the cache */
3612 /* Enable the cache */
3617 - /* Restore MSR (restores EE and DR bits to original state) */
3627 /* Make sure this is a 750 chip */
3631 - cmpwi cr1,r3,0x000c
3632 + rlwinm r3,r3,16,16,31
3638 /* Return the L2CR contents */
3641 @@ -779,6 +662,16 @@
3642 /* --- End of PowerLogix code ---
3657 * These are used in the alignment trap handler when emulating
3658 @@ -1036,7 +929,11 @@
3659 .long sys_getresuid /* 165 */
3660 .long sys_query_module
3663 .long sys_nfsservctl
3665 + .long sys_ni_syscall
3668 .long sys_getresgid /* 170 */
3670 @@ -1058,18 +955,4 @@
3671 .long sys_ni_syscall /* streams1 */
3672 .long sys_ni_syscall /* streams2 */
3674 - .long sys_ni_syscall /* 190 */ /* MacOnLinux - old */
3675 - .long sys_ni_syscall /* 191 */ /* Unused */
3676 - .long sys_ni_syscall /* 192 - reserved - mmap2 */
3677 - .long sys_ni_syscall /* 193 - reserved - truncate64 */
3678 - .long sys_ni_syscall /* 194 - reserved - ftruncate64 */
3679 - .long sys_ni_syscall /* 195 - reserved - stat64 */
3680 - .long sys_ni_syscall /* 196 - reserved - lstat64 */
3681 - .long sys_ni_syscall /* 197 - reserved - fstat64 */
3682 - .long sys_pciconfig_read /* 198 */
3683 - .long sys_pciconfig_write /* 199 */
3684 - .long sys_pciconfig_iobase /* 200 */
3685 - .long sys_ni_syscall /* 201 - reserved - MacOnLinux - new */
3686 - .rept NR_syscalls-201
3687 - .long sys_ni_syscall
3689 + .space (NR_syscalls-183)*4
3690 diff -urN linux.orig/arch/ppc/kernel/mk_defs.c linux/arch/ppc/kernel/mk_defs.c
3691 --- linux.orig/arch/ppc/kernel/mk_defs.c Fri Nov 2 17:39:05 2001
3692 +++ linux/arch/ppc/kernel/mk_defs.c Thu Jul 11 15:43:29 2002
3694 * #defines from the assembly-language output.
3697 -#include <linux/config.h>
3698 +#include <stddef.h>
3699 #include <linux/signal.h>
3700 #include <linux/sched.h>
3701 #include <linux/kernel.h>
3703 #include <asm/page.h>
3704 #include <asm/pgtable.h>
3705 #include <asm/processor.h>
3706 +#include <asm/pf-compat.h>
3708 #define DEFINE(sym, val) \
3709 asm volatile("\n#define\t" #sym "\t%0" : : "i" (val))
3711 DEFINE(PGD, offsetof(struct mm_struct, pgd));
3712 DEFINE(LAST_SYSCALL, offsetof(struct thread_struct, last_syscall));
3713 DEFINE(PT_REGS, offsetof(struct thread_struct, regs));
3714 - DEFINE(PT_TRACESYS, PT_TRACESYS);
3715 + DEFINE(PF_TRACESYS, PF_TRACESYS);
3716 DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
3717 - DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));
3718 DEFINE(NEED_RESCHED, offsetof(struct task_struct, need_resched));
3719 DEFINE(TSS_FPR0, offsetof(struct thread_struct, fpr[0]));
3720 DEFINE(TSS_FPSCR, offsetof(struct thread_struct, fpscr));
3721 -#ifdef CONFIG_ALTIVEC
3722 - DEFINE(TSS_VR0, offsetof(struct thread_struct, vr[0]));
3723 - DEFINE(TSS_VRSAVE, offsetof(struct thread_struct, vrsave));
3724 - DEFINE(TSS_VSCR, offsetof(struct thread_struct, vscr));
3725 -#endif /* CONFIG_ALTIVEC */
3727 /* Interrupt register frame */
3728 DEFINE(TASK_UNION_SIZE, sizeof(union task_union));
3729 DEFINE(STACK_FRAME_OVERHEAD, STACK_FRAME_OVERHEAD);
3730 diff -urN linux.orig/arch/ppc/kernel/open_pic.c linux/arch/ppc/kernel/open_pic.c
3731 --- linux.orig/arch/ppc/kernel/open_pic.c Sun Mar 25 18:31:49 2001
3732 +++ linux/arch/ppc/kernel/open_pic.c Thu Jul 11 15:43:29 2002
3737 - * Common support routines for platforms with an OpenPIC interrupt controller
3741 #include <linux/stddef.h>
3742 #include <linux/init.h>
3743 #include <linux/sched.h>
3744 #include <linux/signal.h>
3745 #include <linux/openpic.h>
3746 #include <asm/irq.h>
3747 -#include <asm/processor.h>
3748 #include "open_pic.h"
3751 -extern volatile unsigned char *chrp_int_ack_special;
3753 -void open_pic_do_IRQ(struct pt_regs *regs, int cpu, int isfake)
3756 - int openpic_eoi_done = 0;
3760 - unsigned int loops = 1000000;
3761 - while (test_bit(0, &global_irq_lock)) {
3762 - if (smp_processor_id() == global_irq_holder) {
3763 - printk("uh oh, interrupt while we hold global irq lock!\n");
3769 - if (loops-- == 0) {
3770 - printk("do_IRQ waiting for irq lock (holder=%d)\n", global_irq_holder);
3777 +void openpic_ipi_action(int cpl, void *dev_id, struct pt_regs *regs)
3779 + smp_message_recv(cpl-OPENPIC_VEC_IPI);
3781 #endif /* __SMP__ */
3783 - irq = openpic_irq(smp_processor_id());
3784 - /* make sure open_pic.irq_offset is set to something!
3785 - * do we really need the _MACH_Pmac test??
3787 - if (!(_machine == _MACH_Pmac) && (irq == open_pic.irq_offset))
3790 - * This magic address generates a PCI IACK cycle.
3792 - * This should go in the above mask/ack code soon. -- Cort
3794 - if ( chrp_int_ack_special )
3795 - irq = *chrp_int_ack_special;
3796 -#ifndef CONFIG_PMAC
3798 - irq = i8259_irq(0);
3801 - * Acknowledge as soon as possible to allow i8259
3802 - * interrupt nesting */
3803 - openpic_eoi(smp_processor_id());
3804 - openpic_eoi_done = 1;
3806 - if (irq == OPENPIC_VEC_SPURIOUS)
3809 - * Spurious interrupts should never be
3812 - ppc_spurious_interrupts++;
3813 - openpic_eoi_done = 1;
3819 - printk(KERN_DEBUG "Bogus interrupt %d from PC = %lx\n",
3821 - ppc_spurious_interrupts++;
3825 - ppc_irq_dispatch_handler( regs, irq );
3828 - if (!openpic_eoi_done)
3829 - openpic_eoi(smp_processor_id());
3830 +void chrp_mask_and_ack_irq(unsigned int irq_nr)
3832 + if ((_machine != _MACH_gemini) && is_8259_irq(irq_nr))
3833 + i8259_pic.mask_and_ack(irq_nr);
3837 -void openpic_ipi_action(int cpl, void *dev_id, struct pt_regs *regs)
3838 +static void chrp_mask_irq(unsigned int irq_nr)
3840 - smp_message_recv(cpl-OPENPIC_VEC_IPI);
3841 + if ((_machine != _MACH_gemini) && is_8259_irq(irq_nr))
3842 + i8259_pic.disable(irq_nr);
3844 + openpic_disable_irq(irq_nr-open_pic.irq_offset);
3846 -#endif /* __SMP__ */
3848 +static void chrp_unmask_irq(unsigned int irq_nr)
3850 + if ((_machine != _MACH_gemini) && is_8259_irq(irq_nr))
3851 + i8259_pic.enable(irq_nr);
3853 + openpic_enable_irq(irq_nr-open_pic.irq_offset);
3856 struct hw_interrupt_type open_pic = {
3861 - openpic_enable_irq,
3862 - openpic_disable_irq,
3863 - /* Theorically, the mask&ack should be NULL for OpenPIC. However, doing
3864 - * so shows tons of bogus interrupts coming in.
3865 - * This problem is apparently due to the common code always calling
3866 - * unmask(). I apparently (need more test) fixed it in the 2.4 new IRQ
3867 - * management by cleanly implementing the handler's end() function, so
3868 - * neither mask nor unmask are needed. In the meantime, the fix below will
3869 - * work for 2.2 -Benh
3871 - * Hopefully this will fix my bogus interrups on MTX
3872 - * I merged everthing together so we don't have the same code in three
3873 - * places. This might cause stability problems, but I'd rather
3874 - * get it right once than three different times because someone forgot
3875 - * to make the same change to PReP or something --Troy
3877 - openpic_disable_irq,
3880 + chrp_mask_and_ack_irq,
3883 diff -urN linux.orig/arch/ppc/kernel/open_pic.h linux/arch/ppc/kernel/open_pic.h
3884 --- linux.orig/arch/ppc/kernel/open_pic.h Sun Mar 25 18:31:49 2001
3885 +++ linux/arch/ppc/kernel/open_pic.h Thu Jul 11 15:43:29 2002
3888 extern struct hw_interrupt_type open_pic;
3890 -void open_pic_do_IRQ(struct pt_regs *regs, int cpu, int isfake);
3891 void openpic_ipi_action(int cpl, void *dev_id, struct pt_regs *regs);
3892 void openpic_enable_IPI(u_int ipi);
3893 void do_openpic_setup_cpu(void);
3894 diff -urN linux.orig/arch/ppc/kernel/openpic.c linux/arch/ppc/kernel/openpic.c
3895 --- linux.orig/arch/ppc/kernel/openpic.c Fri Nov 2 17:39:05 2001
3896 +++ linux/arch/ppc/kernel/openpic.c Thu Jul 11 15:43:29 2002
3899 * Fixed up IPI and restructured a bit
3900 * Cort Dougan <cort@ppc.kernel.org>
3902 - * Added initialisation code for Apple Core99 machines, tweaked a few things
3903 - * to avoid bogus interrupts and to make sure the disable function exits with
3904 - * the interrupt actually masked. --BenH
3905 - * Todo: map interrupts to all available CPUs after the ack round
3907 * This file is subject to the terms and conditions of the GNU General Public
3908 * License. See the file COPYING in the main directory of this archive
3911 #include <asm/irq.h>
3912 #include "open_pic.h"
3914 -#include <asm/prom.h>
3917 #define REGISTER_DEBUG
3918 #undef REGISTER_DEBUG
3921 -extern int use_of_interrupt_tree;
3923 +#define OPENPIC_SENSE_POLARITY 0x00800000 /* Undoc'd */
3925 volatile struct OpenPIC *OpenPIC = NULL;
3926 u_int OpenPIC_NumInitSenses __initdata = 0;
3931 -static inline u_int in_le32(volatile u_int *addr)
3932 +static inline u_int ld_le32(volatile u_int *addr)
3940 - val = in_le32(addr);
3941 + val = ld_le32(addr);
3942 #ifdef REGISTER_DEBUG
3943 printk("openpic_read(0x%08x) = 0x%08x\n", (u_int)addr, val);
3947 openpic_setfield(addr, OPENPIC_MASK);
3948 /* wait until it's not in use */
3949 - /* BenH: Is this code really enough ? I would rather check the result
3950 - * and eventually retry ...
3952 while (openpic_read(addr) & OPENPIC_ACTIVITY);
3953 openpic_writefield(addr, mask | OPENPIC_MASK, field | OPENPIC_MASK);
3955 @@ -164,20 +151,7 @@
3957 * Initialize the OpenPIC
3962 - * With BootX, we consider the controller as beeing already initialized by MacOS
3963 - * and we only mask out interrupts.
3964 - * With OF booting, we initialize the interrupts that we find in the device tree,
3965 - * other ones are just masked out.
3966 - * Note: We might want to adjust priorities too.
3969 -/* Not an init func, called on pbook wakeup --BenH */
3972 -openpic_init(int main_pic)
3973 +__initfunc(void openpic_init(int main_pic))
3977 @@ -207,16 +181,13 @@
3978 OPENPIC_FEATURE_LAST_SOURCE_SHIFT) + 1;
3979 printk("OpenPIC Version %s (%d CPUs and %d IRQ sources) at %p\n", version,
3980 NumProcessors, NumSources, OpenPIC);
3981 - /* Apple's OpenPIC is an IBM MPIC without the timer. */
3982 - if (_machine != _MACH_Pmac) {
3983 - timerfreq = openpic_read(&OpenPIC->Global.Timer_Frequency);
3984 - printk("OpenPIC timer frequency is ");
3986 - printk("%d Hz\n", timerfreq);
3988 - printk("not set\n");
3991 + timerfreq = openpic_read(&OpenPIC->Global.Timer_Frequency);
3992 + printk("OpenPIC timer frequency is ");
3994 + printk("%d Hz\n", timerfreq);
3996 + printk("not set\n");
4000 /* Initialize timer interrupts */
4001 @@ -229,60 +200,24 @@
4003 /* Initialize IPI interrupts */
4004 for (i = 0; i < OPENPIC_NUM_IPI; i++) {
4005 - openpic_initipi(i, 10+i, OPENPIC_VEC_IPI+i);
4006 + openpic_initipi(i, 10, OPENPIC_VEC_IPI+i);
4009 - if (_machine != _MACH_Pmac) {
4010 - /* Initialize external interrupts */
4011 - for (i = 0; i < NumSources; i++) {
4012 - /* Enabled, Priority 8 */
4013 - openpic_initirq(i, 8, open_pic.irq_offset+i, 0,
4014 - i < OpenPIC_NumInitSenses ? OpenPIC_InitSenses[i] : 1);
4016 - openpic_mapirq(i, 1<<0);
4019 - /* Prevent any interrupt from occurring during initialisation.
4020 - * Hum... I believe this is not necessary, Apple does that in
4021 - * Darwin's PowerExpress code.
4023 - openpic_set_priority(0, 0xf);
4025 - /* First disable all interrupts and map them to CPU 0 */
4026 - for (i = 0; i < NumSources; i++) {
4027 - openpic_disable_irq(i);
4028 - openpic_mapirq(i, 1<<0);
4031 - /* If we use the device tree, then lookup all interrupts and
4032 - * initialize them according to sense infos found in the tree
4034 - if (use_of_interrupt_tree) {
4035 - struct device_node* np = find_all_nodes();
4038 - pri = strcmp(np->name, "programmer-switch") ? 2 : 7;
4039 - for (j=0;j<np->n_intrs;j++) {
4040 - openpic_initirq( np->intrs[j].line,
4042 - np->intrs[j].line,
4044 - np->intrs[j].sense);
4045 - irq_desc[np->intrs[j].line].level = np->intrs[j].sense;
4050 - /* Fixme: read level value from controller */
4051 - printk("openpic: WARNING, openpic running without interrupt tree\n");
4053 + /* Initialize external interrupts */
4054 + for (i = 0; i < NumSources; i++) {
4055 + /* Enabled, Priority 8 */
4056 + openpic_initirq(i, 8, open_pic.irq_offset+i, 0,
4057 + i < OpenPIC_NumInitSenses ? OpenPIC_InitSenses[i] : 1);
4059 + openpic_mapirq(i, 1<<0);
4063 /* Initialize the spurious interrupt */
4064 openpic_set_spurious(OPENPIC_VEC_SPURIOUS);
4066 /* Gemini has no i8259 */
4067 - if (( _machine != _MACH_gemini ) && (_machine != _MACH_Pmac)) {
4068 + if ( _machine != _MACH_gemini )
4070 /* SIOint (8259 cascade) is special */
4071 openpic_initirq(0, 8, open_pic.irq_offset, 1, 1);
4072 openpic_mapirq(0, 1<<0);
4073 @@ -292,14 +227,6 @@
4075 openpic_set_priority(0, 0);
4076 openpic_disable_8259_pass_through();
4078 - /* We ack pending interrupts to avoid blocking them */
4079 - if (_machine == _MACH_Pmac) {
4080 - for (i = 0; i < NumSources; i++) {
4081 - (void)openpic_irq(0);
4088 @@ -311,10 +238,6 @@
4090 openpic_setfield(&OpenPIC->Global.Global_Configuration0,
4091 OPENPIC_CONFIG_RESET);
4092 - /* Wait for reset to complete */
4093 - while(openpic_readfield(&OpenPIC->Global.Global_Configuration0,
4094 - OPENPIC_CONFIG_RESET))
4102 openpic_write(&OpenPIC->THIS_CPU.EOI, 0);
4103 - (void)openpic_read(&OpenPIC->THIS_CPU.EOI);
4107 @@ -465,12 +387,12 @@
4109 for ( i = 0; i < OPENPIC_NUM_IPI ; i++ )
4110 openpic_enable_IPI(i);
4113 /* let the openpic know we want intrs */
4114 for ( i = 0; i < NumSources ; i++ )
4115 openpic_mapirq(i, openpic_read(&OpenPIC->Source[i].Destination)
4116 | (1<<smp_processor_id()) );
4119 openpic_set_priority(smp_processor_id(), 0);
4122 @@ -506,43 +428,14 @@
4124 void openpic_enable_irq(u_int irq)
4126 - /* on SMP, we get IPI vector numbers here, we should handle them
4127 - * or at least ignore them.
4129 - if (irq < 0 || irq >= NumSources)
4131 + check_arg_irq(irq);
4132 openpic_clearfield(&OpenPIC->Source[irq].Vector_Priority, OPENPIC_MASK);
4133 - /* make sure mask gets to controller before we return to user */
4136 - } while(openpic_readfield(&OpenPIC->Source[irq].Vector_Priority,
4140 -u_int openpic_get_enable(u_int irq)
4142 - if (irq < 0 || irq >= NumSources)
4144 - return !openpic_readfield(&OpenPIC->Source[irq].Vector_Priority,
4148 void openpic_disable_irq(u_int irq)
4152 - /* on SMP, we get IPI vector numbers here, we should handle them
4153 - * or at least ignore them.
4155 - if (irq < 0 || irq >= NumSources)
4157 + check_arg_irq(irq);
4158 openpic_setfield(&OpenPIC->Source[irq].Vector_Priority, OPENPIC_MASK);
4159 - /* make sure mask gets to controller before we return to user */
4161 - mb(); /* sync is probably useless here */
4162 - vp = openpic_readfield(&OpenPIC->Source[irq].Vector_Priority,
4163 - OPENPIC_MASK | OPENPIC_ACTIVITY);
4164 - } while((vp & OPENPIC_ACTIVITY) && !(vp & OPENPIC_MASK));
4168 @@ -561,11 +454,10 @@
4170 openpic_safe_writefield(&OpenPIC->Source[irq].Vector_Priority,
4171 OPENPIC_PRIORITY_MASK | OPENPIC_VECTOR_MASK |
4172 - OPENPIC_POLARITY_MASK | OPENPIC_SENSE_MASK,
4173 + OPENPIC_SENSE_POLARITY | OPENPIC_SENSE_LEVEL,
4174 (pri << OPENPIC_PRIORITY_SHIFT) | vec |
4175 - (pol ? OPENPIC_POLARITY_POSITIVE :
4176 - OPENPIC_POLARITY_NEGATIVE) |
4177 - (sense ? OPENPIC_SENSE_LEVEL : OPENPIC_SENSE_EDGE));
4178 + (pol ? OPENPIC_SENSE_POLARITY : 0) |
4179 + (sense ? OPENPIC_SENSE_LEVEL : 0));
4184 OPENPIC_SENSE_LEVEL,
4185 (sense ? OPENPIC_SENSE_LEVEL : 0));
4188 #ifdef CONFIG_PMAC_PBOOK
4189 static u32 save_ipi_vp[OPENPIC_NUM_IPI];
4190 static u32 save_irq_src_vp[OPENPIC_MAX_SOURCES];
4191 diff -urN linux.orig/arch/ppc/kernel/pci.c linux/arch/ppc/kernel/pci.c
4192 --- linux.orig/arch/ppc/kernel/pci.c Sun Mar 25 18:31:48 2001
4193 +++ linux/arch/ppc/kernel/pci.c Thu Jul 11 15:43:29 2002
4195 #include <linux/init.h>
4196 #include <linux/config.h>
4197 #include <linux/openpic.h>
4198 -#include <linux/capability.h>
4199 -#include <linux/sched.h>
4200 -#include <linux/errno.h>
4202 #include <asm/processor.h>
4204 #include <asm/prom.h>
4205 #include <asm/pci-bridge.h>
4206 -#include <asm/pci.h>
4207 #include <asm/residual.h>
4208 #include <asm/byteorder.h>
4209 #include <asm/irq.h>
4210 #include <asm/gg2.h>
4211 -#include <asm/uaccess.h>
4217 for (; node != 0;node = node->sibling) {
4218 class_code = (unsigned int *) get_property(node, "class-code", 0);
4219 - if(class_code && (*class_code >> 8) == PCI_CLASS_BRIDGE_PCI)
4220 + if((*class_code >> 8) == PCI_CLASS_BRIDGE_PCI)
4221 fix_intr(node->child, dev);
4222 reg = (unsigned int *) get_property(node, "reg", 0);
4223 if (reg == 0 || ((reg[0] >> 8) & 0xff) != dev->devfn)
4224 @@ -110,156 +105,3 @@
4231 -pci_dev_io_base(unsigned char bus, unsigned char devfn, int physical)
4233 - if (!ppc_md.pci_dev_io_base) {
4234 - /* Please, someone fix this for non-pmac machines, we
4235 - * need either the virtual or physical PCI IO base
4239 - return ppc_md.pci_dev_io_base(bus, devfn, physical);
4243 -pci_dev_mem_base(unsigned char bus, unsigned char devfn)
4245 - /* Default memory base is 0 (1:1 mapping) */
4246 - if (!ppc_md.pci_dev_mem_base) {
4247 - /* Please, someone fix this for non-pmac machines.*/
4250 - return ppc_md.pci_dev_mem_base(bus, devfn);
4253 -/* Returns the root-bridge number (Uni-N number) of a device */
4255 -pci_dev_root_bridge(unsigned char bus, unsigned char devfn)
4257 - /* Defaults to 0 */
4258 - if (!ppc_md.pci_dev_root_bridge)
4260 - return ppc_md.pci_dev_root_bridge(bus, devfn);
4264 - * Those syscalls are derived from the Alpha versions, they
4265 - * allow userland apps to retreive the per-device iobase and
4266 - * mem-base. They also provide wrapper for userland to do
4267 - * config space accesses.
4268 - * The "host_number" returns the number of the Uni-N sub bridge
4272 -sys_pciconfig_read(unsigned long bus, unsigned long dfn,
4273 - unsigned long off, unsigned long len,
4274 - unsigned char *buf)
4276 - unsigned char ubyte;
4277 - unsigned short ushort;
4278 - unsigned int uint;
4281 - if (!capable(CAP_SYS_ADMIN))
4283 - if (!pcibios_present())
4288 - err = pcibios_read_config_byte(bus, dfn, off, &ubyte);
4289 - put_user(ubyte, buf);
4292 - err = pcibios_read_config_word(bus, dfn, off, &ushort);
4293 - put_user(ushort, (unsigned short *)buf);
4296 - err = pcibios_read_config_dword(bus, dfn, off, &uint);
4297 - put_user(uint, (unsigned int *)buf);
4307 -sys_pciconfig_write(unsigned long bus, unsigned long dfn,
4308 - unsigned long off, unsigned long len,
4309 - unsigned char *buf)
4311 - unsigned char ubyte;
4312 - unsigned short ushort;
4313 - unsigned int uint;
4316 - if (!capable(CAP_SYS_ADMIN))
4318 - if (!pcibios_present())
4323 - err = get_user(ubyte, buf);
4326 - err = pcibios_write_config_byte(bus, dfn, off, ubyte);
4327 - if (err != PCIBIOS_SUCCESSFUL) {
4332 - err = get_user(ushort, (unsigned short *)buf);
4335 - err = pcibios_write_config_word(bus, dfn, off, ushort);
4336 - if (err != PCIBIOS_SUCCESSFUL) {
4341 - err = get_user(uint, (unsigned int *)buf);
4344 - err = pcibios_write_config_dword(bus, dfn, off, uint);
4345 - if (err != PCIBIOS_SUCCESSFUL) {
4356 -/* Provide information on locations of various I/O regions in physical
4357 - * memory. Do this on a per-card basis so that we choose the right
4359 - * Note that the returned IO or memory base is a physical address
4363 -sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
4365 - long result = -EOPNOTSUPP;
4368 - case IOBASE_BRIDGE_NUMBER:
4369 - return (long)pci_dev_root_bridge(bus, devfn);
4370 - case IOBASE_MEMORY:
4371 - return (long)pci_dev_mem_base(bus, devfn);
4373 - result = (long)pci_dev_io_base(bus, devfn, 1);
4375 - result = -EOPNOTSUPP;
4381 diff -urN linux.orig/arch/ppc/kernel/pmac_pci.c linux/arch/ppc/kernel/pmac_pci.c
4382 --- linux.orig/arch/ppc/kernel/pmac_pci.c Fri Nov 2 17:39:05 2001
4383 +++ linux/arch/ppc/kernel/pmac_pci.c Thu Jul 11 15:43:29 2002
4385 struct bridge_data **bridges, *bridge_list;
4388 -struct uninorth_data {
4389 - struct device_node* node;
4390 - volatile unsigned int* cfg_addr;
4391 - volatile unsigned int* cfg_data;
4393 - void* iobase_phys;
4396 -static struct uninorth_data uninorth_bridges[3];
4397 -static int uninorth_count;
4398 -static int uninorth_default = -1;
4402 static void add_bridges(struct device_node *dev, unsigned long *mem_ptr);
4409 -/* This routines figures out on which root bridge a given PCI device
4412 - * WARNING: When passed the address of the bridge itself (11), it must
4413 - * return the AGP bus. Currently, it returns 0, which is by
4414 - * chance the AGP one. We may have to improve that however...
4418 -pmac_pci_dev_root_bridge(unsigned char bus, unsigned char dev_fn)
4420 - struct device_node *node, *bridge_node;
4421 - int bridge = uninorth_default;
4423 - if (uninorth_count == 0)
4425 - if (bus == 0 && PCI_SLOT(dev_fn) < 11)
4428 - /* We look for the OF device corresponding to this bus/devfn pair. If we
4429 - * don't find it, we default to the external PCI */
4430 - bridge_node = NULL;
4431 - node = find_pci_device_OFnode(bus, dev_fn & 0xf8);
4433 - /* note: we don't stop on the first occurrence since we need to go
4434 - * up to the root bridge */
4436 - if (node->type && !strcmp(node->type, "pci")
4437 - && device_is_compatible(node, "uni-north"))
4438 - bridge_node = node;
4439 - node=node->parent;
4442 - if (bridge_node) {
4444 - for (i=0;i<uninorth_count;i++)
4445 - if (uninorth_bridges[i].node == bridge_node) {
4451 - if (bridge == -1) {
4452 - printk(KERN_WARNING "pmac_pci: no default bridge !\n");
4461 -pmac_pci_dev_io_base(unsigned char bus, unsigned char devfn, int physical)
4464 - if (uninorth_count != 0)
4465 - bridge = pmac_pci_dev_root_bridge(bus, devfn);
4466 - if (bridge == -1) {
4467 - struct bridge_data *bp;
4469 - if (bus > max_bus || (bp = bridges[bus]) == 0)
4471 - return physical ? bp->io_base_phys : bp->io_base;
4473 - return physical ? uninorth_bridges[bridge].iobase_phys
4474 - : uninorth_bridges[bridge].iobase;
4479 -pmac_pci_dev_mem_base(unsigned char bus, unsigned char devfn)
4484 -/* This function only works for bus 0, uni-N uses a different mecanism for
4485 - * other busses (see below)
4487 -#define UNI_N_CFA0(devfn, off) \
4488 - ((1 << (unsigned long)PCI_SLOT(dev_fn)) \
4489 - | (((unsigned long)PCI_FUNC(dev_fn)) << 8) \
4490 - | (((unsigned long)(off)) & 0xFCUL))
4492 -/* This one is for type 1 config accesses */
4493 -#define UNI_N_CFA1(bus, devfn, off) \
4494 - ((((unsigned long)(bus)) << 16) \
4495 - |(((unsigned long)(devfn)) << 8) \
4496 - |(((unsigned long)(off)) & 0xFCUL) \
4502 -uni_north_access_data(unsigned char bus, unsigned char dev_fn,
4503 - unsigned char offset)
4506 - unsigned int caddr;
4508 - bridge = pmac_pci_dev_root_bridge(bus, dev_fn);
4510 - caddr = UNI_N_CFA0(dev_fn, offset);
4512 - caddr = UNI_N_CFA1(bus, dev_fn, offset);
4514 - if (bridge == -1) {
4515 - printk(KERN_WARNING "pmac_pci: no default bridge !\n");
4519 - /* Uninorth will return garbage if we don't read back the value ! */
4520 - out_le32(uninorth_bridges[bridge].cfg_addr, caddr);
4521 - (void)in_le32(uninorth_bridges[bridge].cfg_addr);
4522 - /* Yes, offset is & 7, not & 3 ! */
4523 - return (unsigned int)(uninorth_bridges[bridge].cfg_data) + (offset & 0x07);
4527 -int uni_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn,
4528 - unsigned char offset, unsigned char *val)
4530 - unsigned int addr;
4533 - addr = uni_north_access_data(bus, dev_fn, offset);
4535 - return PCIBIOS_DEVICE_NOT_FOUND;
4536 - *val = in_8((volatile unsigned char*)addr);
4537 - return PCIBIOS_SUCCESSFUL;
4541 -int uni_pcibios_read_config_word(unsigned char bus, unsigned char dev_fn,
4542 - unsigned char offset, unsigned short *val)
4544 - unsigned int addr;
4547 - addr = uni_north_access_data(bus, dev_fn, offset);
4549 - return PCIBIOS_DEVICE_NOT_FOUND;
4550 - *val = in_le16((volatile unsigned short*)addr);
4551 - return PCIBIOS_SUCCESSFUL;
4555 -int uni_pcibios_read_config_dword(unsigned char bus, unsigned char dev_fn,
4556 - unsigned char offset, unsigned int *val)
4558 - unsigned int addr;
4561 - addr = uni_north_access_data(bus, dev_fn, offset);
4563 - return PCIBIOS_DEVICE_NOT_FOUND;
4564 - *val = in_le32((volatile unsigned int*)addr);
4565 - return PCIBIOS_SUCCESSFUL;
4569 -int uni_pcibios_write_config_byte(unsigned char bus, unsigned char dev_fn,
4570 - unsigned char offset, unsigned char val)
4572 - unsigned int addr;
4574 - addr = uni_north_access_data(bus, dev_fn, offset);
4576 - return PCIBIOS_DEVICE_NOT_FOUND;
4577 - out_8((volatile unsigned char *)addr, val);
4578 - (void)in_8((volatile unsigned char *)addr);
4579 - return PCIBIOS_SUCCESSFUL;
4583 -int uni_pcibios_write_config_word(unsigned char bus, unsigned char dev_fn,
4584 - unsigned char offset, unsigned short val)
4586 - unsigned int addr;
4588 - addr = uni_north_access_data(bus, dev_fn, offset);
4590 - return PCIBIOS_DEVICE_NOT_FOUND;
4591 - out_le16((volatile unsigned short *)addr, val);
4592 - (void)in_le16((volatile unsigned short *)addr);
4593 - return PCIBIOS_SUCCESSFUL;
4597 -int uni_pcibios_write_config_dword(unsigned char bus, unsigned char dev_fn,
4598 - unsigned char offset, unsigned int val)
4600 - unsigned int addr;
4602 - addr = uni_north_access_data(bus, dev_fn, offset);
4604 - return PCIBIOS_DEVICE_NOT_FOUND;
4605 - out_le32((volatile unsigned int *)addr, val);
4606 - (void)in_le32((volatile unsigned int *)addr);
4607 - return PCIBIOS_SUCCESSFUL;
4612 int pmac_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn,
4613 unsigned char offset, unsigned char *val)
4614 @@ -576,80 +360,6 @@
4618 -#define GRACKLE_PICR1_STG 0x00000040
4619 -#define GRACKLE_PICR1_LOOPSNOOP 0x00000010
4621 -/* N.B. this is called before bridges is initialized, so we can't
4622 - use grackle_pcibios_{read,write}_config_dword. */
4623 -static inline void grackle_set_stg(struct bridge_data *bp, int enable)
4627 - out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
4628 - val = in_le32((volatile unsigned int *)bp->cfg_data);
4629 - val = enable? (val | GRACKLE_PICR1_STG) :
4630 - (val & ~GRACKLE_PICR1_STG);
4631 - out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
4632 - out_le32((volatile unsigned int *)bp->cfg_data, val);
4635 -static inline void grackle_set_loop_snoop(struct bridge_data *bp, int enable)
4639 - out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
4640 - val = in_le32((volatile unsigned int *)bp->cfg_data);
4641 - val = enable? (val | GRACKLE_PICR1_LOOPSNOOP) :
4642 - (val & ~GRACKLE_PICR1_LOOPSNOOP);
4643 - out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
4644 - out_le32((volatile unsigned int *)bp->cfg_data, val);
4648 -fixup_one_level_bus_range(struct device_node *node, int higher)
4650 - for (; node != 0;node = node->sibling) {
4652 - unsigned int *class_code;
4655 - /* For PCI<->PCI bridges or CardBus bridges, we go down */
4656 - class_code = (unsigned int *) get_property(node, "class-code", 0);
4657 - if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
4658 - (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
4660 - bus_range = (int *) get_property(node, "bus-range", &len);
4661 - if (bus_range != NULL && len > 2 * sizeof(int)) {
4662 - if (bus_range[1] > higher)
4663 - higher = bus_range[1];
4665 - higher = fixup_one_level_bus_range(node->child, higher);
4670 -/* This routine fixes the "bus-range" property of all bridges in the
4671 - * system since they tend to have their "last" member wrong on macs
4673 - * Note that the bus numbers manipulated here are OF bus numbers, they
4674 - * are not Linux bus numbers.
4677 -fixup_bus_range(struct device_node *bridge)
4682 - /* Lookup the "bus-range" property for the hose */
4683 - bus_range = (int *) get_property(bridge, "bus-range", &len);
4684 - if (bus_range == NULL || len < 2 * sizeof(int)) {
4685 - printk(KERN_WARNING "Can't get bus-range for %s\n",
4686 - bridge->full_name);
4689 - bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]);
4692 __initfunc(unsigned long pmac_find_bridges(unsigned long mem_start, unsigned long mem_end))
4699 - fixup_bus_range(dev);
4700 bus_range = (int *) get_property(dev, "bus-range", &len);
4701 if (bus_range == NULL || len < 2 * sizeof(int)) {
4702 printk(KERN_WARNING "Can't get bus-range for %s\n",
4703 @@ -702,54 +411,21 @@
4704 printk(KERN_INFO "PCI buses %d..%d", bus_range[0],
4706 printk(" controlled by %s at %x\n", dev->name, addr->address);
4707 - if (device_is_compatible(dev, "uni-north")) {
4708 - int i = uninorth_count++;
4709 - uninorth_bridges[i].cfg_addr = ioremap(addr->address + 0x800000, 0x1000);
4710 - uninorth_bridges[i].cfg_data = ioremap(addr->address + 0xc00000, 0x1000);
4711 - uninorth_bridges[i].node = dev;
4712 - uninorth_bridges[i].iobase_phys = (void *)addr->address;
4713 - /* is 0x10000 enough for io space ? */
4714 - uninorth_bridges[i].iobase = (void *)ioremap(addr->address, 0x10000);
4715 - /* XXX This is the bridge with the PCI expansion bus. This is also the
4716 - * address of the bus that will receive type 1 config accesses and io
4717 - * accesses. Appears to be correct for iMac DV and G4 Sawtooth too.
4718 - * That means that we cannot do io cycles on the AGP bus nor the internal
4719 - * ethernet/fw bus. Fortunately, they appear not to be needed on iMac DV
4722 - if (addr->address == 0xf2000000)
4723 - uninorth_default = i;
4727 bp = (struct bridge_data *) *mem_ptr;
4728 *mem_ptr += sizeof(struct bridge_data);
4729 - if (device_is_compatible(dev, "uni-north")) {
4732 - bp->io_base = uninorth_bridges[uninorth_count-1].iobase;
4733 - bp->io_base_phys = uninorth_bridges[uninorth_count-1].iobase_phys;
4734 - } else if (strcmp(dev->name, "pci") == 0) {
4735 - /* XXX assume this is a mpc106 (grackle) */
4736 - bp->cfg_addr = (volatile unsigned int *)
4737 - ioremap(0xfec00000, 0x1000);
4738 - bp->cfg_data = (volatile unsigned char *)
4739 - ioremap(0xfee00000, 0x1000);
4740 - bp->io_base = (void *) ioremap(0xfe000000, 0x20000);
4741 - bp->io_base_phys = (void *)0xfe000000;
4742 - if (machine_is_compatible("AAPL,PowerBook1998"))
4743 - grackle_set_loop_snoop(bp, 1);
4744 -#if 0 /* Disabled for now, HW problems ??? */
4745 - grackle_set_stg(bp, 1);
4748 - /* a `bandit' or `chaos' bridge */
4749 + if (strcmp(dev->name, "pci") != 0) {
4750 bp->cfg_addr = (volatile unsigned int *)
4751 ioremap(addr->address + 0x800000, 0x1000);
4752 bp->cfg_data = (volatile unsigned char *)
4753 ioremap(addr->address + 0xc00000, 0x1000);
4754 bp->io_base = (void *) ioremap(addr->address, 0x10000);
4755 - bp->io_base_phys = (void *)addr->address;
4758 + bp->cfg_addr = (volatile unsigned int *)
4759 + ioremap(0xfec00000, 0x1000);
4760 + bp->cfg_data = (volatile unsigned char *)
4761 + ioremap(0xfee00000, 0x1000);
4762 + bp->io_base = (void *) ioremap(0xfe000000, 0x20000);
4764 if (isa_io_base == 0)
4765 isa_io_base = (unsigned long) bp->io_base;
4766 @@ -792,13 +468,7 @@
4767 if (pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin) ||
4769 continue; /* No interrupt generated -> no fixup */
4770 - /* We iterate all instances of uninorth for now */
4771 - if (uninorth_count && dev->bus->number == 0) {
4773 - for (i=0;i<uninorth_count;i++)
4774 - fix_intr(uninorth_bridges[i].node->child, dev);
4776 - fix_intr(bp->node->child, dev);
4777 + fix_intr(bp->node->child, dev);
4781 @@ -806,17 +476,9 @@
4783 pmac_setup_pci_ptrs(void))
4785 - struct device_node* np;
4787 - np = find_devices("pci");
4789 - if (device_is_compatible(np, "uni-north")) {
4790 - /* looks like an Core99 powermac */
4791 - set_config_access_method(uni);
4793 - /* looks like a G3 powermac */
4794 - set_config_access_method(grackle);
4796 + if (find_devices("pci") != 0) {
4797 + /* looks like a G3 powermac */
4798 + set_config_access_method(grackle);
4800 set_config_access_method(pmac);
4802 diff -urN linux.orig/arch/ppc/kernel/pmac_pic.c linux/arch/ppc/kernel/pmac_pic.c
4803 --- linux.orig/arch/ppc/kernel/pmac_pic.c Sun Mar 25 18:31:49 2001
4804 +++ linux/arch/ppc/kernel/pmac_pic.c Thu Jul 11 15:43:29 2002
4806 #include <linux/sched.h>
4807 #include <linux/signal.h>
4808 #include <linux/pci.h>
4809 -#include <linux/openpic.h>
4810 #include <asm/pci-bridge.h>
4812 #include <asm/smp.h>
4813 #include <asm/prom.h>
4814 #include "pmac_pic.h"
4815 -#include "open_pic.h"
4817 struct pmac_irq_hw {
4820 static int max_irqs;
4821 static int max_real_irqs;
4823 -extern u_int openpic_read(volatile u_int *addr);
4825 #define MAXCOUNT 10000000
4827 #define GATWICK_IRQ_POOL_SIZE 10
4832 - extern void psurge_smp_message_recv(void);
4835 unsigned long bits = 0;
4841 - psurge_smp_message_recv();
4842 + pmac_smp_message_recv();
4845 /* could be here due to a do_fake_interrupt call but we don't
4846 @@ -356,58 +350,6 @@
4847 struct device_node *irqctrler;
4848 volatile struct pmac_irq_hw *addr;
4853 - /* We first try to detect Apple's new Core99 chipset, since mac-io
4854 - * is quite different on those machines and contains an IBM MPIC2.
4856 - irqctrler = find_type_devices("open-pic");
4857 - if (irqctrler != NULL) {
4858 - printk("PowerMac using OpenPIC irq controller\n");
4859 - if (irqctrler->n_addrs > 0) {
4861 - struct device_node* pswitch;
4862 -#endif /* CONFIG_XMON */
4863 - OpenPIC = (volatile struct OpenPIC *)
4864 - ioremap(irqctrler->addrs[0].address,
4865 - irqctrler->addrs[0].size);
4866 - /* from openpic.c code... --Troy
4867 - * dynamically figure out how many interrupts
4868 - * We should really do something like panic
4869 - * if nr_irq >= OPENPIC_VEC_IPI
4871 - t = openpic_read(&OpenPIC->Global.Feature_Reporting0);
4872 - nr_irq = ((t & OPENPIC_FEATURE_LAST_SOURCE_MASK) >>
4873 - OPENPIC_FEATURE_LAST_SOURCE_SHIFT) + 1;
4875 - for ( i = 0 ; i < nr_irq ; i++ ) {
4876 - irq_desc[i].ctl = &open_pic;
4877 - irq_desc[i].level = 0;
4879 - ppc_md.do_IRQ = open_pic_do_IRQ;
4880 - open_pic.irq_offset = 0;
4883 - pswitch = find_devices("programmer-switch");
4884 - if (pswitch && pswitch->n_intrs)
4885 - request_irq(pswitch->intrs[0].line, xmon_irq, 0,
4887 -#endif /* CONFIG_XMON */
4889 - request_irq(OPENPIC_VEC_IPI, openpic_ipi_action,
4891 - request_irq(OPENPIC_VEC_IPI+1, openpic_ipi_action,
4892 - 0, "IPI1 (invalidate TLB)", 0);
4893 - request_irq(OPENPIC_VEC_IPI+2, openpic_ipi_action,
4894 - 0, "IPI2 (stop CPU)", 0);
4895 - request_irq(OPENPIC_VEC_IPI+3, openpic_ipi_action,
4896 - 0, "IPI3 (reschedule)", 0);
4897 -#endif /* __SMP__ */
4904 * G3 powermacs and 1999 G3 PowerBooks have 64 interrupts,
4906 * sleep_save_intrs() saves the states of all interrupt enables
4907 * and disables all interupts except for the nominated one.
4908 * sleep_restore_intrs() restores the states of all interrupt enables.
4910 - * TODO: Those should be sleep notifiers with high priority.
4912 unsigned int sleep_save_mask[2];
4915 sleep_save_mask[1] = ppc_cached_irq_mask[1];
4916 ppc_cached_irq_mask[0] = 0;
4917 ppc_cached_irq_mask[1] = 0;
4919 - set_bit(viaint, ppc_cached_irq_mask);
4920 + set_bit(viaint, ppc_cached_irq_mask);
4921 out_le32(&pmac_irq_hw[0]->enable, ppc_cached_irq_mask[0]);
4922 if (max_real_irqs > 32)
4923 out_le32(&pmac_irq_hw[1]->enable, ppc_cached_irq_mask[1]);
4929 out_le32(&pmac_irq_hw[0]->enable, 0);
4930 if (max_real_irqs > 32)
4931 out_le32(&pmac_irq_hw[1]->enable, 0);
4932 diff -urN linux.orig/arch/ppc/kernel/pmac_setup.c linux/arch/ppc/kernel/pmac_setup.c
4933 --- linux.orig/arch/ppc/kernel/pmac_setup.c Sun Mar 25 18:37:30 2001
4934 +++ linux/arch/ppc/kernel/pmac_setup.c Thu Jul 11 15:46:22 2002
4936 #include <asm/feature.h>
4937 #include <asm/ide.h>
4938 #include <asm/machdep.h>
4939 -#include <asm/keyboard.h>
4940 -#include <asm/time.h>
4943 #include "local_irq.h"
4944 #include "pmac_pic.h"
4946 #undef SHOW_GATWICK_IRQS
4948 -extern long pmac_time_init(void);
4949 -extern unsigned long pmac_get_rtc_time(void);
4950 -extern int pmac_set_rtc_time(unsigned long nowtime);
4951 -extern void pmac_read_rtc_time(void);
4952 -extern void pmac_calibrate_decr(void);
4953 -extern void pmac_setup_pci_ptrs(void);
4954 +unsigned long pmac_get_rtc_time(void);
4955 +int pmac_set_rtc_time(unsigned long nowtime);
4956 +void pmac_read_rtc_time(void);
4957 +void pmac_calibrate_decr(void);
4958 +void pmac_setup_pci_ptrs(void);
4960 extern int mackbd_setkeycode(unsigned int scancode, unsigned int keycode);
4961 extern int mackbd_getkeycode(unsigned int scancode);
4963 extern void mackbd_leds(unsigned char leds);
4964 extern void mackbd_init_hw(void);
4965 #ifdef CONFIG_MAGIC_SYSRQ
4966 -extern unsigned char mackbd_sysrq_xlate[128];
4967 -extern unsigned char mac_hid_kbd_sysrq_xlate[128];
4968 -extern unsigned char pckbd_sysrq_xlate[128];
4969 +unsigned char mackbd_sysrq_xlate[128];
4970 #endif /* CONFIG_MAGIC_SYSRQ */
4971 -extern int keyboard_sends_linux_keycodes;
4972 -extern int mac_hid_kbd_translate(unsigned char scancode,
4973 - unsigned char *keycode, char raw_mode);
4974 -extern char mac_hid_kbd_unexpected_up(unsigned char keycode);
4975 -extern void mac_hid_init_hw(void);
4977 -extern void pmac_nvram_update(void);
4979 -extern void *pmac_pci_dev_io_base(unsigned char bus, unsigned char devfn);
4980 -extern void *pmac_pci_dev_mem_base(unsigned char bus, unsigned char devfn);
4981 -extern int pmac_pci_dev_root_bridge(unsigned char bus, unsigned char devfn);
4982 +extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
4983 +extern int pckbd_getkeycode(unsigned int scancode);
4984 +extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
4986 +extern char pckbd_unexpected_up(unsigned char keycode);
4987 +extern void pckbd_leds(unsigned char leds);
4988 +extern void pckbd_init_hw(void);
4990 unsigned char drive_info;
4992 int ppc_override_l2cr = 0;
4993 int ppc_override_l2cr_value;
4995 -static int current_root_goodness = -1;
4997 extern char saved_command_line[];
4999 -extern int pmac_newworld;
5001 #define DEFAULT_ROOT_DEVICE 0x0801 /* sda1 - slightly silly choice */
5003 extern void zs_kgdb_hook(int tty_num);
5004 static void ohare_init(void);
5005 static void init_p2pbridge(void);
5008 -volatile static long int core99_l2_cache;
5009 -void core99_init_l2(void)
5011 - int cpu = smp_processor_id();
5013 - if ( (_get_PVR() >> 16) != 8 && (_get_PVR() >> 16) != 12 )
5017 - core99_l2_cache = _get_L2CR();
5018 - printk("CPU0: L2CR is %lx\n", core99_l2_cache);
5020 - printk("CPU%d: L2CR was %lx\n", cpu, _get_L2CR());
5021 - _set_L2CR(core99_l2_cache);
5022 - printk("CPU%d: L2CR set to %lx\n", cpu, core99_l2_cache);
5025 -#endif /* CONFIG_SMP */
5029 pmac_get_cpuinfo(char *buffer)
5030 @@ -219,10 +187,6 @@
5031 len += sprintf(buffer+len, "l2cr override\t: 0x%x\n", *l2cr);
5035 - /* Indicate newworld/oldworld */
5036 - len += sprintf(buffer+len, "pmac-generation\t: %s\n",
5037 - pmac_newworld ? "NewWorld" : "OldWorld");
5041 @@ -282,18 +246,16 @@
5043 switch (_get_PVR() >> 16) {
5047 case 10: /* mach V (604ev5) */
5050 loops_per_jiffy = *fp / HZ;
5052 default: /* 601, 603, etc. */
5053 - loops_per_jiffy = *fp / (2*HZ);
5054 + loops_per_jiffy = *fp / (2/HZ);
5057 - loops_per_jiffy = 50000000 / HZ;
5058 + loops_per_jiffy = 50000000/HZ;
5061 /* this area has the CPU identification register
5062 @@ -304,11 +266,9 @@
5064 *memory_start_p = pmac_find_bridges(*memory_start_p, *memory_end_p);
5067 - /* Checks "l2cr-value" property in the registry
5068 - * And enable G3/G4 Dynamic Power Management
5070 - if ( (_get_PVR() >> 16) == 8 || (_get_PVR() >> 16) == 12 ) {
5072 + /* Checks "l2cr-value" property in the registry */
5073 + if ( (_get_PVR() >> 16) == 8) {
5074 struct device_node *np = find_devices("cpus");
5076 np = find_type_devices("cpu");
5077 @@ -319,22 +279,17 @@
5078 ppc_override_l2cr = 1;
5079 ppc_override_l2cr_value = *l2cr;
5081 - if (ppc_override_l2cr_value)
5082 - _set_L2CR(ppc_override_l2cr_value);
5083 + _set_L2CR(ppc_override_l2cr_value);
5086 - _set_HID0(_get_HID0() | HID0_DPM);
5089 if (ppc_override_l2cr)
5090 printk(KERN_INFO "L2CR overriden (0x%x), backside cache is %s\n",
5091 ppc_override_l2cr_value, (ppc_override_l2cr_value & 0x80000000)
5092 ? "enabled" : "disabled");
5106 - pmac_nvram_init();
5108 #ifdef CONFIG_DUMMY_CONSOLE
5109 conswitchp = &dummy_con;
5115 + pmac_nvram_init();
5119 @@ -493,14 +447,13 @@
5121 /* can't be initfunc - can be called whenever a disk is first accessed */
5123 -void note_bootable_part(kdev_t dev, int part, int goodness)
5124 +void note_bootable_part(kdev_t dev, int part)
5126 static int found_boot = 0;
5129 /* Do nothing if the root has been set already. */
5130 - if ((goodness < current_root_goodness) &&
5131 - (ROOT_DEV != to_kdev_t(DEFAULT_ROOT_DEVICE)))
5132 + if (ROOT_DEV != to_kdev_t(DEFAULT_ROOT_DEVICE))
5134 p = strstr(saved_command_line, "root=");
5135 if (p != NULL && (p == saved_command_line || p[-1] == ' '))
5137 if (boot_dev == 0 || dev == boot_dev) {
5138 ROOT_DEV = MKDEV(MAJOR(dev), MINOR(dev) + part);
5140 - current_root_goodness = goodness;
5141 + printk(" (root)");
5147 struct adb_request req;
5149 - pmac_nvram_update();
5151 switch (adb_hardware) {
5153 cuda_request(&req, NULL, 2, CUDA_PACKET,
5156 struct adb_request req;
5158 - pmac_nvram_update();
5160 switch (adb_hardware) {
5162 cuda_request(&req, NULL, 2, CUDA_PACKET,
5171 @@ -663,17 +613,12 @@
5172 ppc_md.power_off = pmac_power_off;
5173 ppc_md.halt = pmac_halt;
5175 - ppc_md.time_init = pmac_time_init;
5176 + ppc_md.time_init = NULL;
5177 ppc_md.set_rtc_time = pmac_set_rtc_time;
5178 ppc_md.get_rtc_time = pmac_get_rtc_time;
5179 ppc_md.calibrate_decr = pmac_calibrate_decr;
5181 - ppc_md.pci_dev_root_bridge = pmac_pci_dev_root_bridge;
5182 - ppc_md.pci_dev_mem_base = pmac_pci_dev_mem_base;
5183 - ppc_md.pci_dev_io_base = pmac_pci_dev_io_base;
5186 -#ifdef CONFIG_MAC_KEYBOARD
5187 +#if defined(CONFIG_VT) && defined(CONFIG_MAC_KEYBOARD)
5188 ppc_md.kbd_setkeycode = mackbd_setkeycode;
5189 ppc_md.kbd_getkeycode = mackbd_getkeycode;
5190 ppc_md.kbd_translate = mackbd_translate;
5191 @@ -684,27 +629,7 @@
5192 ppc_md.sysrq_xlate = mackbd_sysrq_xlate;
5195 -#elif defined(CONFIG_INPUT_ADBHID)
5196 - ppc_md.kbd_setkeycode = 0;
5197 - ppc_md.kbd_getkeycode = 0;
5198 - ppc_md.kbd_translate = mac_hid_kbd_translate;
5199 - ppc_md.kbd_unexpected_up = mac_hid_kbd_unexpected_up;
5200 - ppc_md.kbd_leds = 0;
5201 - ppc_md.kbd_init_hw = mac_hid_init_hw;
5202 -#ifdef CONFIG_MAGIC_SYSRQ
5203 -#ifdef CONFIG_MAC_ADBKEYCODES
5204 - if (!keyboard_sends_linux_keycodes) {
5205 - ppc_md.sysrq_xlate = mac_hid_kbd_sysrq_xlate;
5208 -#endif /* CONFIG_MAC_ADBKEYCODES */
5210 - ppc_md.sysrq_xlate = pckbd_sysrq_xlate;
5214 -#endif /* CONFIG_MAC_KEYBOARD */
5215 -#endif /* CONFIG_VT */
5217 #if defined(CONFIG_BLK_DEV_IDE_PMAC)
5218 ppc_ide_md.insw = pmac_ide_insw;
5219 diff -urN linux.orig/arch/ppc/kernel/pmac_support.c linux/arch/ppc/kernel/pmac_support.c
5220 --- linux.orig/arch/ppc/kernel/pmac_support.c Sun Mar 25 18:31:49 2001
5221 +++ linux/arch/ppc/kernel/pmac_support.c Thu Jul 11 15:43:29 2002
5224 * Miscellaneous procedures for dealing with the PowerMac hardware.
5225 - * Contains support for the nvram.
5227 - * Copyright (C) 2000 Paul Mackerras
5228 - * Copyright (C) 2000 Benjamin Herrenschmidt
5230 - * ToDo: Handle type 0 and type 1 "NameRegistry" NVRAM properties. Those
5231 - * contain, among other things, the brightness, video mode, etc...
5233 #include <linux/kernel.h>
5234 #include <linux/stddef.h>
5235 #include <linux/reboot.h>
5236 #include <linux/nvram.h>
5237 -#include <linux/slab.h>
5238 -#include <linux/delay.h>
5239 #include <asm/init.h>
5240 #include <asm/ptrace.h>
5243 #include <asm/prom.h>
5244 #include <asm/adb.h>
5245 #include <asm/pmu.h>
5246 -#include <asm/machdep.h>
5247 #include <asm/nvram.h>
5248 #include <asm/backlight.h>
5252 -#define NVRAM_SIZE 0x2000 /* 8kB of non-volatile RAM */
5254 -#define CORE99_SIGNATURE 0x5a
5255 -#define CORE99_ADLER_START 0x14
5257 -/* Core99 nvram is a flash */
5258 -#define CORE99_FLASH_STATUS_DONE 0x80
5259 -#define CORE99_FLASH_STATUS_ERR 0x38
5260 -#define CORE99_FLASH_CMD_ERASE_CONFIRM 0xd0
5261 -#define CORE99_FLASH_CMD_ERASE_SETUP 0x20
5262 -#define CORE99_FLASH_CMD_RESET 0xff
5263 -#define CORE99_FLASH_CMD_WRITE_SETUP 0x40
5265 -/* CHRP NVRAM header */
5266 -struct chrp_header {
5274 -struct core99_header {
5275 - struct chrp_header hdr;
5282 * Read and write the non-volatile RAM on PowerMacs and CHRP machines.
5284 static int nvram_naddrs;
5285 static volatile unsigned char *nvram_addr;
5286 static volatile unsigned char *nvram_data;
5287 -static int nvram_mult, is_core_99;
5288 -static int core99_bank = 0;
5289 +static int nvram_mult;
5290 static int nvram_partitions[3];
5292 static struct backlight_controller *backlighter = NULL;
5293 @@ -73,213 +31,22 @@
5294 static int backlight_level = BACKLIGHT_MAX;
5295 static int backlight_enabled = 1;
5297 -/* FIXME: kmalloc fails to allocate the image now that I had to move it
5298 - * before time_init(). For now, I allocate a static buffer here
5299 - * but it's a waste of space on all but core99 machines
5302 -static char* nvram_image;
5304 -static char nvram_image[NVRAM_SIZE];
5307 -extern int pmac_newworld;
5310 -chrp_checksum(struct chrp_header* hdr)
5313 - u16 sum = hdr->signature;
5314 - for (ptr = (u8 *)&hdr->len; ptr < hdr->data; ptr++)
5316 - while (sum > 0xFF)
5317 - sum = (sum & 0xFF) + (sum>>8);
5322 -core99_calc_adler(u8 *buffer)
5327 - buffer += CORE99_ADLER_START;
5330 - for (cnt=0; cnt<(NVRAM_SIZE-CORE99_ADLER_START); cnt++) {
5331 - if ((cnt % 5000) == 0) {
5335 - low += buffer[cnt];
5341 - return (high << 16) | low;
5345 -core99_check(u8* datas)
5347 - struct core99_header* hdr99 = (struct core99_header*)datas;
5348 +#define NVRAM_SIZE 0x2000 /* 8kB of non-volatile RAM */
5350 - if (hdr99->hdr.signature != CORE99_SIGNATURE) {
5352 - printk("Invalid signature\n");
5356 - if (hdr99->hdr.cksum != chrp_checksum(&hdr99->hdr)) {
5358 - printk("Invalid checksum\n");
5362 - if (hdr99->adler != core99_calc_adler(datas)) {
5364 - printk("Invalid adler\n");
5368 - return hdr99->generation;
5372 -core99_erase_bank(int bank)
5376 - u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
5378 - out_8(base, CORE99_FLASH_CMD_ERASE_SETUP);
5379 - out_8(base, CORE99_FLASH_CMD_ERASE_CONFIRM);
5380 - do { stat = in_8(base); }
5381 - while(!(stat & CORE99_FLASH_STATUS_DONE));
5382 - out_8(base, CORE99_FLASH_CMD_RESET);
5383 - if (stat & CORE99_FLASH_STATUS_ERR) {
5384 - printk("nvram: flash error 0x%02x on erase !\n", stat);
5387 - for (i=0; i<NVRAM_SIZE; i++)
5388 - if (base[i] != 0xff) {
5389 - printk("nvram: flash erase failed !\n");
5396 -core99_write_bank(int bank, u8* datas)
5400 - u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
5402 - for (i=0; i<NVRAM_SIZE; i++) {
5403 - out_8(base+i, CORE99_FLASH_CMD_WRITE_SETUP);
5404 - out_8(base+i, datas[i]);
5405 - do { stat = in_8(base); }
5406 - while(!(stat & CORE99_FLASH_STATUS_DONE));
5407 - if (stat & CORE99_FLASH_STATUS_ERR)
5410 - out_8(base, CORE99_FLASH_CMD_RESET);
5411 - if (stat & CORE99_FLASH_STATUS_ERR) {
5412 - printk("nvram: flash error 0x%02x on write !\n", stat);
5415 - for (i=0; i<NVRAM_SIZE; i++)
5416 - if (base[i] != datas[i]) {
5417 - printk("nvram: flash write failed !\n");
5424 -lookup_partitions(void)
5428 - struct chrp_header* hdr;
5430 - if (pmac_newworld) {
5431 - nvram_partitions[pmac_nvram_OF] = -1;
5432 - nvram_partitions[pmac_nvram_XPRAM] = -1;
5433 - nvram_partitions[pmac_nvram_NR] = -1;
5434 - hdr = (struct chrp_header *)buffer;
5439 - for (i=0;i<16;i++)
5440 - buffer[i] = nvram_read_byte(offset+i);
5441 - if (!strcmp(hdr->name, "common"))
5442 - nvram_partitions[pmac_nvram_OF] = offset + 0x10;
5443 - if (!strcmp(hdr->name, "APL,MacOS75")) {
5444 - nvram_partitions[pmac_nvram_XPRAM] = offset + 0x10;
5445 - nvram_partitions[pmac_nvram_NR] = offset + 0x110;
5447 - offset += (hdr->len * 0x10);
5448 - } while(offset < NVRAM_SIZE);
5450 - nvram_partitions[pmac_nvram_OF] = 0x1800;
5451 - nvram_partitions[pmac_nvram_XPRAM] = 0x1300;
5452 - nvram_partitions[pmac_nvram_NR] = 0x1400;
5455 - printk("nvram: OF partition at 0x%x\n", nvram_partitions[pmac_nvram_OF]);
5456 - printk("nvram: XP partition at 0x%x\n", nvram_partitions[pmac_nvram_XPRAM]);
5457 - printk("nvram: NR partition at 0x%x\n", nvram_partitions[pmac_nvram_NR]);
5462 void pmac_nvram_init(void)
5464 struct device_node *dp;
5468 dp = find_devices("nvram");
5470 printk(KERN_ERR "Can't find NVRAM device\n");
5474 nvram_naddrs = dp->n_addrs;
5475 - is_core_99 = device_is_compatible(dp, "nvram,flash");
5476 - printk("pmac nvram is core99: %d\n", is_core_99);
5479 - u32 gen_bank0, gen_bank1;
5481 - if (nvram_naddrs < 1) {
5482 - printk(KERN_ERR "nvram: no address\n");
5486 - nvram_image = kmalloc(NVRAM_SIZE, GFP_KERNEL);
5487 - if (!nvram_image) {
5488 - printk(KERN_ERR "nvram: can't allocate image\n");
5492 - nvram_data = ioremap(dp->addrs[0].address, NVRAM_SIZE*2);
5494 - printk("nvram: Checking bank 0...\n");
5496 - gen_bank0 = core99_check((u8 *)nvram_data);
5497 - gen_bank1 = core99_check((u8 *)nvram_data + NVRAM_SIZE);
5498 - core99_bank = (gen_bank0 < gen_bank1) ? 1 : 0;
5500 - printk("nvram: gen0=%d, gen1=%d\n", gen_bank0, gen_bank1);
5501 - printk("nvram: Active bank is: %d\n", core99_bank);
5503 - for (i=0; i<NVRAM_SIZE; i++)
5504 - nvram_image[i] = nvram_data[i + core99_bank*NVRAM_SIZE];
5505 - } else if (_machine == _MACH_chrp && nvram_naddrs == 1) {
5506 + if (_machine == _MACH_chrp && nvram_naddrs == 1) {
5507 nvram_data = ioremap(dp->addrs[0].address, dp->addrs[0].size);
5509 } else if (nvram_naddrs == 1) {
5510 @@ -288,45 +55,15 @@
5511 } else if (nvram_naddrs == 2) {
5512 nvram_addr = ioremap(dp->addrs[0].address, dp->addrs[0].size);
5513 nvram_data = ioremap(dp->addrs[1].address, dp->addrs[1].size);
5514 - } else if (nvram_naddrs == 0 && adb_controller &&
5515 - adb_controller->kind == ADB_VIAPMU) {
5516 + } else if (nvram_naddrs == 0 && adb_hardware == ADB_VIAPMU) {
5519 printk(KERN_ERR "Don't know how to access NVRAM with %d addresses\n",
5522 - lookup_partitions();
5526 -pmac_nvram_update(void)
5528 - struct core99_header* hdr99;
5530 - if (!is_core_99 || !nvram_data || !nvram_image)
5532 - if (!memcmp(nvram_image, (u8*)nvram_data + core99_bank*NVRAM_SIZE,
5536 - printk("Updating nvram...\n");
5538 - hdr99 = (struct core99_header*)nvram_image;
5539 - hdr99->generation++;
5540 - hdr99->hdr.signature = CORE99_SIGNATURE;
5541 - hdr99->hdr.cksum = chrp_checksum(&hdr99->hdr);
5542 - hdr99->adler = core99_calc_adler(nvram_image);
5543 - core99_bank = core99_bank ? 0 : 1;
5544 - if (core99_erase_bank(core99_bank)) {
5545 - printk("nvram: Error erasing bank %d\n", core99_bank);
5548 - if (core99_write_bank(core99_bank, nvram_image))
5549 - printk("nvram: Error writing bank %d\n", core99_bank);
5552 -unsigned char __pmac
5553 -nvram_read_byte(int addr)
5554 +unsigned char nvram_read_byte(int addr)
5556 struct adb_request req;
5560 return req.reply[1];
5563 - return nvram_image ? nvram_image[addr] : 0;
5564 return nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult];
5566 *nvram_addr = addr >> 5;
5572 -nvram_write_byte(unsigned char val, int addr)
5573 +void nvram_write_byte(unsigned char val, int addr)
5575 struct adb_request req;
5584 - nvram_image[addr] = val;
5587 nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult] = val;
5590 diff -urN linux.orig/arch/ppc/kernel/pmac_time.c linux/arch/ppc/kernel/pmac_time.c
5591 --- linux.orig/arch/ppc/kernel/pmac_time.c Sun Mar 25 18:31:49 2001
5592 +++ linux/arch/ppc/kernel/pmac_time.c Thu Jul 11 15:43:29 2002
5594 #include <asm/system.h>
5596 #include <asm/pgtable.h>
5597 -#include <asm/nvram.h>
5599 -#include <asm/time.h>
5602 /* Apparently the RTC stores seconds since 1 Jan 1904 */
5603 #define RTC_OFFSET 2082844800
5605 /* Bits in IFR and IER */
5606 #define T1_INT 0x40 /* Timer 1 interrupt */
5608 -extern struct timezone sys_tz;
5611 -long pmac_time_init(void)
5616 - delta = ((s32)pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x9)) << 16;
5617 - delta |= ((s32)pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0xa)) << 8;
5618 - delta |= pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0xb);
5619 - if (delta & 0x00800000UL)
5620 - delta |= 0xFF000000UL;
5621 - dst = ((pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x8) & 0x80) != 0);
5622 - printk("GMT Delta read from XPRAM: %d minutes, DST: %s\n", delta/60,
5623 - dst ? "on" : "off");
5629 unsigned long pmac_get_rtc_time(void)
5631 struct adb_request req;
5634 int pmac_set_rtc_time(unsigned long nowtime)
5636 - struct adb_request req;
5639 - nowtime += RTC_OFFSET;
5641 - /* Set the time in the RTC */
5642 - if (adb_controller == 0)
5644 - /* adb_controller->kind, not adb_hardware, since that doesn't
5645 - get set until we call adb_init - paulus. */
5646 - switch (adb_controller->kind) {
5648 - if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME,
5649 - nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0)
5651 - while (!req.complete)
5653 -// if (req.reply_len != 7)
5654 - printk(KERN_ERR "pmac_set_rtc_time: got %d byte reply\n",
5658 - if (pmu_request(&req, NULL, 5, PMU_SET_RTC,
5659 - nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0)
5661 - while (!req.complete)
5663 - if (req.reply_len != 5)
5664 - printk(KERN_ERR "pmac_set_rtc_time: got %d byte reply\n",
5676 diff -urN linux.orig/arch/ppc/kernel/ppc-stub.c linux/arch/ppc/kernel/ppc-stub.c
5677 --- linux.orig/arch/ppc/kernel/ppc-stub.c Sun Mar 25 18:31:49 2001
5678 +++ linux/arch/ppc/kernel/ppc-stub.c Thu Jul 11 15:43:29 2002
5681 static inline void set_msr(int msr)
5683 - asm volatile("mtmsr %0" : : "r" (msr));
5684 + asm volatile("mfmsr %0" : : "r" (msr));
5687 /* Set up exception handlers for tracing and breakpoints
5688 diff -urN linux.orig/arch/ppc/kernel/ppc_asm.tmpl linux/arch/ppc/kernel/ppc_asm.tmpl
5689 --- linux.orig/arch/ppc/kernel/ppc_asm.tmpl Sun Mar 25 18:31:48 2001
5690 +++ linux/arch/ppc/kernel/ppc_asm.tmpl Thu Jul 11 15:43:29 2002
5728 diff -urN linux.orig/arch/ppc/kernel/ppc_htab.c linux/arch/ppc/kernel/ppc_htab.c
5729 --- linux.orig/arch/ppc/kernel/ppc_htab.c Sun Mar 25 18:31:49 2001
5730 +++ linux/arch/ppc/kernel/ppc_htab.c Thu Jul 11 15:43:29 2002
5732 "0.5", "1.0", "(reserved2)", "(reserved3)"
5735 - if ( ((_get_PVR() >> 16) != 8) && ((_get_PVR() >> 16) != 12))
5737 + if ( (_get_PVR() >> 16) != 8) return -EFAULT;
5739 if ( /*!table->maxlen ||*/ (filp->f_pos && !write)) {
5748 + while ( _get_L2CR() & 0x1 )
5749 + /* wait for invalidate to finish */;
5753 diff -urN linux.orig/arch/ppc/kernel/ppc_ksyms.c linux/arch/ppc/kernel/ppc_ksyms.c
5754 --- linux.orig/arch/ppc/kernel/ppc_ksyms.c Tue Jun 11 19:39:18 2002
5755 +++ linux/arch/ppc/kernel/ppc_ksyms.c Thu Jul 11 18:49:10 2002
5757 #include <linux/sched.h>
5758 #include <linux/string.h>
5759 #include <linux/interrupt.h>
5760 -#include <linux/smp_lock.h>
5761 #include <linux/vt_kern.h>
5762 #include <linux/nvram.h>
5764 +#include <asm/page.h>
5765 #include <asm/semaphore.h>
5766 #include <asm/processor.h>
5767 #include <asm/uaccess.h>
5768 +#include <asm/io.h>
5769 +#include <linux/ide.h>
5770 #include <asm/ide.h>
5771 +#include <asm/atomic.h>
5772 +#include <asm/bitops.h>
5773 #include <asm/checksum.h>
5774 #include <asm/pgtable.h>
5775 #include <asm/adb.h>
5776 #include <asm/cuda.h>
5777 #include <asm/pmu.h>
5778 #include <asm/prom.h>
5779 +#include <asm/system.h>
5780 #include <asm/pci-bridge.h>
5781 #include <asm/irq.h>
5782 #include <asm/feature.h>
5783 +#include <asm/spinlock.h>
5784 #include <asm/dma.h>
5785 -#include <asm/nvram.h>
5786 -#include <asm/time.h>
5787 +#include <asm/machdep.h>
5789 /* Tell string.h we don't want memcpy etc. as cpp defines */
5790 #define EXPORT_SYMTAB_STROPS
5792 unsigned int, unsigned int, unsigned int);
5793 extern void to_tm(int tim, struct rtc_time * tm);
5795 -long long __ashrdi3(long long, int);
5796 -long long __ashldi3(long long, int);
5797 -long long __lshrdi3(long long, int);
5799 +asmlinkage long long __ashrdi3(long long, int);
5800 +asmlinkage long long __ashldi3(long long, int);
5801 +asmlinkage long long __lshrdi3(long long, int);
5802 +asmlinkage int abs(int);
5804 EXPORT_SYMBOL(clear_page);
5805 EXPORT_SYMBOL(do_signal);
5807 EXPORT_SYMBOL(isa_mem_base);
5808 EXPORT_SYMBOL(pci_dram_offset);
5809 EXPORT_SYMBOL(ISA_DMA_THRESHOLD);
5810 -EXPORT_SYMBOL_NOVERS(DMA_MODE_READ);
5811 +EXPORT_SYMBOL(DMA_MODE_READ);
5812 EXPORT_SYMBOL(DMA_MODE_WRITE);
5813 -#if defined(CONFIG_PREP) || defined(CONFIG_ALL_PPC)
5814 EXPORT_SYMBOL(_prep_type);
5815 EXPORT_SYMBOL(ucSystemType);
5818 EXPORT_SYMBOL(atomic_add);
5819 EXPORT_SYMBOL(atomic_sub);
5820 @@ -167,16 +170,11 @@
5821 EXPORT_SYMBOL(enable_kernel_fp);
5822 EXPORT_SYMBOL(flush_icache_range);
5823 EXPORT_SYMBOL(xchg_u32);
5825 -#ifdef CONFIG_ALTIVEC
5826 -EXPORT_SYMBOL(giveup_altivec);
5830 -EXPORT_SYMBOL(cpu_data);
5831 -EXPORT_SYMBOL(kernel_flag);
5832 -EXPORT_SYMBOL(cpu_number_map);
5833 -EXPORT_SYMBOL(smp_num_cpus);
5834 +EXPORT_SYMBOL(__global_cli);
5835 +EXPORT_SYMBOL(__global_sti);
5836 +EXPORT_SYMBOL(__global_save_flags);
5837 +EXPORT_SYMBOL(__global_restore_flags);
5838 EXPORT_SYMBOL(_spin_lock);
5839 EXPORT_SYMBOL(_spin_unlock);
5840 EXPORT_SYMBOL(spin_trylock);
5841 @@ -184,35 +182,11 @@
5842 EXPORT_SYMBOL(_read_unlock);
5843 EXPORT_SYMBOL(_write_lock);
5844 EXPORT_SYMBOL(_write_unlock);
5846 -/* Global SMP irq stuff */
5847 -EXPORT_SYMBOL(synchronize_irq);
5848 -EXPORT_SYMBOL(synchronize_bh);
5849 -EXPORT_SYMBOL(global_bh_count);
5850 -EXPORT_SYMBOL(global_bh_lock);
5851 -EXPORT_SYMBOL(global_irq_holder);
5852 -EXPORT_SYMBOL(__global_cli);
5853 -EXPORT_SYMBOL(__global_sti);
5854 -EXPORT_SYMBOL(__global_save_flags);
5855 -EXPORT_SYMBOL(__global_restore_flags);
5856 -#endif /* __SMP__ */
5859 EXPORT_SYMBOL(_machine);
5860 EXPORT_SYMBOL(ppc_md);
5861 -EXPORT_SYMBOL(abort);
5864 -EXPORT_SYMBOL(find_devices);
5865 -EXPORT_SYMBOL(find_type_devices);
5866 -EXPORT_SYMBOL(find_compatible_devices);
5867 -EXPORT_SYMBOL(find_path_device);
5868 -EXPORT_SYMBOL(find_phandle);
5869 -EXPORT_SYMBOL(device_is_compatible);
5870 -EXPORT_SYMBOL(machine_is_compatible);
5871 -EXPORT_SYMBOL(find_pci_device_OFnode);
5872 -EXPORT_SYMBOL(find_all_nodes);
5873 -EXPORT_SYMBOL(get_property);
5874 -#endif /* CONFIG_MBX */
5875 #ifdef CONFIG_POWERMAC
5876 EXPORT_SYMBOL(adb_request);
5877 EXPORT_SYMBOL(adb_register);
5878 @@ -227,21 +201,25 @@
5879 EXPORT_SYMBOL(pmu_enable_irled);
5880 #endif /* CONFIG_PMAC_PBOOK */
5881 #ifdef CONFIG_POWERMAC
5882 +EXPORT_SYMBOL(abort);
5883 +EXPORT_SYMBOL(find_devices);
5884 +EXPORT_SYMBOL(find_type_devices);
5885 +EXPORT_SYMBOL(find_compatible_devices);
5886 +EXPORT_SYMBOL(find_path_device);
5887 +EXPORT_SYMBOL(find_phandle);
5888 +EXPORT_SYMBOL(device_is_compatible);
5889 +EXPORT_SYMBOL(machine_is_compatible);
5890 +EXPORT_SYMBOL(find_pci_device_OFnode);
5891 +EXPORT_SYMBOL(get_property);
5892 EXPORT_SYMBOL(pci_io_base);
5893 -EXPORT_SYMBOL(pci_dev_io_base);
5894 -EXPORT_SYMBOL(pci_dev_mem_base);
5895 EXPORT_SYMBOL(pci_device_loc);
5896 EXPORT_SYMBOL(feature_set);
5897 EXPORT_SYMBOL(feature_clear);
5898 EXPORT_SYMBOL(feature_test);
5899 EXPORT_SYMBOL(feature_set_gmac_power);
5900 EXPORT_SYMBOL(feature_set_gmac_phy_reset);
5901 -EXPORT_SYMBOL(feature_set_usb_power);
5902 -EXPORT_SYMBOL(feature_set_firewire_power);
5903 EXPORT_SYMBOL(nvram_read_byte);
5904 EXPORT_SYMBOL(nvram_write_byte);
5905 -EXPORT_SYMBOL(pmac_xpram_read);
5906 -EXPORT_SYMBOL(pmac_xpram_write);
5908 EXPORT_SYMBOL(note_scsi_host);
5909 #endif /* CONFIG_SCSI */
5910 diff -urN linux.orig/arch/ppc/kernel/prep_pci.c linux/arch/ppc/kernel/prep_pci.c
5911 --- linux.orig/arch/ppc/kernel/prep_pci.c Sun Mar 25 18:31:49 2001
5912 +++ linux/arch/ppc/kernel/prep_pci.c Thu Jul 11 15:43:29 2002
5916 #include <linux/types.h>
5917 -#include <linux/string.h>
5918 #include <linux/pci.h>
5919 #include <linux/kernel.h>
5920 #include <linux/init.h>
5922 #include <asm/residual.h>
5923 #include <asm/processor.h>
5924 #include <asm/irq.h>
5925 +#include <asm/irq-compat.h>
5926 #include <asm/machdep.h>
5929 -#include "open_pic.h"
5931 #define MAX_DEVNR 22
5934 unsigned char *Motherboard_routes;
5935 void (*Motherboard_non0)(struct pci_dev *);
5937 -void Powerplus_Map_Non0(struct pci_dev *);
5938 +void Mesquite_Map_Non0(struct pci_dev *);
5940 /* Used for Motorola to store system config register */
5941 static unsigned long *ProcInfo;
5943 +extern void chrp_do_IRQ(struct pt_regs *,int , int);
5945 /* Tables for known hardware */
5947 /* Motorola PowerStackII - Utah */
5948 @@ -508,51 +509,6 @@
5952 -/* Motorola PowerPlus architecture PCI IRQ tables */
5953 -/* Interrupt line values for INTA-D on primary/secondary MPIC inputs */
5955 -struct powerplus_irq_list
5957 - unsigned char primary[4]; /* INT A-D */
5958 - unsigned char secondary[4]; /* INT A-D */
5962 - * For standard PowerPlus boards, bus 0 PCI INTs A-D are routed to
5963 - * OpenPIC inputs 9-12. PCI INTs A-D from the on board P2P bridge
5964 - * are routed to OpenPIC inputs 5-8. These values are offset by
5965 - * 16 in the table to reflect the Linux kernel interrupt value.
5967 -struct powerplus_irq_list Powerplus_pci_IRQ_list =
5974 - * For the MCP750 (system slot board), bus 0 PCI INTs A-D are routed
5975 - * to OpenPIC inputs 8-11. PCI INTs A-D from the on board P2P bridge
5976 - * are routed to OpenPIC inputs 12-15. These values are offset by 16
5977 - * in the table to reflect the Linux kernel interrupt value.
5979 -struct powerplus_irq_list Mesquite_pci_IRQ_list =
5986 - * This table represents the standard PCI swizzle defined in the
5987 - * PCI bus specification.
5989 -static unsigned char prep_pci_intpins[4][4] =
5991 - { 1, 2, 3, 4}, /* Buses 0, 4, 8, ... */
5992 - { 2, 3, 4, 1}, /* Buses 1, 5, 9, ... */
5993 - { 3, 4, 1, 2}, /* Buses 2, 6, 10 ... */
5994 - { 4, 1, 2, 3}, /* Buses 3, 7, 11 ... */
5997 /* We have to turn on LEVEL mode for changed IRQ's */
5998 /* All PCI IRQ's need to be level mode, so this should be something
5999 * other than hard-coded as well... IRQ's are individually mappable
6001 #define MOT_RAVEN_PRESENT 0x1
6002 #define MOT_HAWK_PRESENT 0x2
6004 -int mot_entry = -1;
6005 +/* Keyboard present flag */
6006 +int prep_kbd_present = 1; /* Keyboard present by default */
6011 OpenPIC_InitSenses = mvme2600_openpic_initsenses;
6012 OpenPIC_NumInitSenses = sizeof(mvme2600_openpic_initsenses);
6014 - ppc_md.do_IRQ = open_pic_do_IRQ;
6015 + ppc_md.do_IRQ = chrp_do_IRQ;
6017 /* If raven is present on Motorola store the system config register
6019 @@ -795,17 +752,13 @@
6024 - * If a Motorola MVME2300, 2400, or MCPN750 board is detected
6025 - * disable keyboard controller initialization to avoid system
6027 + /* This is a hack. If this is a 2300 or 2400 mot board then there is
6028 + * no keyboard controller and we have to indicate that.
6030 base_mod = inb(MOTOROLA_BASETYPE_REG);
6031 if ((MotMPIC == MOT_HAWK_PRESENT) || (base_mod == 0xF9) ||
6032 - (base_mod == 0xFA) || (base_mod == 0xE1)) {
6033 - ppc_md.kbd_leds = NULL;
6034 - ppc_md.kbd_init_hw = NULL;
6036 + (base_mod == 0xFA) || (base_mod == 0xE1))
6037 + prep_kbd_present = 0;
6041 @@ -819,35 +772,33 @@
6043 unsigned char *routes;
6044 void (*map_non0_bus)(struct pci_dev *); /* For boards with more than bus 0 devices. */
6045 - struct powerplus_irq_list *pci_irq_list; /* List of PCI MPIC inputs */
6046 - unsigned char secondary_bridge_devfn; /* devfn of secondary bus transparent bridge */
6048 - {0x300, 0x00, 0x00, "MVME 2400", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6049 - {0x010, 0x00, 0x00, "Genesis", Genesis_pci_IRQ_map, Genesis_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6050 - {0x020, 0x00, 0x00, "Powerstack (Series E)", Comet_pci_IRQ_map, Comet_pci_IRQ_routes, NULL, NULL, 0x00},
6051 - {0x040, 0x00, 0x00, "Blackhawk (Powerstack)", Blackhawk_pci_IRQ_map, Blackhawk_pci_IRQ_routes, NULL, NULL, 0x00},
6052 - {0x050, 0x00, 0x00, "Omaha (PowerStack II Pro3000)", Omaha_pci_IRQ_map, Omaha_pci_IRQ_routes, NULL, NULL, 0x00},
6053 - {0x060, 0x00, 0x00, "Utah (Powerstack II Pro4000)", Utah_pci_IRQ_map, Utah_pci_IRQ_routes, NULL, NULL, 0x00},
6054 - {0x0A0, 0x00, 0x00, "Powerstack (Series EX)", Comet2_pci_IRQ_map, Comet2_pci_IRQ_routes, NULL, NULL, 0x00},
6055 - {0x1E0, 0xE0, 0x00, "Mesquite cPCI (MCP750)", Mesquite_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Mesquite_pci_IRQ_list, 0x00},
6056 - {0x1E0, 0xE1, 0x00, "Sitka cPCI (MCPN750)", Sitka_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6057 - {0x1E0, 0xE2, 0x00, "Mesquite cPCI (MCP750) w/ HAC", Mesquite_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Mesquite_pci_IRQ_list, 0xC0},
6058 - {0x1E0, 0xF6, 0x80, "MTX Plus", MTXplus_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xA0},
6059 - {0x1E0, 0xF6, 0x81, "Dual MTX Plus", MTXplus_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xA0},
6060 - {0x1E0, 0xF7, 0x80, "MTX wo/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6061 - {0x1E0, 0xF7, 0x81, "Dual MTX wo/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6062 - {0x1E0, 0xF8, 0x80, "MTX w/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6063 - {0x1E0, 0xF8, 0x81, "Dual MTX w/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6064 - {0x1E0, 0xF9, 0x00, "MVME 2300", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6065 - {0x1E0, 0xFA, 0x00, "MVME 2300SC/2600", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6066 - {0x1E0, 0xFB, 0x00, "MVME 2600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6067 - {0x1E0, 0xFC, 0x00, "MVME 2600/2700 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6068 - {0x1E0, 0xFD, 0x80, "MVME 3600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6069 - {0x1E0, 0xFD, 0x81, "MVME 4600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6070 - {0x1E0, 0xFE, 0x80, "MVME 3600 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6071 - {0x1E0, 0xFE, 0x81, "MVME 4600 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6072 - {0x1E0, 0xFF, 0x00, "MVME 1600-001 or 1600-011", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL, NULL, 0x00},
6073 - {0x000, 0x00, 0x00, "", NULL, NULL, NULL, 0x00}
6074 + {0x300, 0x00, 0x00, "MVME 2400", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6075 + {0x010, 0x00, 0x00, "Genesis", Genesis_pci_IRQ_map, Genesis_pci_IRQ_routes, NULL},
6076 + {0x020, 0x00, 0x00, "Powerstack (Series E)", Comet_pci_IRQ_map, Comet_pci_IRQ_routes, NULL},
6077 + {0x040, 0x00, 0x00, "Blackhawk (Powerstack)", Blackhawk_pci_IRQ_map, Blackhawk_pci_IRQ_routes, NULL},
6078 + {0x050, 0x00, 0x00, "Omaha (PowerStack II Pro3000)", Omaha_pci_IRQ_map, Omaha_pci_IRQ_routes, NULL},
6079 + {0x060, 0x00, 0x00, "Utah (Powerstack II Pro4000)", Utah_pci_IRQ_map, Utah_pci_IRQ_routes, NULL},
6080 + {0x0A0, 0x00, 0x00, "Powerstack (Series EX)", Comet2_pci_IRQ_map, Comet2_pci_IRQ_routes, NULL},
6081 + {0x1E0, 0xE0, 0x00, "Mesquite cPCI (MCP750)", Mesquite_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6082 + {0x1E0, 0xE1, 0x00, "Sitka cPCI (MCPN750)", Sitka_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6083 + {0x1E0, 0xE2, 0x00, "Mesquite cPCI (MCP750) w/ HAC", Mesquite_pci_IRQ_map, Raven_pci_IRQ_routes, Mesquite_Map_Non0},
6084 + {0x1E0, 0xF6, 0x80, "MTX Plus", MTXplus_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6085 + {0x1E0, 0xF6, 0x81, "Dual MTX Plus", MTXplus_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6086 + {0x1E0, 0xF7, 0x80, "MTX wo/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6087 + {0x1E0, 0xF7, 0x81, "Dual MTX wo/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6088 + {0x1E0, 0xF8, 0x80, "MTX w/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6089 + {0x1E0, 0xF8, 0x81, "Dual MTX w/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6090 + {0x1E0, 0xF9, 0x00, "MVME 2300", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6091 + {0x1E0, 0xFA, 0x00, "MVME 2300SC/2600", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6092 + {0x1E0, 0xFB, 0x00, "MVME 2600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6093 + {0x1E0, 0xFC, 0x00, "MVME 2600/2700 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6094 + {0x1E0, 0xFD, 0x80, "MVME 3600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6095 + {0x1E0, 0xFD, 0x81, "MVME 4600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6096 + {0x1E0, 0xFE, 0x80, "MVME 3600 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6097 + {0x1E0, 0xFE, 0x81, "MVME 4600 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6098 + {0x1E0, 0xFF, 0x00, "MVME 1600-001 or 1600-011", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
6099 + {0x000, 0x00, 0x00, "", NULL, NULL, NULL}
6102 __initfunc(unsigned long prep_route_pci_interrupts(void))
6104 unsigned char cpu_type;
6105 unsigned char base_mod;
6107 + int mot_entry = -1;
6109 cpu_type = inb(MOTOROLA_CPUTYPE_REG) & 0xF0;
6110 base_mod = inb(MOTOROLA_BASETYPE_REG);
6111 @@ -1038,91 +990,91 @@
6116 - * Remove a device from the kernel PCI device list based on its
6117 - * devfn identifier.
6121 -prep_exclude_pci_device(unsigned char devfn)
6123 +static unsigned int pci_localpirqs[4] =
6125 - struct pci_dev *dev, *pdev = NULL;
6132 - /* Walk the pci device list */
6133 - for(dev=pci_devices; dev; dev=dev->next) {
6134 - if (dev->devfn == devfn)
6137 - * If we find a matching device, adjust
6138 - * the list to remove the device.
6141 - pdev->next = dev->next;
6143 - pci_devices = dev->next;
6144 +static unsigned int pci_remotepirqs[4] =
6157 +static unsigned int pci_remotedev = 0xc0;
6160 -Powerplus_Map_Non0(struct pci_dev *dev)
6161 +Mesquite_Map_Non0(struct pci_dev *pdev)
6163 - struct pci_bus *pbus; /* Parent bus structure pointer */
6164 - struct pci_dev *tdev; /* Temporary device structure */
6165 - unsigned int devnum; /* Accumulated device number */
6166 - unsigned char intline; /* Linux interrupt value */
6167 - unsigned char intpin; /* PCI interrupt pin */
6169 - /* Check for valid PCI dev pointer */
6170 - if (dev == NULL) return;
6172 - /* Fill our temporary device, and get the device number */
6174 - devnum = PCI_SLOT(tdev->devfn);
6176 - /* Read the interrupt pin of the device and adjust for indexing */
6177 - pcibios_read_config_byte(tdev->bus->number, tdev->devfn,
6178 - PCI_INTERRUPT_PIN, &intpin);
6179 + struct pci_bus *pbus; /* Parent Bus Structure Pointer */
6180 + unsigned int devnum; /* Accumulated Device Number */
6181 + unsigned int irq; /* IRQ Value */
6183 - /* If device doesn't request an interrupt, return */
6184 - if ( (intpin < 1) || (intpin > 4) )
6187 + ** Device Interrupt Line register initialization.
6188 + ** The IRQ line number will be generated after
6189 + ** taking into account all the PCI-2-PCI bridge
6190 + ** devices between the device and the Host Bridge.
6192 + devnum = PCI_SLOT(pdev->devfn);
6195 + while ((pbus->parent)->primary != (pbus->parent)->secondary)
6197 + devnum += PCI_SLOT((pbus->self)->devfn);
6199 + pbus = pbus->parent;
6205 + ** By default, get the PCI local domain IRQ value.
6207 + irq = pci_localpirqs[devnum];
6210 + ** Determine if the device is located in the
6211 + ** remote domain or not. We must find the
6212 + ** domain's bridge device located on bus 0.
6216 + while (pbus->primary != 0)
6217 + pbus = pbus->parent;
6221 + ** Check the device/function of domain's bridge
6222 + ** device against the remote device/function.
6223 + ** If the same, then the device is located in
6224 + ** the remote domain. Thus, get the PCI remote
6225 + ** domain IRQ value.
6227 + if ((pbus->self)->devfn == pci_remotedev)
6228 + irq = pci_remotepirqs[devnum];
6230 - /* Walk up to bus 0, adjusting the interrupt pin for the standard
6231 - PCI bus swizzle. */
6233 - intpin = (prep_pci_intpins[devnum % 4][intpin]) - 1;
6234 - pbus = tdev->bus; /* up one level */
6235 - tdev = pbus->self;
6236 - devnum = PCI_SLOT(tdev->devfn);
6237 - } while(tdev->bus->number);
6239 - /* Use the primary interrupt inputs by default */
6240 - intline = mot_info[mot_entry].pci_irq_list->primary[intpin];
6242 - /* If the board has secondary interrupt inputs, walk the bus and
6243 - note the devfn of the bridge from bus 0. If it is the same as
6244 - the devfn of the bus bridge with secondary inputs, use those. */
6245 - if (mot_info[mot_entry].secondary_bridge_devfn)
6247 + ** Validate the IRQ number.
6253 - while (pbus->primary != 0)
6254 - pbus = pbus->parent;
6256 - if ((pbus->self)->devfn == mot_info[mot_entry].secondary_bridge_devfn)
6257 - intline = mot_info[mot_entry].pci_irq_list->secondary[intpin];
6259 + ** Set the device's Interrupt Line register
6260 + ** to the IRQ number and save it in the
6261 + ** device's structure.
6264 + pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, (u8)irq);
6270 - /* Write calculated interrupt value to header and device list */
6271 - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, (u8)intline);
6272 - dev->irq = intline;
6276 int motopenpic_to_irq(int n)
6277 @@ -1130,7 +1082,7 @@
6281 - return(n+open_pic.irq_offset);
6282 + return(openpic_to_irq(n));
6286 @@ -1169,17 +1121,6 @@
6287 dev->devfn, 0x44, short_reg);
6290 - if ((dev = pci_find_device(PCI_VENDOR_ID_WINBOND,
6291 - PCI_DEVICE_ID_WINBOND_82C105, dev))){
6293 - /* Disable LEGIRQ mode so PCI INTs are routed to
6295 - pci_write_config_dword(dev, 0x40, 0x10ff00a1);
6297 - /* Enable LEGIRQ for PCI INT -> 8259 IRQ routing */
6298 - pci_write_config_dword(dev, 0x40, 0x10ff08a1);
6304 @@ -1197,15 +1138,6 @@
6306 prep_route_pci_interrupts();
6309 - * If MTX+, exclude the SL82C105 IDE controller so the driver
6312 - if ( _prep_type == _PREP_Motorola )
6313 - if ( strstr(mot_info[mot_entry].name, "MTX Plus") )
6314 - /* On MTX+, SL82C105 is at IDSEL 0xb function 0x1 */
6315 - prep_exclude_pci_device(PCI_DEVFN(0xb, 0x1));
6319 printk("Setting PCI interrupts for a \"%s\"\n", Motherboard_map_name);
6320 @@ -1219,7 +1151,7 @@
6321 motopenpic_to_irq(Motherboard_map[PCI_SLOT(dev->devfn)]);
6323 pcibios_write_config_byte(dev->bus->number, dev->devfn,
6324 - PCI_INTERRUPT_LINE, dev->irq);
6325 + PCI_INTERRUPT_PIN, dev->irq);
6327 if (Motherboard_non0 != NULL)
6328 Motherboard_non0(dev);
6329 diff -urN linux.orig/arch/ppc/kernel/prep_setup.c linux/arch/ppc/kernel/prep_setup.c
6330 --- linux.orig/arch/ppc/kernel/prep_setup.c Sun Mar 25 18:31:49 2001
6331 +++ linux/arch/ppc/kernel/prep_setup.c Thu Jul 11 15:46:34 2002
6333 #include <linux/timex.h>
6334 #include <linux/pci.h>
6335 #include <linux/openpic.h>
6336 -#include <linux/delay.h>
6338 #include <asm/mmu.h>
6339 #include <asm/processor.h>
6340 #include <asm/residual.h>
6342 +#include <asm/irq-compat.h>
6343 #include <asm/pgtable.h>
6344 #include <asm/ide.h>
6345 #include <asm/cache.h>
6347 #include <asm/prep_nvram.h>
6348 #include <asm/raven.h>
6349 #include <asm/keyboard.h>
6350 -#include <asm/time.h>
6351 -#include <asm/vga.h>
6355 #include "local_irq.h"
6357 #include "open_pic.h"
6358 @@ -102,12 +102,16 @@
6359 extern PTE *Hash, *Hash_end;
6360 extern unsigned long Hash_size, Hash_mask;
6361 extern int probingmem;
6362 +extern unsigned long loops_per_jiffy;
6364 #ifdef CONFIG_BLK_DEV_RAM
6365 extern int rd_doload; /* 1 = load ramdisk, 0 = don't load */
6366 extern int rd_prompt; /* 1 = prompt for ramdisk, 0 = don't prompt */
6367 extern int rd_image_start; /* starting block # of image */
6369 +#ifdef CONFIG_VGA_CONSOLE
6370 +unsigned long vgacon_remap_base;
6378 if (OpenPIC != NULL) {
6379 - open_pic.irq_offset = 16;
6380 for ( i = 16 ; i < 36 ; i++ )
6381 irq_desc[i].ctl = &open_pic;
6383 @@ -615,14 +618,8 @@
6384 irq_desc[i].ctl = &i8259_pic;
6387 - request_irq(OPENPIC_VEC_IPI, openpic_ipi_action,
6388 + request_irq(openpic_to_irq(OPENPIC_VEC_SPURIOUS), openpic_ipi_action,
6390 - request_irq(OPENPIC_VEC_IPI+1, openpic_ipi_action,
6391 - 0, "IPI1 (invalidate TLB)", 0);
6392 - request_irq(OPENPIC_VEC_IPI+2, openpic_ipi_action,
6393 - 0, "IPI2 (stop CPU)", 0);
6394 - request_irq(OPENPIC_VEC_IPI+3, openpic_ipi_action,
6395 - 0, "IPI3 (reschedule)", 0);
6396 #endif /* __SMP__ */
6399 diff -urN linux.orig/arch/ppc/kernel/prep_time.c linux/arch/ppc/kernel/prep_time.c
6400 --- linux.orig/arch/ppc/kernel/prep_time.c Sun Mar 25 18:31:49 2001
6401 +++ linux/arch/ppc/kernel/prep_time.c Thu Jul 11 15:43:29 2002
6403 #include <asm/prep_nvram.h>
6404 #include <asm/mk48t59.h>
6406 -#include <asm/time.h>
6410 * The motorola uses the m48t18 rtc (includes DS1643) whose registers
6411 diff -urN linux.orig/arch/ppc/kernel/process.c linux/arch/ppc/kernel/process.c
6412 --- linux.orig/arch/ppc/kernel/process.c Sun Mar 25 18:31:49 2001
6413 +++ linux/arch/ppc/kernel/process.c Thu Jul 11 15:43:29 2002
6415 #include <asm/mmu_context.h>
6417 int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs);
6418 -int dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs);
6419 extern unsigned long _get_SP(void);
6421 struct task_struct *last_task_used_math = NULL;
6422 -struct task_struct *last_task_used_altivec = NULL;
6423 static struct vm_area_struct init_mmap = INIT_MMAP;
6424 static struct fs_struct init_fs = INIT_FS;
6425 static struct files_struct init_files = INIT_FILES;
6430 -#ifdef CONFIG_ALTIVEC
6432 -dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs)
6434 - if (regs->msr & MSR_VEC)
6435 - giveup_altivec(current);
6436 - memcpy(vrregs, ¤t->tss.vr[0], sizeof(*vrregs));
6441 -enable_kernel_altivec(void)
6444 - if (current->tss.regs && (current->tss.regs->msr & MSR_VEC))
6445 - giveup_altivec(current);
6447 - giveup_altivec(NULL); /* just enable AltiVec for kernel - force */
6449 - giveup_altivec(last_task_used_altivec);
6450 -#endif /* __SMP __ */
6451 - printk("MSR_VEC in enable_altivec_kernel\n");
6453 -#endif /* CONFIG_ALTIVEC */
6456 enable_kernel_fp(void)
6458 @@ -221,53 +194,22 @@
6459 _enable_interrupts(s);
6467 -void print_bits(unsigned int val, struct bits *bits)
6469 - const char *sep = "";
6472 - for (; bits->bit != 0; ++bits) {
6473 - if (val & bits->bit) {
6474 - printk("%s%s", sep, bits->name);
6481 -struct bits msr_bits[] = {
6492 -void show_regs(struct pt_regs *regs)
6493 +void show_regs(struct pt_regs * regs)
6497 printk("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx\n",
6498 regs->nip, regs->xer, regs->link, regs,regs->trap);
6499 - printk("MSR: %08lx ", regs->msr);
6500 - print_bits(regs->msr, msr_bits);
6502 + printk("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
6503 + regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
6504 + regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
6505 + regs->msr&MSR_IR ? 1 : 0,
6506 + regs->msr&MSR_DR ? 1 : 0);
6507 printk("TASK = %p[%d] '%s' mm->pgd %p ",
6508 current, current->pid, current->comm, current->mm->pgd);
6509 printk("Last syscall: %ld ", current->tss.last_syscall);
6510 - if (last_task_used_math)
6511 - printk("\nlast math %p", last_task_used_math);
6512 - if (last_task_used_altivec)
6513 - printk("\nlast altivec %p", last_task_used_altivec);
6515 + printk("\nlast math %p", last_task_used_math);
6518 printk(" CPU: %d last CPU: %d", current->processor,current->last_processor);
6519 #endif /* __SMP__ */
6520 @@ -314,16 +256,12 @@
6522 if (last_task_used_math == current)
6523 last_task_used_math = NULL;
6524 - if (last_task_used_altivec == current)
6525 - last_task_used_altivec = NULL;
6528 void flush_thread(void)
6530 if (last_task_used_math == current)
6531 last_task_used_math = NULL;
6532 - if (last_task_used_altivec == current)
6533 - last_task_used_altivec = NULL;
6537 @@ -381,19 +319,6 @@
6538 if (regs->msr & MSR_FP)
6539 giveup_fpu(current);
6541 -#ifdef CONFIG_ALTIVEC
6543 - * copy altiVec info - assume lazy altiVec switch
6546 - if (regs->msr & MSR_VEC)
6547 - giveup_altivec(current);
6549 - memcpy(&p->tss.vr, ¤t->tss.vr, sizeof(p->tss.vr));
6550 - p->tss.vscr = current->tss.vscr;
6551 - childregs->msr &= ~MSR_VEC;
6552 -#endif /* CONFIG_ALTIVEC */
6554 memcpy(&p->tss.fpr, ¤t->tss.fpr, sizeof(p->tss.fpr));
6555 p->tss.fpscr = current->tss.fpscr;
6556 childregs->msr &= ~MSR_FP;
6558 shove_aux_table(sp);
6559 if (last_task_used_math == current)
6560 last_task_used_math = 0;
6561 - if (last_task_used_altivec == current)
6562 - last_task_used_altivec = 0;
6563 current->tss.fpscr = 0;
6566 @@ -516,10 +439,6 @@
6568 if (regs->msr & MSR_FP)
6569 giveup_fpu(current);
6570 -#ifdef CONFIG_ALTIVEC
6571 - if (regs->msr & MSR_VEC)
6572 - giveup_altivec(current);
6573 -#endif /* CONFIG_ALTIVEC */
6574 error = do_execve(filename, (char **) a1, (char **) a2, regs);
6577 diff -urN linux.orig/arch/ppc/kernel/prom.c linux/arch/ppc/kernel/prom.c
6578 --- linux.orig/arch/ppc/kernel/prom.c Sun Mar 25 18:37:30 2001
6579 +++ linux/arch/ppc/kernel/prom.c Thu Jul 11 15:43:29 2002
6581 #include <linux/string.h>
6582 #include <linux/init.h>
6583 #include <linux/version.h>
6584 -#include <linux/fs.h>
6585 -#include <linux/console.h>
6586 #include <asm/spinlock.h>
6587 #include <asm/prom.h>
6588 #include <asm/page.h>
6589 #include <asm/processor.h>
6590 #include <asm/irq.h>
6591 +#include <asm/irq-compat.h>
6593 #include <asm/smp.h>
6594 #include <asm/bootx.h>
6595 #include <asm/system.h>
6596 #include <asm/gemini.h>
6597 -#include <asm/linux_logo.h>
6598 -#include <asm/mmu.h>
6599 -#include <asm/pgtable.h>
6600 -#include <asm/adb.h>
6601 -#include <asm/pmu.h>
6604 * Properties whose value is longer than this get excluded from our
6605 * copy of the device tree. This way we don't waste space storing
6606 * things like "driver,AAPL,MacOS,PowerPC" properties.
6609 #define MAX_PROPERTY_LENGTH 1024
6613 char *of_stdout_device = 0;
6615 prom_entry prom = 0;
6616 -ihandle prom_chosen = 0, prom_stdout = 0, prom_disp_node = 0;
6617 +ihandle prom_chosen = 0, prom_stdout = 0;
6618 int prom_version = 0;
6620 extern char *klimit;
6622 char *bootdevice = 0;
6624 -unsigned int rtas_data = 0; /* physical pointer */
6625 +unsigned int rtas_data = 0; /* virtual pointer */
6626 unsigned int rtas_entry = 0; /* physical pointer */
6627 unsigned int rtas_size = 0;
6628 unsigned int old_rtas = 0;
6630 -/* Set for a newworld machine */
6631 -int use_of_interrupt_tree = 0;
6632 -int pmac_newworld = 0;
6634 static struct device_node *allnodes = 0;
6636 -#ifdef CONFIG_BOOTX_TEXT
6639 - * The VGA font is in the _pmac section. Can't this cause problems with CHRP
6640 - * using some of the prom_xxxx functions ?
6641 - * All this need to be moved in a separate source file anyway
6644 static void clearscreen(void);
6645 static void flushscreen(void);
6647 +#ifdef CONFIG_BOOTX_TEXT
6649 void drawchar(char c);
6650 void drawstring(const char *c);
6651 -void drawhex(unsigned long v);
6652 +static void drawhex(unsigned long v);
6653 static void scrollscreen(void);
6654 -static void prepare_disp_BAT(void);
6655 -static void boot_console_write(struct console *co, const char *s,
6658 static void draw_byte(unsigned char c, long locX, long locY);
6659 -static void draw_byte_32(unsigned char *bits, unsigned long *base, int rb);
6660 -static void draw_byte_16(unsigned char *bits, unsigned long *base, int rb);
6661 -static void draw_byte_8(unsigned char *bits, unsigned long *base, int rb);
6663 -/* We want those in the data section */
6664 -static long g_loc_X = 0;
6665 -static long g_loc_Y = 0;
6666 -static long g_max_loc_X = 0;
6667 -static long g_max_loc_Y = 0;
6669 -unsigned long disp_BATL = 0;
6670 -unsigned long disp_BATU = 0;
6671 +static void draw_byte_32(unsigned char *bits, unsigned long *base);
6672 +static void draw_byte_16(unsigned char *bits, unsigned long *base);
6673 +static void draw_byte_8(unsigned char *bits, unsigned long *base);
6675 +static long g_loc_X;
6676 +static long g_loc_Y;
6677 +static long g_max_loc_X;
6678 +static long g_max_loc_Y;
6680 #define cmapsz (16*256)
6682 static unsigned char vga_font[cmapsz];
6684 -static struct console boot_cons = {
6686 - boot_console_write,
6697 -static int boot_cons_registered = 0;
6699 -#endif /* CONFIG_BOOTX_TEXT */
6703 static void *call_prom(const char *service, int nargs, int nret, ...);
6704 @@ -175,25 +138,15 @@
6705 unsigned long, struct device_node ***);
6706 static unsigned long finish_node(struct device_node *, unsigned long,
6708 -static unsigned long finish_node_interrupts(struct device_node *, unsigned long);
6709 static unsigned long check_display(unsigned long);
6710 static int prom_next_node(phandle *);
6711 static void *early_get_property(unsigned long, unsigned long, char *);
6713 -#ifdef CONFIG_BOOTX_TEXT
6714 -static void setup_disp_fake_bi(ihandle dp);
6715 -static void prom_welcome(boot_infos_t* bi, unsigned long phys);
6718 extern void enter_rtas(void *);
6719 extern unsigned long reloc_offset(void);
6721 extern char cmd_line[512]; /* XXX */
6722 boot_infos_t *boot_infos = 0; /* init it so it's in data segment not bss */
6723 -#ifdef CONFIG_BOOTX_TEXT
6724 -boot_infos_t *disp_bi = 0;
6725 -boot_infos_t fake_bi = {0,};
6729 * prom_init() is called very early on, before the kernel text
6731 return prom_args.args[nargs];
6737 prom_print(const char *msg)
6740 if (RELOC(prom_stdout) == 0)
6742 #ifdef CONFIG_BOOTX_TEXT
6743 - if (RELOC(disp_bi) != 0)
6744 + if (RELOC(boot_infos) != 0)
6748 @@ -307,22 +260,6 @@
6753 -prom_print_hex(unsigned int v)
6758 - for (i = 0; i < 8; ++i) {
6759 - c = (v >> ((7-i)*4)) & 0xf;
6760 - c += (c >= 10)? ('a' - 10): '0';
6768 unsigned long smp_ibm_chrp_hack __initdata = 0;
6773 char type[16], *path;
6777 ihandle prom_rtas, prom_mmu, prom_op;
6778 unsigned long offset = reloc_offset();
6779 @@ -365,19 +301,22 @@
6780 unsigned long space;
6781 unsigned long ptr, x;
6783 +#ifdef CONFIG_BOOTX_TEXT
6784 + unsigned long flags;
6787 RELOC(boot_infos) = PTRUNRELOC(bi);
6788 if (!BOOT_INFO_IS_V2_COMPATIBLE(bi))
6789 bi->logicalDisplayBase = 0;
6793 #ifdef CONFIG_BOOTX_TEXT
6796 RELOC(g_max_loc_X) = (bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) / 8;
6797 RELOC(g_max_loc_Y) = (bi->dispDeviceRect[3] - bi->dispDeviceRect[1]) / 16;
6798 - RELOC(disp_bi) = PTRUNRELOC(bi);
6802 /* Test if boot-info is compatible. Done only in config CONFIG_BOOTX_TEXT since
6803 there is nothing much we can do with an incompatible version, except display
6804 a message and eventually hang the processor...
6805 @@ -388,10 +327,24 @@
6806 if (!BOOT_INFO_IS_COMPATIBLE(bi))
6807 prom_print(RELOC(" !!! WARNING - Incompatible version of BootX !!!\n\n\n"));
6809 - prom_welcome(bi, phys);
6810 + prom_print(RELOC("Welcome to Linux, kernel " UTS_RELEASE "\n"));
6811 + prom_print(RELOC("\nstarted at : 0x"));
6812 + drawhex(reloc_offset() + KERNELBASE);
6813 + prom_print(RELOC("\nlinked at : 0x"));
6814 + drawhex(KERNELBASE);
6815 + prom_print(RELOC("\nframe buffer at : 0x"));
6816 + drawhex((unsigned long)bi->dispDeviceBase);
6817 + prom_print(RELOC(" (phys), 0x"));
6818 + drawhex((unsigned long)bi->logicalDisplayBase);
6819 + prom_print(RELOC(" (log)"));
6820 + prom_print(RELOC("\nMSR : 0x"));
6821 + __asm__ __volatile__ ("mfmsr %0" : "=r" ((flags)) : : "memory");
6823 + prom_print(RELOC("\n\n"));
6825 + /* Out of the #if/#endif since it flushes the clearscreen too */
6827 -#endif /* CONFIG_BOOTX_TEXT */
6830 /* New BootX enters kernel with MMU off, i/os are not allowed
6831 here. This hack will have been done by the boostrap anyway.
6836 #ifdef CONFIG_BOOTX_TEXT
6837 - prepare_disp_BAT();
6838 prom_print(RELOC("booting...\n"));
6841 @@ -470,15 +422,12 @@
6843 sz = (int)call_prom(RELOC("getprop"), 4, 1, prom_op, RELOC("model"), model, 64);
6845 - if ( strncmp(model,RELOC("IBM"),3) ) {
6847 - for (c = model; *c; c++)
6848 - if (*c >= '0' && *c <= '9') {
6849 - RELOC(prom_version) = *c - '0';
6855 + for (c = model; *c; c++)
6856 + if (*c >= '0' && *c <= '9') {
6857 + RELOC(prom_version) = *c - '0';
6862 if (RELOC(prom_version) >= 3)
6863 @@ -498,6 +447,15 @@
6864 RELOC(bootdevice) = PTRUNRELOC(d);
6865 mem = ALIGN(mem + strlen(d) + 1);
6868 + mem = check_display(mem);
6870 + prom_print(RELOC("copying OF device tree..."));
6871 + mem = copy_device_tree(mem, mem + (1<<20));
6872 + prom_print(RELOC("done\n"));
6875 + RELOC(klimit) = (char *) (mem - offset);
6877 prom_rtas = call_prom(RELOC("finddevice"), 1, 1, RELOC("/rtas"));
6878 if (prom_rtas != (void *) -1) {
6879 @@ -509,14 +467,18 @@
6880 RELOC(rtas_data) = 0;
6883 - * Ask OF for some space for RTAS.
6884 + * We do _not_ want the rtas_data inside the klimit
6885 + * boundry since it'll be squashed when we do the
6886 + * relocate of the kernel on chrp right after prom_init()
6887 + * in head.S. So, we just pick a spot in memory.
6890 - RELOC(rtas_data) = (unsigned int)
6891 - call_prom(RELOC("claim"), 3, 1, 0,
6892 - RELOC(rtas_size), 0x1000);
6893 - prom_print(RELOC("rtas at "));
6894 - prom_print_hex(RELOC(rtas_data));
6895 - prom_print(RELOC("\n"));
6897 + mem = (mem + 4095) & -4096;
6898 + RELOC(rtas_data) = mem + KERNELBASE;
6899 + mem += RELOC(rtas_size);
6901 + RELOC(rtas_data) = (6<<20) + KERNELBASE;
6903 prom_rtas = call_prom(RELOC("open"), 1, 1, RELOC("/rtas"));
6907 prom_args.args[0] = RELOC("instantiate-rtas");
6908 prom_args.args[1] = prom_rtas;
6909 - prom_args.args[2] = (void *) RELOC(rtas_data);
6910 + prom_args.args[2] = ((void *)(RELOC(rtas_data)-KERNELBASE));
6911 RELOC(prom)(&prom_args);
6912 if (prom_args.args[nargs] != 0)
6914 @@ -542,15 +504,6 @@
6915 prom_print(RELOC(" done\n"));
6918 - mem = check_display(mem);
6920 - prom_print(RELOC("copying OF device tree..."));
6921 - /* N.B. do this *after* any claims */
6922 - mem = copy_device_tree(mem, mem + (1<<20));
6923 - prom_print(RELOC("done\n"));
6925 - RELOC(klimit) = (char *) (mem - offset);
6927 /* If we are already running at 0xc0000000, we assume we were loaded by
6928 * an OF bootloader which did set a BAT for us. This breaks OF translate
6929 * so we force phys to be 0
6930 @@ -582,11 +535,6 @@
6934 -#ifdef CONFIG_BOOTX_TEXT
6935 - if (RELOC(prom_disp_node) != 0)
6936 - setup_disp_fake_bi(RELOC(prom_disp_node));
6941 * With CHRP SMP we need to use the OF to start the other
6942 @@ -607,11 +555,7 @@
6943 * is in its holding pattern code.
6947 - * This code crashes on some pmacs since the memory at 8M is not
6948 - * claim'ed and so can be unmapped. -- BenH
6952 extern void __secondary_hold(void);
6958 - for (node = 0; chrp && prom_next_node(&node);)
6959 + for (node = 0; prom_next_node(&node);)
6962 call_prom(RELOC("getprop"), 4, 1, node, RELOC("device_type"),
6963 @@ -666,132 +610,19 @@
6965 prom_print(RELOC("...failed\n"));
6967 +#endif /* CONFIG_SMP */
6970 - /* If PowerMac, then use quiesce call */
6972 + /* If OpenFirmware version >= 3, then use quiesce call */
6973 + if (RELOC(prom_version) >= 3) {
6974 prom_print(RELOC("Calling quiesce ...\n"));
6975 call_prom(RELOC("quiesce"), 0, 0);
6976 offset = reloc_offset();
6977 phys = offset + KERNELBASE;
6980 -#ifdef CONFIG_BOOTX_TEXT
6981 - if (!chrp && RELOC(disp_bi)) {
6982 - RELOC(prom_stdout) = 0;
6984 - prepare_disp_BAT();
6985 - prom_welcome(PTRRELOC(RELOC(disp_bi)), phys);
6989 - prom_print(RELOC("booting...\n"));
6993 -#ifdef CONFIG_BOOTX_TEXT
6995 -prom_welcome(boot_infos_t* bi, unsigned long phys)
6997 - unsigned long offset = reloc_offset();
6998 - unsigned long flags;
6999 - unsigned long pvr;
7001 - prom_print(RELOC("Welcome to Linux, kernel " UTS_RELEASE "\n"));
7002 - prom_print(RELOC("\nstarted at : 0x"));
7004 - prom_print(RELOC("\nlinked at : 0x"));
7005 - drawhex(KERNELBASE);
7006 - prom_print(RELOC("\nframe buffer at : 0x"));
7007 - drawhex((unsigned long)bi->dispDeviceBase);
7008 - prom_print(RELOC(" (phys), 0x"));
7009 - drawhex((unsigned long)bi->logicalDisplayBase);
7010 - prom_print(RELOC(" (log)"));
7011 - prom_print(RELOC("\nMSR : 0x"));
7012 - __asm__ __volatile__ ("mfmsr %0" : "=r" (flags));
7014 - __asm__ __volatile__ ("mfspr %0, 287" : "=r" (pvr));
7017 - prom_print(RELOC("\nHID0 : 0x"));
7018 - __asm__ __volatile__ ("mfspr %0, 1008" : "=r" (flags));
7021 - if (pvr == 8 || pvr == 12) {
7022 - prom_print(RELOC("\nICTC : 0x"));
7023 - __asm__ __volatile__ ("mfspr %0, 1019" : "=r" (flags));
7026 - prom_print(RELOC("\n\n"));
7029 -void showvalue(char *str, unsigned long val)
7036 -/* Calc BAT values for mapping the display and store them
7037 - * in disp_BATH and disp_BATL. Those values are then used
7038 - * from head.S to map the display during identify_machine()
7041 - * For now, the display is mapped in place (1:1). This should
7042 - * be changed if the display physical address overlaps
7043 - * KERNELBASE, which is fortunately not the case on any machine
7044 - * I know of. This mapping is temporary and will disappear as
7045 - * soon as the setup done by MMU_Init() is applied
7047 - * For now, we align the BAT and then map 8Mb on 601 and 16Mb
7048 - * on other PPCs. This may cause trouble if the framebuffer
7049 - * is really badly aligned, but I didn't encounter this case
7054 -prepare_disp_BAT(void)
7056 - unsigned long offset = reloc_offset();
7057 - boot_infos_t* bi = PTRRELOC(RELOC(disp_bi));
7058 - unsigned long addr = (unsigned long)bi->dispDeviceBase;
7060 - if ((_get_PVR() >> 16) != 1) {
7061 - /* 603, 604, G3, G4, ... */
7062 - addr &= 0xFF000000UL;
7063 - RELOC(disp_BATU) = addr | (BL_16M<<2) | 2;
7064 - RELOC(disp_BATL) = addr | (_PAGE_NO_CACHE | _PAGE_GUARDED | BPP_RW);
7067 - addr &= 0xFF800000UL;
7068 - RELOC(disp_BATU) = addr | (_PAGE_NO_CACHE | PP_RWXX) | 4;
7069 - RELOC(disp_BATL) = addr | BL_8M | 0x40;
7071 - bi->logicalDisplayBase = bi->dispDeviceBase;
7078 -prom_set_color(ihandle ih, int i, int r, int g, int b)
7080 - struct prom_args prom_args;
7081 - unsigned long offset = reloc_offset();
7083 - prom_args.service = RELOC("call-method");
7084 - prom_args.nargs = 6;
7085 - prom_args.nret = 1;
7086 - prom_args.args[0] = RELOC("color!");
7087 - prom_args.args[1] = ih;
7088 - prom_args.args[2] = (void *) i;
7089 - prom_args.args[3] = (void *) b;
7090 - prom_args.args[4] = (void *) g;
7091 - prom_args.args[5] = (void *) r;
7092 - RELOC(prom)(&prom_args);
7093 - return (int) prom_args.args[6];
7097 * If we have a display that we don't know how to drive,
7098 * we will want to try to execute OF's open method for it
7099 @@ -804,32 +635,11 @@
7100 static unsigned long
7101 check_display(unsigned long mem)
7107 unsigned long offset = reloc_offset();
7108 - char type[16], *path, name[32];
7109 - static unsigned char default_colors[] = {
7128 - RELOC(prom_disp_node) = 0;
7129 + char type[16], *path;
7131 for (node = 0; prom_next_node(&node); ) {
7133 @@ -837,12 +647,6 @@
7134 type, sizeof(type));
7135 if (strcmp(type, RELOC("display")) != 0)
7138 - call_prom(RELOC("getprop"), 4, 1, node, RELOC("name"),
7139 - name, sizeof(name));
7140 - if (!strcmp(name, RELOC("offscreen-display")))
7143 /* It seems OF doesn't null-terminate the path :-( */
7144 path = (char *) mem;
7145 memset(path, 0, 256);
7146 @@ -858,24 +662,6 @@
7148 prom_print(RELOC("... ok\n"));
7150 - if (RELOC(prom_disp_node) == 0)
7151 - RELOC(prom_disp_node) = node;
7153 - /* Setup a useable color table when the appropriate
7154 - * method is available. Should update this to set-colors */
7155 - for (i = 0; i < 32; i++)
7156 - if (prom_set_color(ih, i, RELOC(default_colors)[i*3],
7157 - RELOC(default_colors)[i*3+1],
7158 - RELOC(default_colors)[i*3+2]) != 0)
7161 - for (i = 0; i < LINUX_LOGO_COLORS; i++)
7162 - if (prom_set_color(ih, i + 32,
7163 - RELOC(linux_logo_red)[i],
7164 - RELOC(linux_logo_green)[i],
7165 - RELOC(linux_logo_blue)[i]) != 0)
7169 * If this display is the device that OF is using for stdout,
7170 * move it to the front of the list.
7171 @@ -892,85 +678,9 @@
7172 if (RELOC(prom_num_displays) >= FB_MAX)
7175 -#endif /* CONFIG_FB */
7179 -/* This function will enable the early boot text when doing OF booting. This
7180 - * way, xmon output should work too
7182 -#ifdef CONFIG_BOOTX_TEXT
7185 -setup_disp_fake_bi(ihandle dp)
7188 - int width = 640, height = 480, depth = 8, pitch;
7191 - unsigned long offset = reloc_offset();
7193 - prom_print(RELOC("Initing fake screen\n"));
7196 - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("depth"), &len, sizeof(len));
7198 - prom_print(RELOC("Warning: assuming display depth = 8\n"));
7202 - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("width"), &len, sizeof(len));
7205 - prom_print(RELOC("Failed to get width\n"));
7209 - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("height"), &len, sizeof(len));
7211 - if (height == 0) {
7212 - prom_print(RELOC("Failed to get height\n"));
7216 - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("linebytes"), &len, sizeof(len));
7219 - prom_print(RELOC("Failed to get pitch\n"));
7224 - address = len = 0;
7226 - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("address"), &len, sizeof(len));
7228 - if (address == 0) {
7229 - prom_print(RELOC("Failed to get address\n"));
7233 - /* kludge for valkyrie */
7234 - if (strcmp(dp->name, "valkyrie") == 0)
7235 - address += 0x1000;
7238 - RELOC(disp_bi) = &fake_bi;
7239 - bi = PTRRELOC((&fake_bi));
7240 - RELOC(g_loc_X) = 0;
7241 - RELOC(g_loc_Y) = 0;
7242 - RELOC(g_max_loc_X) = width / 8;
7243 - RELOC(g_max_loc_Y) = height / 16;
7244 - bi->logicalDisplayBase = (unsigned char *)address;
7245 - bi->dispDeviceBase = (unsigned char *)address;
7246 - bi->dispDeviceRowBytes = pitch;
7247 - bi->dispDeviceDepth = depth;
7248 - bi->dispDeviceRect[0] = bi->dispDeviceRect[1] = 0;
7249 - bi->dispDeviceRect[2] = width;
7250 - bi->dispDeviceRect[3] = height;
7256 prom_next_node(phandle *nodep)
7257 @@ -1106,18 +816,6 @@
7259 unsigned long mem = (unsigned long) klimit;
7261 - /* All newworld machines and CHRP now use the interrupt tree */
7262 - struct device_node *np = allnodes;
7263 - while(np && (_machine == _MACH_Pmac)) {
7264 - if (get_property(np, "interrupt-parent", 0)) {
7265 - pmac_newworld = 1;
7270 - if ((_machine == _MACH_chrp) || (boot_infos == 0 && pmac_newworld))
7271 - use_of_interrupt_tree = 1;
7273 mem = finish_node(allnodes, mem, NULL);
7274 printk(KERN_INFO "device tree used %lu bytes\n",
7275 mem - (unsigned long) allnodes);
7276 @@ -1158,9 +856,6 @@
7277 if (ifunc != NULL) {
7278 mem_start = ifunc(np, mem_start);
7280 - if (use_of_interrupt_tree) {
7281 - mem_start = finish_node_interrupts(np, mem_start);
7284 /* the f50 sets the name to 'display' and 'compatible' to what we
7285 * expect for the name -- Cort
7286 @@ -1207,151 +902,6 @@
7290 -/* This routine walks the interrupt tree for a given device node and gather
7291 - * all necessary informations according to the draft interrupt mapping
7292 - * for CHRP. The current version was only tested on Apple "Core99" machines
7293 - * and may not handle cascaded controllers correctly.
7296 -static unsigned long
7297 -finish_node_interrupts(struct device_node *np, unsigned long mem_start)
7299 - /* Finish this node */
7300 - unsigned int *isizep, *asizep, *interrupts, *map, *map_mask, *reg;
7302 - struct device_node *node, *parent_node;
7303 - int l, isize, ipsize, asize, map_size, regpsize;
7305 - /* Currently, we don't look at all nodes with no "interrupts" property */
7306 - interrupts = (unsigned int *)get_property(np, "interrupts", &l);
7307 - if (interrupts == NULL)
7311 - reg = (unsigned int *)get_property(np, "reg", &l);
7314 - /* We assume default interrupt cell size is 1 (bugus ?) */
7319 - /* We adjust the cell size if the current parent contains an #interrupt-cells
7321 - isizep = (unsigned int *)get_property(node, "#interrupt-cells", &l);
7325 - /* We don't do interrupt cascade (ISA) for now, we stop on the first
7326 - * controller found
7328 - if (get_property(node, "interrupt-controller", &l)) {
7330 - np->intrs = (struct interrupt_info *) mem_start;
7331 - np->n_intrs = ipsize / isize;
7332 - mem_start += np->n_intrs * sizeof(struct interrupt_info);
7333 - for (i = 0; i < np->n_intrs; ++i) {
7334 - np->intrs[i].line = *interrupts++;
7335 - np->intrs[i].sense = 0;
7337 - np->intrs[i].sense = *interrupts++;
7338 - for (j=2; j<isize; j++)
7342 - * On the CHRP LongTrail, ISA interrupts are cascaded through
7343 - * the OpenPIC. For compatibility reasons, ISA interrupts are
7344 - * numbered 0-15 and OpenPIC interrupts start at 16.
7345 - * Hence we have to fixup the interrupt numbers for sources
7346 - * that are attached to the OpenPIC and thus have an
7347 - * interrupt-controller named `open-pic'.
7349 - * FIXME: The name of the interrupt-controller node for the
7350 - * `ide' node has no name, although its parent is
7351 - * correctly specified in interrupt-map, so we check
7352 - * for a NULL name as well.
7354 - if (_machine == _MACH_chrp &&
7355 - ((node->name && !strcmp(node->name, "open-pic")) ||
7357 - for (i = 0; i < np->n_intrs; ++i)
7358 - np->intrs[i].line = np->intrs[i].line + NUM_8259_INTERRUPTS;
7362 - /* We lookup for an interrupt-map. This code can only handle one interrupt
7363 - * per device in the map. We also don't handle #address-cells in the parent
7364 - * I skip the pci node itself here, may not be necessary but I don't like it's
7368 - map = (unsigned int *)get_property(node, "interrupt-map", &l);
7372 - int i, found, temp_isize;
7374 - map_mask = (unsigned int *)get_property(node, "interrupt-map-mask", &l);
7375 - asizep = (unsigned int *)get_property(node, "#address-cells", &l);
7376 - if (asizep && l == sizeof(unsigned int))
7381 - while(map_size>0 && !found) {
7383 - for (i=0; i<asize; i++) {
7384 - unsigned int mask = map_mask ? map_mask[i] : 0xffffffff;
7385 - if (!reg || (i>=regpsize) || ((mask & *map) != (mask & reg[i])))
7390 - for (i=0; i<isize; i++) {
7391 - unsigned int mask = map_mask ? map_mask[i+asize] : 0xffffffff;
7392 - if ((mask & *map) != (mask & interrupts[i]))
7397 - parent = *((phandle *)(map));
7398 - map+=1; map_size-=1;
7399 - parent_node = find_phandle(parent);
7400 - temp_isize = isize;
7401 - if (parent_node) {
7402 - isizep = (unsigned int *)get_property(parent_node, "#interrupt-cells", &l);
7404 - temp_isize = *isizep;
7407 - map += temp_isize;
7408 - map_size-=temp_isize;
7412 - node = parent_node;
7415 - interrupts = (unsigned int *)map;
7416 - ipsize = temp_isize*1;
7420 - /* We look for an explicit interrupt-parent.
7422 - parent = (phandle *)get_property(node, "interrupt-parent", &l);
7423 - if (parent && (l == sizeof(phandle)) &&
7424 - (parent_node = find_phandle(*parent))) {
7425 - node = parent_node;
7428 - /* Default, get real parent */
7429 - node = node->parent;
7436 * When BootX makes a copy of the device tree from the MacOS
7437 * Name Registry, it is in the format we use but all of the pointers
7438 @@ -1410,9 +960,6 @@
7439 mem_start += i * sizeof(struct address_range);
7442 - if (use_of_interrupt_tree)
7446 * If the pci host bridge has an interrupt-map property,
7447 * look for our node in it.
7448 @@ -1422,28 +969,14 @@
7449 get_property(np->parent, "interrupt-map", &ml)) != 0
7450 && (ip = (int *) get_property(np, "interrupts", &l)) != 0) {
7451 unsigned int devfn = pci_addrs[0].addr.a_hi & 0xff00;
7452 - unsigned int cell_size;
7453 - struct device_node* np2;
7454 - /* This is hackish, but is only used for BootX booting */
7455 - cell_size = sizeof(struct pci_intr_map);
7458 - if (device_is_compatible(np2, "uni-north")) {
7462 - np2 = np2->parent;
7465 np->intrs = (struct interrupt_info *) mem_start;
7466 - for (i = 0; (ml -= cell_size) >= 0; ++i) {
7467 - if (imp->addr.a_hi == devfn) {
7468 - np->intrs[np->n_intrs].line = imp->intr;
7469 - np->intrs[np->n_intrs].sense = 0; /* FIXME */
7470 + for (i = 0; (ml -= sizeof(struct pci_intr_map)) >= 0; ++i) {
7471 + if (imp[i].addr.a_hi == devfn) {
7472 + np->intrs[np->n_intrs].line = imp[i].intr;
7473 + np->intrs[np->n_intrs].sense = 0;
7476 - imp = (struct pci_intr_map *)(((unsigned int)imp)
7479 if (np->n_intrs == 0)
7481 @@ -1500,9 +1033,6 @@
7482 mem_start += i * sizeof(struct address_range);
7485 - if (use_of_interrupt_tree)
7488 ip = (int *) get_property(np, "AAPL,interrupts", &l);
7490 ip = (int *) get_property(np, "interrupts", &l);
7491 @@ -1526,14 +1056,13 @@
7492 struct reg_property *rp;
7493 struct address_range *adr;
7494 unsigned long base_address;
7495 - int i, l, keylargo, *ip;
7497 struct device_node *db;
7500 for (db = np->parent; db != NULL; db = db->parent) {
7501 if (!strcmp(db->type, "mac-io") && db->n_addrs != 0) {
7502 base_address = db->addrs[0].address;
7503 - keylargo = device_is_compatible(db, "Keylargo");
7507 @@ -1553,9 +1082,6 @@
7508 mem_start += i * sizeof(struct address_range);
7511 - if (use_of_interrupt_tree)
7514 ip = (int *) get_property(np, "interrupts", &l);
7516 ip = (int *) get_property(np, "AAPL,interrupts", &l);
7517 @@ -1564,21 +1090,15 @@
7518 if (_machine == _MACH_Pmac) {
7520 np->n_intrs = l / sizeof(int);
7521 - /* Hack for BootX on Core99 */
7523 - np->n_intrs = np->n_intrs/2;
7524 for (i = 0; i < np->n_intrs; ++i) {
7525 np->intrs[i].line = *ip++;
7527 - np->intrs[i].sense = *ip++;
7529 - np->intrs[i].sense = 0;
7530 + np->intrs[i].sense = 0;
7534 np->n_intrs = l / (2 * sizeof(int));
7535 for (i = 0; i < np->n_intrs; ++i) {
7536 - np->intrs[i].line = (*ip++) + NUM_8259_INTERRUPTS;
7537 + np->intrs[i].line = openpic_to_irq(*ip++);
7538 np->intrs[i].sense = *ip++;
7541 @@ -1612,9 +1132,6 @@
7542 mem_start += i * sizeof(struct address_range);
7545 - if (use_of_interrupt_tree)
7548 ip = (int *) get_property(np, "interrupts", &l);
7550 np->intrs = (struct interrupt_info *) mem_start;
7551 @@ -1652,9 +1169,6 @@
7552 mem_start += i * sizeof(struct address_range);
7555 - if (use_of_interrupt_tree)
7558 ip = (int *) get_property(np, "AAPL,interrupts", &l);
7560 ip = (int *) get_property(np, "interrupts", &l);
7561 @@ -1711,57 +1225,6 @@
7565 -/* Finds a device node given its PCI bus number, device number
7566 - * and function number
7569 -struct device_node *
7570 -find_pci_device_OFnode(unsigned char bus, unsigned char dev_fn)
7572 - struct device_node* np;
7573 - unsigned int *reg;
7576 - for (np = allnodes; np != 0; np = np->allnext) {
7578 - struct device_node* parent = np->parent;
7580 - char *pname = (char *)get_property(parent, "name", &l);
7581 - if (pname && strcmp(pname, "mac-io") == 0) {
7585 - parent = parent->parent;
7589 - reg = (unsigned int *) get_property(np, "reg", &l);
7590 - if (reg == 0 || l < sizeof(struct reg_property))
7592 - if (((reg[0] >> 8) & 0xff) == dev_fn && ((reg[0] >> 16) & 0xff) == bus)
7599 - * Returns all nodes linked together
7602 -struct device_node *
7603 -find_all_nodes(void)
7605 - struct device_node *head, **prevp, *np;
7608 - for (np = allnodes; np != 0; np = np->allnext) {
7610 - prevp = &np->next;
7616 /* Checks if the given "compat" string matches one of the strings in
7617 * the device's "compatible" property
7619 @@ -1851,7 +1314,7 @@
7620 struct property *pp;
7622 for (pp = np->properties; pp != 0; pp = pp->next)
7623 - if (pp->name && strcmp(pp->name, name) == 0) {
7624 + if (strcmp(pp->name, name) == 0) {
7628 @@ -1963,63 +1426,18 @@
7632 -/* Indicates whether the root node has a given value in its
7633 - * compatible property.
7637 -machine_is_compatible(const char *compat)
7639 - struct device_node *root;
7641 - root = find_path_device("/");
7644 - return device_is_compatible(root, compat);
7648 -#ifdef CONFIG_BOOTX_TEXT
7650 -/* Here's a small text engine to use during early boot or for debugging purposes
7654 - * - build some kind of vgacon with it to enable early printk
7655 - * - move to a separate file
7656 - * - add a few video driver hooks to keep in sync with display
7663 map_bootx_text(void)
7665 - unsigned long base, offset, size;
7667 + if (boot_infos == 0)
7669 - base = ((unsigned long) disp_bi->dispDeviceBase) & 0xFFFFF000UL;
7670 - offset = ((unsigned long) disp_bi->dispDeviceBase) - base;
7671 - size = disp_bi->dispDeviceRowBytes * disp_bi->dispDeviceRect[3] + offset
7672 - + disp_bi->dispDeviceRect[0];
7673 - disp_bi->logicalDisplayBase = ioremap(base, size) + offset;
7678 -install_boot_console(void)
7680 - register_console(&boot_cons);
7681 - boot_cons_registered = 1;
7685 -remove_boot_console(void)
7687 - if (boot_cons_registered)
7688 - unregister_console(&boot_cons);
7689 - boot_cons_registered = 0;
7690 + boot_infos->logicalDisplayBase =
7691 + ioremap((unsigned long) boot_infos->dispDeviceBase,
7692 + boot_infos->dispDeviceRowBytes * boot_infos->dispDeviceRect[3]);
7694 +#endif /* CONFIG_XMON */
7696 /* Calc the base address of a given point (x,y) */
7698 @@ -2041,7 +1459,7 @@
7701 unsigned long offset = reloc_offset();
7702 - boot_infos_t* bi = PTRRELOC(RELOC(disp_bi));
7703 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
7704 unsigned long *base = (unsigned long *)calc_base(bi, 0, 0);
7705 unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
7706 (bi->dispDeviceDepth >> 3)) >> 2;
7707 @@ -2066,7 +1484,7 @@
7710 unsigned long offset = reloc_offset();
7711 - boot_infos_t* bi = PTRRELOC(RELOC(disp_bi));
7712 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
7713 unsigned long *base = (unsigned long *)calc_base(bi, 0, 0);
7714 unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
7715 (bi->dispDeviceDepth >> 3)) >> 2;
7716 @@ -2083,22 +1501,68 @@
7720 +/* Indicates whether the root node has a given value in its
7721 + * compatible property.
7725 +machine_is_compatible(const char *compat)
7727 + struct device_node *root;
7729 + root = find_path_device("/");
7732 + return device_is_compatible(root, compat);
7735 +/* Finds a device node given its PCI bus number, device number
7736 + * and function number
7739 +struct device_node *
7740 +find_pci_device_OFnode(unsigned char bus, unsigned char dev_fn)
7742 + struct device_node* np;
7743 + unsigned int *reg;
7746 + for (np = allnodes; np != 0; np = np->allnext) {
7748 + struct device_node* parent = np->parent;
7750 + char *pname = (char *)get_property(parent, "name", &l);
7751 + if (pname && strcmp(pname, "mac-io") == 0) {
7755 + parent = parent->parent;
7759 + reg = (unsigned int *) get_property(np, "reg", &l);
7760 + if (reg == 0 || l < sizeof(struct reg_property))
7762 + if (((reg[0] >> 8) & 0xff) == dev_fn && ((reg[0] >> 16) & 0xff) == bus)
7768 +#ifdef CONFIG_BOOTX_TEXT
7774 unsigned long offset = reloc_offset();
7775 - boot_infos_t* bi = PTRRELOC(RELOC(disp_bi));
7776 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
7777 unsigned long *src = (unsigned long *)calc_base(bi,0,16);
7778 unsigned long *dst = (unsigned long *)calc_base(bi,0,0);
7779 unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
7780 (bi->dispDeviceDepth >> 3)) >> 2;
7783 -#ifdef CONFIG_POWERMAC
7788 for (i=0; i<(bi->dispDeviceRect[3] - bi->dispDeviceRect[1] - 16); i++)
7790 unsigned long *src_ptr = src;
7791 @@ -2115,10 +1579,6 @@
7793 dst += (bi->dispDeviceRowBytes >> 2);
7796 -#ifdef CONFIG_POWERMAC
7802 @@ -2163,18 +1623,8 @@
7806 -#ifdef CONFIG_BOOTX_TEXT
7808 -static void boot_console_write(struct console *co, const char *s,
7819 drawhex(unsigned long v)
7821 static char hex_table[] = "0123456789abcdef";
7822 @@ -2196,20 +1646,19 @@
7823 draw_byte(unsigned char c, long locX, long locY)
7825 unsigned long offset = reloc_offset();
7826 - boot_infos_t* bi = PTRRELOC(RELOC(disp_bi));
7827 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
7828 unsigned char *base = calc_base(bi, locX << 3, locY << 4);
7829 unsigned char *font = &RELOC(vga_font)[((unsigned long)c) * 16];
7830 - int rb = bi->dispDeviceRowBytes;
7832 switch(bi->dispDeviceDepth) {
7834 - draw_byte_32(font, (unsigned long *)base, rb);
7835 + draw_byte_32(font, (unsigned long *)base);
7838 - draw_byte_16(font, (unsigned long *)base, rb);
7839 + draw_byte_16(font, (unsigned long *)base);
7842 - draw_byte_8(font, (unsigned long *)base, rb);
7843 + draw_byte_8(font, (unsigned long *)base);
7847 @@ -2247,8 +1696,10 @@
7851 -draw_byte_32(unsigned char *font, unsigned long *base, int rb)
7852 +draw_byte_32(unsigned char *font, unsigned long *base)
7854 + unsigned long offset = reloc_offset();
7855 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
7857 int fg = 0xFFFFFFFFUL;
7858 int bg = 0x00000000UL;
7859 @@ -2265,18 +1716,19 @@
7860 base[5] = (-((bits >> 2) & 1) & fg) ^ bg;
7861 base[6] = (-((bits >> 1) & 1) & fg) ^ bg;
7862 base[7] = (-(bits & 1) & fg) ^ bg;
7863 - base = (unsigned long *) ((char *)base + rb);
7864 + base = (unsigned long *) ((char *)base + bi->dispDeviceRowBytes);
7870 -draw_byte_16(unsigned char *font, unsigned long *base, int rb)
7871 +draw_byte_16(unsigned char *font, unsigned long *base)
7873 + unsigned long offset = reloc_offset();
7874 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
7876 int fg = 0xFFFFFFFFUL;
7877 int bg = 0x00000000UL;
7878 - unsigned long offset = reloc_offset();
7879 unsigned long *eb = RELOC(expand_bits_16);
7881 for (l = 0; l < 16; ++l)
7882 @@ -2286,18 +1738,19 @@
7883 base[1] = (eb[(bits >> 4) & 3] & fg) ^ bg;
7884 base[2] = (eb[(bits >> 2) & 3] & fg) ^ bg;
7885 base[3] = (eb[bits & 3] & fg) ^ bg;
7886 - base = (unsigned long *) ((char *)base + rb);
7887 + base = (unsigned long *) ((char *)base + bi->dispDeviceRowBytes);
7893 -draw_byte_8(unsigned char *font, unsigned long *base, int rb)
7894 +draw_byte_8(unsigned char *font, unsigned long *base)
7896 + unsigned long offset = reloc_offset();
7897 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
7899 int fg = 0x0F0F0F0FUL;
7900 int bg = 0x00000000UL;
7901 - unsigned long offset = reloc_offset();
7902 unsigned long *eb = RELOC(expand_bits_8);
7904 for (l = 0; l < 16; ++l)
7905 @@ -2305,7 +1758,7 @@
7907 base[0] = (eb[bits >> 4] & fg) ^ bg;
7908 base[1] = (eb[bits & 0xf] & fg) ^ bg;
7909 - base = (unsigned long *) ((char *)base + rb);
7910 + base = (unsigned long *) ((char *)base + bi->dispDeviceRowBytes);
7914 diff -urN linux.orig/arch/ppc/kernel/ptrace.c linux/arch/ppc/kernel/ptrace.c
7915 --- linux.orig/arch/ppc/kernel/ptrace.c Fri Nov 2 17:39:05 2001
7916 +++ linux/arch/ppc/kernel/ptrace.c Thu Jul 11 15:43:29 2002
7918 #include <asm/uaccess.h>
7919 #include <asm/page.h>
7920 #include <asm/pgtable.h>
7921 +#include <asm/pf-compat.h>
7922 #include <asm/system.h>
7925 @@ -341,10 +342,10 @@
7927 if (request == PTRACE_TRACEME) {
7928 /* are we already being traced? */
7929 - if (current->ptrace & PT_PTRACED)
7930 + if (current->flags & PF_PTRACED)
7932 /* set the ptrace bit in the process flags. */
7933 - current->ptrace |= PT_PTRACED;
7934 + current->flags |= PF_PTRACED;
7939 (current->gid != child->gid)) && !capable(CAP_SYS_PTRACE))
7941 /* the same process cannot be attached many times */
7942 - if (child->ptrace & PT_PTRACED)
7943 + if (child->flags & PF_PTRACED)
7945 - child->ptrace |= PT_PTRACED;
7946 + child->flags |= PF_PTRACED;
7948 write_lock_irqsave(&tasklist_lock, flags);
7949 if (child->p_pptr != current) {
7954 - if (!(child->ptrace & PT_PTRACED))
7955 + if (!(child->flags & PF_PTRACED))
7957 if (child->state != TASK_STOPPED) {
7958 if (request != PTRACE_KILL)
7960 if ((unsigned long) data > _NSIG)
7962 if (request == PTRACE_SYSCALL)
7963 - child->ptrace |= PT_TRACESYS;
7964 + child->flags |= PF_TRACESYS;
7966 - child->ptrace &= ~PT_TRACESYS;
7967 + child->flags &= ~PF_TRACESYS;
7968 child->exit_code = data;
7969 /* make sure the single step bit is not set. */
7970 clear_single_step(child);
7973 if ((unsigned long) data > _NSIG)
7975 - child->ptrace &= ~PT_TRACESYS;
7976 + child->flags &= ~PF_TRACESYS;
7977 set_single_step(child);
7978 child->exit_code = data;
7979 /* give it a chance to run. */
7982 if ((unsigned long) data > _NSIG)
7984 - child->ptrace &= ~(PT_PTRACED|PT_TRACESYS);
7985 + child->flags &= ~(PF_PTRACED|PF_TRACESYS);
7986 child->exit_code = data;
7987 write_lock_irqsave(&tasklist_lock, flags);
7988 REMOVE_LINKS(child);
7991 asmlinkage void syscall_trace(void)
7993 - if ((current->ptrace & (PT_PTRACED|PT_TRACESYS))
7994 - != (PT_PTRACED|PT_TRACESYS))
7995 + if ((current->flags & (PF_PTRACED|PF_TRACESYS))
7996 + != (PF_PTRACED|PF_TRACESYS))
7998 current->exit_code = SIGTRAP;
7999 current->state = TASK_STOPPED;
8000 diff -urN linux.orig/arch/ppc/kernel/setup.c linux/arch/ppc/kernel/setup.c
8001 --- linux.orig/arch/ppc/kernel/setup.c Sun Mar 25 18:31:49 2001
8002 +++ linux/arch/ppc/kernel/setup.c Thu Jul 11 15:47:12 2002
8005 #include <asm/bootx.h>
8006 #include <asm/machdep.h>
8007 -#include <asm/uaccess.h>
8009 extern void pmac_init(unsigned long r3,
8016 -extern void xmon_map_scc(void);
8019 extern boot_infos_t *boot_infos;
8020 extern char cmd_line[512];
8021 char saved_command_line[256];
8024 struct ide_machdep_calls ppc_ide_md;
8026 +#ifdef CONFIG_MAGIC_SYSRQ
8027 +unsigned long SYSRQ_KEY;
8028 +#endif /* CONFIG_MAGIC_SYSRQ */
8030 unsigned long ISA_DMA_THRESHOLD;
8031 unsigned long DMA_MODE_READ, DMA_MODE_WRITE;
8035 struct machdep_calls ppc_md;
8037 -#ifdef CONFIG_MAGIC_SYSRQ
8038 -unsigned long SYSRQ_KEY;
8039 -#endif /* CONFIG_MAGIC_SYSRQ */
8040 -#ifdef CONFIG_VGA_CONSOLE
8041 -unsigned long vgacon_remap_base;
8044 /* copy of the residual data */
8048 len += sprintf(len+buffer, "604ev5 (MachV)\n");
8051 - len += sprintf(len+buffer, "7400 (G4)\n");
8054 len += sprintf(len+buffer, "821\n");
8056 @@ -322,6 +312,14 @@
8057 bogosum += CD(loops_per_jiffy);
8062 + len += sprintf(buffer+len, "\n");
8063 + len += sprintf(buffer+len,"total bogomips\t: %lu.%02lu\n",
8064 + (bogosum+2500)/500000,
8065 + (bogosum+2500)/5000 % 100);
8066 +#endif /* __SMP__ */
8069 * Ooh's and aah's info about zero'd pages in idle task
8071 @@ -486,21 +484,15 @@
8075 -#ifdef CONFIG_POWERMAC
8077 pmac_init(r3, r4, r5, r6, r7);
8080 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_PREP)
8082 prep_init(r3, r4, r5, r6, r7);
8085 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_CHRP)
8087 chrp_init(r3, r4, r5, r6, r7);
8092 apus_init(r3, r4, r5, r6, r7);
8093 @@ -554,13 +546,12 @@
8094 /* Checks "l2cr=xxxx" command-line option */
8095 void ppc_setup_l2cr(char *str, int *ints)
8097 - if ( ((_get_PVR() >> 16) == 8) || ((_get_PVR() >> 16) == 12) )
8098 + if ( (_get_PVR() >> 16) == 8)
8100 unsigned long val = simple_strtoul(str, NULL, 0);
8101 printk(KERN_INFO "l2cr set to %lx\n", val);
8109 @@ -581,16 +572,14 @@
8110 extern unsigned long find_available_memory(void);
8111 extern unsigned long *end_of_DRAM;
8117 + extern void xmon_map_scc(void);
8121 - p = strstr(cmd_line, "xmon");
8122 - if (p != NULL && (p == cmd_line || p[-1] == ' '))
8126 + p = strstr(cmd_line, "xmon");
8127 + if (p != NULL && (p == cmd_line || p[-1] == ' '))
8129 #endif /* CONFIG_XMON */
8131 /* reboot on panic */
8132 @@ -610,15 +599,7 @@
8133 *memory_end_p = (unsigned long) end_of_DRAM;
8135 ppc_md.setup_arch(memory_start_p, memory_end_p);
8137 - sort_exception_table();
8140 -#ifndef CONFIG_POWERMAC
8141 -void note_bootable_part(kdev_t dev, int part, int goodness)
8146 void ppc_generic_ide_fix_driveid(struct hd_driveid *id)
8148 diff -urN linux.orig/arch/ppc/kernel/signal.c linux/arch/ppc/kernel/signal.c
8149 --- linux.orig/arch/ppc/kernel/signal.c Fri Nov 2 17:39:05 2001
8150 +++ linux/arch/ppc/kernel/signal.c Thu Jul 11 15:43:29 2002
8152 * modify it under the terms of the GNU General Public License
8153 * as published by the Free Software Foundation; either version
8154 * 2 of the License, or (at your option) any later version.
8158 - * Define a real-time signal frame with siginfo and ucontext
8159 - * structures (setup_rt_frame()).
8160 - * Stuck up a real-time signal frame when setting the signal
8161 - * frame with SA_SIGINFO flags.
8162 - * Add sys_rt_sigreturn() to undo the signal stack.
8164 - * Giovanna Ambrosini (ambrosini@lightning.ch)
8167 #include <linux/sched.h>
8169 #include <asm/ucontext.h>
8170 #include <asm/uaccess.h>
8171 #include <asm/pgtable.h>
8172 +#include <asm/pf-compat.h>
8176 @@ -131,6 +122,13 @@
8180 +asmlinkage int sys_rt_sigreturn(unsigned long __unused)
8182 + printk("sys_rt_sigreturn(): %s/%d not yet implemented.\n",
8183 + current->comm,current->pid);
8188 sys_sigaltstack(const stack_t *uss, stack_t *uoss)
8190 @@ -174,11 +172,13 @@
8191 * When we have signals to deliver, we set up on the
8192 * user stack, going down from the original stack pointer:
8194 - * one or more sigcontext structs with
8195 + * one or more sigcontext structs
8196 * a gap of __SIGNAL_FRAMESIZE bytes
8198 * Each of these things must be a multiple of 16 bytes in size.
8200 + * XXX ultimately we will have to stack up a siginfo and ucontext
8201 + * for each rt signal.
8204 elf_gregset_t gp_regs;
8205 @@ -189,15 +189,6 @@
8211 - unsigned long _unused[2];
8212 - struct siginfo *pinfo;
8214 - struct siginfo info;
8215 - struct ucontext uc;
8219 * Do a signal return; undo the signal stack.
8221 @@ -230,10 +221,6 @@
8222 sr = (struct sigregs *) sigctx.regs;
8223 if (regs->msr & MSR_FP )
8224 giveup_fpu(current);
8225 -#ifdef CONFIG_ALTIVEC
8226 - if (regs->msr & MSR_VEC)
8227 - giveup_altivec(current);
8228 -#endif /* CONFIG_ALTIVEC */
8229 if (copy_from_user(saved_regs, &sr->gp_regs,
8230 sizeof(sr->gp_regs)))
8232 @@ -269,91 +256,6 @@
8238 - * When we have rt signals to deliver, we set up on the
8239 - * user stack, going down from the original stack pointer:
8240 - * a sigregs struct
8241 - * one rt_sigframe struct (siginfo + ucontext)
8242 - * a gap of __SIGNAL_FRAMESIZE bytes
8244 - * Each of these things must be a multiple of 16 bytes in size.
8247 -asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
8249 - struct rt_sigframe *rt_sf;
8250 - struct sigcontext_struct sigctx;
8251 - struct sigregs *sr;
8253 - elf_gregset_t saved_regs; /* an array of ELF_NGREG unsigned longs */
8256 - unsigned long prevsp;
8258 - rt_sf = (struct rt_sigframe *)(regs->gpr[1] + __SIGNAL_FRAMESIZE);
8259 - if (copy_from_user(&sigctx, &rt_sf->uc.uc_mcontext, sizeof(sigctx))
8260 - || copy_from_user(&set, &rt_sf->uc.uc_sigmask, sizeof(set))
8261 - || copy_from_user(&st, &rt_sf->uc.uc_stack, sizeof(st)))
8263 - sigdelsetmask(&set, ~_BLOCKABLE);
8264 - spin_lock_irq(¤t->sigmask_lock);
8265 - current->blocked = set;
8266 - recalc_sigpending(current);
8267 - spin_unlock_irq(¤t->sigmask_lock);
8269 - rt_sf++; /* Look at next rt_sigframe */
8270 - if (rt_sf == (struct rt_sigframe *)(sigctx.regs)) {
8271 - /* Last stacked signal - restore registers -
8272 - * sigctx is initialized to point to the
8273 - * preamble frame (where registers are stored)
8274 - * see handle_signal()
8276 - sr = (struct sigregs *) sigctx.regs;
8277 - if (regs->msr & MSR_FP )
8278 - giveup_fpu(current);
8279 - if (copy_from_user(saved_regs, &sr->gp_regs,
8280 - sizeof(sr->gp_regs)))
8282 - saved_regs[PT_MSR] = (regs->msr & ~MSR_USERCHANGE)
8283 - | (saved_regs[PT_MSR] & MSR_USERCHANGE);
8284 - memcpy(regs, saved_regs, GP_REGS_SIZE);
8285 - if (copy_from_user(current->tss.fpr, &sr->fp_regs,
8286 - sizeof(sr->fp_regs)))
8288 - /* This function sets back the stack flags into
8289 - the current task structure. */
8290 - sys_sigaltstack(&st, NULL);
8292 - ret = regs->result;
8294 - /* More signals to go */
8295 - /* Set up registers for next signal handler */
8296 - regs->gpr[1] = (unsigned long)rt_sf - __SIGNAL_FRAMESIZE;
8297 - if (copy_from_user(&sigctx, &rt_sf->uc.uc_mcontext, sizeof(sigctx)))
8299 - sr = (struct sigregs *) sigctx.regs;
8300 - regs->gpr[3] = ret = sigctx.signal;
8301 - /* Get the siginfo */
8302 - get_user(regs->gpr[4], (unsigned long *)&rt_sf->pinfo);
8303 - /* Get the ucontext */
8304 - get_user(regs->gpr[5], (unsigned long *)&rt_sf->puc);
8305 - regs->gpr[6] = (unsigned long) rt_sf;
8307 - regs->link = (unsigned long) &sr->tramp;
8308 - regs->nip = sigctx.handler;
8309 - if (get_user(prevsp, &sr->gp_regs[PT_R1])
8310 - || put_user(prevsp, (unsigned long *) regs->gpr[1]))
8322 * Set up a signal frame.
8324 @@ -367,10 +269,6 @@
8326 if (regs->msr & MSR_FP)
8327 giveup_fpu(current);
8328 -#ifdef CONFIG_ALTIVEC
8329 - if (regs->msr & MSR_VEC)
8330 - giveup_altivec(current);
8331 -#endif /* CONFIG_ALTIVEC */
8332 if (__copy_to_user(&frame->gp_regs, regs, GP_REGS_SIZE)
8333 || __copy_to_user(&frame->fp_regs, current->tss.fpr,
8334 ELF_NFPREG * sizeof(double))
8335 @@ -400,57 +298,6 @@
8341 -setup_rt_frame(struct pt_regs *regs, struct sigregs *frame,
8342 - signed long newsp)
8344 - struct rt_sigframe *rt_sf = (struct rt_sigframe *) newsp;
8346 - /* Set up preamble frame */
8347 - if (verify_area(VERIFY_WRITE, frame, sizeof(*frame)))
8349 - if (regs->msr & MSR_FP)
8350 - giveup_fpu(current);
8351 - if (__copy_to_user(&frame->gp_regs, regs, GP_REGS_SIZE)
8352 - || __copy_to_user(&frame->fp_regs, current->tss.fpr,
8353 - ELF_NFPREG * sizeof(double))
8354 - /* Set up to return from user space.
8355 - It calls the sc exception at offset 0x9999
8356 - for sys_rt_sigreturn().
8358 - || __put_user(0x38006666UL, &frame->tramp[0]) /* li r0,0x6666 */
8359 - || __put_user(0x44000002UL, &frame->tramp[1])) /* sc */
8361 - flush_icache_range((unsigned long) &frame->tramp[0],
8362 - (unsigned long) &frame->tramp[2]);
8364 - /* Retrieve rt_sigframe from stack and
8365 - set up registers for signal handler
8367 - newsp -= __SIGNAL_FRAMESIZE;
8368 - if (put_user(regs->gpr[1], (unsigned long *)newsp)
8369 - || get_user(regs->nip, &rt_sf->uc.uc_mcontext.handler)
8370 - || get_user(regs->gpr[3], &rt_sf->uc.uc_mcontext.signal)
8371 - || get_user(regs->gpr[4], (unsigned long *)&rt_sf->pinfo)
8372 - || get_user(regs->gpr[5], (unsigned long *)&rt_sf->puc))
8375 - regs->gpr[1] = newsp;
8376 - regs->gpr[6] = (unsigned long) rt_sf;
8377 - regs->link = (unsigned long) frame->tramp;
8383 - printk("badframe in setup_rt_frame, regs=%p frame=%p newsp=%lx\n",
8384 - regs, frame, newsp);
8391 * OK, we're invoking a handler
8394 unsigned long *newspp, unsigned long frame)
8396 struct sigcontext_struct *sc;
8397 - struct rt_sigframe *rt_sf;
8399 if (regs->trap == 0x0C00 /* System Call! */
8400 && ((int)regs->result == -ERESTARTNOHAND ||
8401 @@ -468,47 +314,20 @@
8402 !(ka->sa.sa_flags & SA_RESTART))))
8403 regs->result = -EINTR;
8405 - /* Set up Signal Frame */
8406 - if (ka->sa.sa_flags & SA_SIGINFO) {
8407 - /* Put a Real Time Context onto stack */
8408 - *newspp -= sizeof(*rt_sf);
8409 - rt_sf = (struct rt_sigframe *) *newspp;
8410 - if (verify_area(VERIFY_WRITE, rt_sf, sizeof(*rt_sf)))
8413 - if (__put_user((unsigned long) ka->sa.sa_handler, &rt_sf->uc.uc_mcontext.handler)
8414 - || __put_user(&rt_sf->info, &rt_sf->pinfo)
8415 - || __put_user(&rt_sf->uc, &rt_sf->puc)
8416 - /* Put the siginfo */
8417 - || __copy_to_user(&rt_sf->info, info, sizeof(*info))
8418 - /* Create the ucontext */
8419 - || __put_user(0, &rt_sf->uc.uc_flags)
8420 - || __put_user(0, &rt_sf->uc.uc_link)
8421 - || __put_user(current->sas_ss_sp, &rt_sf->uc.uc_stack.ss_sp)
8422 - || __put_user(sas_ss_flags(regs->gpr[1]),
8423 - &rt_sf->uc.uc_stack.ss_flags)
8424 - || __put_user(current->sas_ss_size, &rt_sf->uc.uc_stack.ss_size)
8425 - || __copy_to_user(&rt_sf->uc.uc_sigmask, oldset, sizeof(*oldset))
8426 - /* mcontext.regs points to preamble register frame */
8427 - || __put_user((struct pt_regs *)frame, &rt_sf->uc.uc_mcontext.regs)
8428 - || __put_user(sig, &rt_sf->uc.uc_mcontext.signal))
8431 - /* Put another sigcontext on the stack */
8432 - *newspp -= sizeof(*sc);
8433 - sc = (struct sigcontext_struct *) *newspp;
8434 - if (verify_area(VERIFY_WRITE, sc, sizeof(*sc)))
8436 + /* Put another sigcontext on the stack */
8437 + *newspp -= sizeof(*sc);
8438 + sc = (struct sigcontext_struct *) *newspp;
8439 + if (verify_area(VERIFY_WRITE, sc, sizeof(*sc)))
8442 - if (__put_user((unsigned long) ka->sa.sa_handler, &sc->handler)
8443 - || __put_user(oldset->sig[0], &sc->oldmask)
8444 + if (__put_user((unsigned long) ka->sa.sa_handler, &sc->handler)
8445 + || __put_user(oldset->sig[0], &sc->oldmask)
8447 - || __put_user(oldset->sig[1], &sc->_unused[3])
8448 + || __put_user(oldset->sig[1], &sc->_unused[3])
8450 - || __put_user((struct pt_regs *)frame, &sc->regs)
8451 - || __put_user(sig, &sc->signal))
8454 + || __put_user((struct pt_regs *)frame, &sc->regs)
8455 + || __put_user(sig, &sc->signal))
8458 if (ka->sa.sa_flags & SA_ONESHOT)
8459 ka->sa.sa_handler = SIG_DFL;
8464 - if ((current->ptrace & PT_PTRACED) && signr != SIGKILL) {
8465 + if ((current->flags & PF_PTRACED) && signr != SIGKILL) {
8466 /* Let the debugger run. */
8467 current->exit_code = signr;
8468 current->state = TASK_STOPPED;
8469 @@ -664,10 +483,7 @@
8471 return 0; /* no signals delivered */
8473 - if (ka->sa.sa_flags & SA_SIGINFO)
8474 - setup_rt_frame(regs, (struct sigregs *) frame, newsp);
8476 - setup_frame(regs, (struct sigregs *) frame, newsp);
8477 + setup_frame(regs, (struct sigregs *) frame, newsp);
8481 diff -urN linux.orig/arch/ppc/kernel/sleep.S linux/arch/ppc/kernel/sleep.S
8482 --- linux.orig/arch/ppc/kernel/sleep.S Sun Mar 25 18:37:30 2001
8483 +++ linux/arch/ppc/kernel/sleep.S Thu Jul 11 15:43:29 2002
8486 * This file contains sleep low-level functions for PowerBook G3.
8487 - * Copyright (C) 1999 Benjamin Herrenschmidt (benh@kernel.crashing.org)
8488 + * Copyright (C) 1999 Benjamin Herrenschmidt (bh40@calva.net)
8489 * and Paul Mackerras (paulus@cs.anu.edu.au).
8491 * This program is free software; you can redistribute it and/or
8495 /* Set up stuff at address 0 */
8496 - lis r5,grackle_wake_up@ha
8497 - addi r5,r5,grackle_wake_up@l
8499 + addi r5,r5,wake_up@l
8503 @@ -124,28 +124,22 @@
8507 - /* Setup stuffs at 0x80-0x84 for Core99 */
8508 - lis r3,core99_wake_up@ha
8509 - addi r3,r3,core99_wake_up@l
8515 - * Flush the L1 data cache by reading the first 128kB of RAM
8516 + * Flush the L1 data cache by reading the first 64kB of RAM
8517 * and then flushing the same area with the dcbf instruction.
8518 * The L2 cache has already been disabled.
8520 - li r4,0x1000 /* 128kB / 32B */
8521 + li r4,0x0800 /* 64kB / 32B */
8526 - addi r4,r4,0x0020 /* Go to start of next cache line */
8527 + addi r4,r4,0x0020 /* Go to start of next cache line */
8531 - li r4,0x1000 /* 128kB / 32B */
8532 + li r4,0x0800 /* 64k */
8536 @@ -154,14 +148,6 @@
8540 -/* Turn off L1 (necessary ?) */
8542 - ori r3,r3, HID0_ICE|HID0_DCE
8543 - xori r3,r3, HID0_ICE|HID0_DCE
8549 * Set the HID0 and MSR for sleep.
8551 @@ -177,50 +163,20 @@
8560 * Here is the resume code.
8561 - * Core99 machines resume here
8562 - * r4 has the physical address of SL_PC(sp).
8568 - /* use rlwinm ... */
8569 - oris r3,r3,HID0_SLEEP@h
8570 - xoris r3,r3,HID0_SLEEP@h
8575 - /* sanitize MSR */
8577 - ori r3,r3,MSR_EE|MSR_IP
8578 - xori r3,r3,MSR_EE|MSR_IP
8584 - * Here is the resume code for older machines.
8585 * r1 has the physical address of SL_PC(sp).
8589 - /* Enable and then Flash inval the instruction cache */
8591 + /* Flash inval the instruction cache */
8593 - ori r3,r3, HID0_ICE|HID0_ICFI|HID0_DCE|HID0_DCI
8597 - xori r3,r3, HID0_ICFI|HID0_DCI
8598 + ori r3,r3, HID0_ICFI
8602 - /* Restore the remaining bits of the HID0 register. */
8604 + /* Restore the HID0 register. This turns on the L1 caches. */
8608 @@ -283,13 +239,6 @@
8609 lwz r4,SL_IBAT3+4(r1)
8612 - /* Flush all TLBs */
8614 -1: addic. r4, r4, -0x1000
8619 /* restore the MSR and turn on the MMU */
8636 diff -urN linux.orig/arch/ppc/kernel/smp.c linux/arch/ppc/kernel/smp.c
8637 --- linux.orig/arch/ppc/kernel/smp.c Sun Mar 25 18:31:49 2001
8638 +++ linux/arch/ppc/kernel/smp.c Thu Jul 11 16:28:25 2002
8640 * deal of code from the sparc and intel versions.
8642 * Support for PReP (Motorola MTX/MVME) SMP by Troy Benjegerdes
8643 - * (troy@blacklablinux.com, hozer@drgw.net)
8644 - * Support for PReP (Motorola MTX/MVME) and Macintosh G4 SMP
8645 - * by Troy Benjegerdes (hozer@drgw.net)
8646 + * (troy@microux.com, hozer@drgw.net)
8649 #include <linux/kernel.h>
8651 #include <asm/prom.h>
8652 #include <asm/gemini.h>
8653 #include <asm/residual.h>
8654 -#include <asm/time.h>
8655 -#include <asm/feature.h>
8658 #include "open_pic.h"
8660 int first_cpu_booted = 0;
8662 struct cpuinfo_PPC cpu_data[NR_CPUS];
8663 struct klock_info_struct klock_info = { KLOCK_CLEAR, 0 };
8664 volatile unsigned char active_kernel_processor = NO_PROC_ID; /* Processor holding kernel spinlock */
8667 +volatile unsigned long ipi_count;
8668 spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED;
8669 unsigned int prof_multiplier[NR_CPUS];
8670 unsigned int prof_counter[NR_CPUS];
8672 extern unsigned long *MotSave_SmpIar;
8673 extern unsigned char *MotSave_CpusState[2];
8675 -/* l2 cache stuff for dual G4 macs */
8676 -extern void core99_init_l2(void);
8678 /* register for interrupting the secondary processor on the powersurge */
8679 #define PSURGE_INTR ((volatile unsigned *)0xf80000c0)
8683 void smp_message_recv(int msg)
8685 - atomic_inc(&ipi_recv);
8694 -#ifdef CONFIG_POWERMAC
8696 * As it is now, if we're sending two message at the same time
8697 * we have race conditions on Pmac. The PowerSurge doesn't easily
8698 @@ -155,10 +148,10 @@
8702 -int psurge_smp_message[NR_CPUS];
8703 -void psurge_smp_message_recv(void)
8704 +int pmac_smp_message[NR_CPUS];
8705 +void pmac_smp_message_recv(void)
8707 - int msg = psurge_smp_message[smp_processor_id()];
8708 + int msg = pmac_smp_message[smp_processor_id()];
8710 /* clear interrupt */
8711 out_be32(PSURGE_INTR, ~0);
8713 smp_message_recv(msg);
8716 - psurge_smp_message[smp_processor_id()] = -1;
8717 + pmac_smp_message[smp_processor_id()] = -1;
8719 -#endif /* powermac */
8723 * 750's don't broadcast tlb invalidates so
8724 @@ -203,65 +196,49 @@
8725 smp_message_pass(MSG_ALL_BUT_SELF, MSG_STOP_CPU, 0, 0);
8728 -#ifdef CONFIG_POWERMAC
8729 -static void psurge_message_pass(int target, int msg, unsigned long data, int wait)
8730 +void smp_message_pass(int target, int msg, unsigned long data, int wait)
8735 - * IPI's on the Pmac are a hack but without reasonable
8736 - * IPI hardware SMP on Pmac is a hack.
8738 - * We assume here that the msg is not -1. If it is,
8739 - * the recipient won't know the message was destined
8742 - for ( i = 0; i <= smp_num_cpus ; i++ )
8743 - psurge_smp_message[i] = -1;
8747 - psurge_smp_message[smp_processor_id()] = msg;
8748 - /* fall through */
8749 - case MSG_ALL_BUT_SELF:
8750 - for ( i = 0 ; i < smp_num_cpus ; i++ )
8751 - if ( i != smp_processor_id () )
8752 - psurge_smp_message[i] = msg;
8755 - psurge_smp_message[target] = msg;
8758 - /* interrupt secondary processor */
8759 - out_be32(PSURGE_INTR, ~0);
8760 - out_be32(PSURGE_INTR, 0);
8762 - * Assume for now that the secondary doesn't send
8764 - * Could be fixed with 2.4 code from Paulus -- BenH
8766 - /* interrupt primary */
8767 - /**(volatile unsigned long *)(0xf3019000);*/
8769 -#endif /* powermac */
8771 -void smp_message_pass(int target, int msg, unsigned long data, int wait)
8773 - atomic_inc(&ipi_sent);
8775 if ( !(_machine & (_MACH_Pmac|_MACH_chrp|_MACH_prep|_MACH_gemini)) )
8779 -#ifdef CONFIG_POWERMAC
8781 - /* Hack, 2.4 does it cleanly */
8782 - if (OpenPIC == NULL) {
8783 - psurge_message_pass(target, msg, data, wait);
8785 + * IPI's on the Pmac are a hack but without reasonable
8786 + * IPI hardware SMP on Pmac is a hack.
8788 + * We assume here that the msg is not -1. If it is,
8789 + * the recipient won't know the message was destined
8792 + for ( i = 0; i <= smp_num_cpus ; i++ )
8793 + pmac_smp_message[i] = -1;
8797 + pmac_smp_message[smp_processor_id()] = msg;
8798 + /* fall through */
8799 + case MSG_ALL_BUT_SELF:
8800 + for ( i = 0 ; i < smp_num_cpus ; i++ )
8801 + if ( i != smp_processor_id () )
8802 + pmac_smp_message[i] = msg;
8805 - /* else fall through and do something sane --Troy */
8808 + pmac_smp_message[target] = msg;
8811 + /* interrupt secondary processor */
8812 + out_be32(PSURGE_INTR, ~0);
8813 + out_be32(PSURGE_INTR, 0);
8815 + * Assume for now that the secondary doesn't send
8818 + /* interrupt primary */
8819 + /**(volatile unsigned long *)(0xf3019000);*/
8824 @@ -285,52 +262,6 @@
8828 -#ifdef CONFIG_POWERMAC
8829 -static void pmac_core99_kick_cpu(int nr)
8831 - extern void __secondary_start_psurge(void);
8833 - unsigned long save_int;
8834 - unsigned long flags;
8835 - volatile unsigned long *vector
8836 - = ((volatile unsigned long *)(KERNELBASE+0x500));
8841 - __save_flags(flags);
8844 - /* Save EE vector */
8845 - save_int = *vector;
8847 - /* Setup fake EE vector that does
8848 - * b __secondary_start_psurge - KERNELBASE
8850 - *vector = 0x48000002 +
8851 - ((unsigned long)__secondary_start_psurge - KERNELBASE);
8853 - /* flush data cache and inval instruction cache */
8854 - flush_icache_range((unsigned long) vector, (unsigned long) vector + 4);
8856 - /* Put some life in our friend */
8857 - feature_core99_kick_cpu1();
8859 - /* FIXME: We wait a bit for the CPU to take the exception, I should
8860 - * instead wait for the entry code to set something for me. Well,
8861 - * ideally, all that crap will be done in prom.c and the CPU left
8862 - * in a RAM-based wait loop like CHRP.
8866 - /* Restore our exception vector */
8867 - *vector = save_int;
8868 - flush_icache_range((unsigned long) vector, (unsigned long) vector + 4);
8870 - __restore_flags(flags);
8872 -#endif /* powermac */
8874 void __init smp_boot_cpus(void)
8876 extern struct task_struct *current_set[NR_CPUS];
8877 @@ -367,21 +298,15 @@
8881 -#ifdef CONFIG_POWERMAC
8883 - /* assum e powersurge board - 2 processors -- Cort */
8884 - /* or a dual G4 -- Troy */
8885 + /* assume powersurge board - 2 processors -- Cort */
8889 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_CHRP)
8891 cpu_nr = ((openpic_read(&OpenPIC->Global.Feature_Reporting0)
8892 & OPENPIC_FEATURE_LAST_PROCESSOR_MASK) >>
8893 OPENPIC_FEATURE_LAST_PROCESSOR_SHIFT)+1;
8896 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_PREP)
8898 /* assume 2 for now == fix later -- Johnnie */
8900 @@ -389,13 +314,10 @@
8905 -#ifdef CONFIG_GEMINI
8907 cpu_nr = (readb(GEMINI_CPUSTAT) & GEMINI_CPU_COUNT_MASK)>>2;
8908 cpu_nr = (cpu_nr == 0) ? 4 : cpu_nr;
8912 printk("SMP not supported on this machine.\n");
8914 @@ -426,41 +348,30 @@
8918 -#ifdef CONFIG_POWERMAC
8920 - if (OpenPIC == NULL) {
8921 - /* setup entry point of secondary processor */
8922 - *(volatile unsigned long *)(0xf2800000) =
8923 - (unsigned long)__secondary_start_psurge-KERNELBASE;
8925 - /* interrupt secondary to begin executing code */
8926 - out_be32(PSURGE_INTR, ~0);
8927 - out_be32(PSURGE_INTR, 0);
8929 - pmac_core99_kick_cpu(i);
8930 + /* setup entry point of secondary processor */
8931 + *(volatile unsigned long *)(0xf2800000) =
8932 + (unsigned long)__secondary_start_psurge-KERNELBASE;
8934 + /* interrupt secondary to begin executing code */
8935 + out_be32(PSURGE_INTR, ~0);
8936 + out_be32(PSURGE_INTR, 0);
8939 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_CHRP)
8941 *(unsigned long *)KERNELBASE = i;
8942 asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory");
8945 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_PREP)
8947 *MotSave_SmpIar = (unsigned long)__secondary_start_psurge - KERNELBASE;
8948 *MotSave_CpusState[1] = CPU_GOOD;
8949 printk("CPU1 reset, waiting\n");
8952 -#ifdef CONFIG_GEMINI
8954 openpic_init_processor( 1<<i );
8955 openpic_init_processor( 0 );
8962 * wait to see if the cpu made a callin (is actually up).
8963 * use this value that I found through experimentation.
8969 + if ( _machine & (_MACH_gemini|_MACH_chrp|_MACH_prep) )
8970 do_openpic_setup_cpu();
8971 - else if ( _machine == _MACH_Pmac )
8972 + if ( _machine == _MACH_Pmac )
8974 /* reset the entry point so if we get another intr we won't
8975 * try to startup again */
8976 @@ -529,17 +440,10 @@
8977 * place to stick it for now.
8981 + if ( _machine & (_MACH_gemini|_MACH_chrp|_MACH_prep) )
8982 do_openpic_setup_cpu();
8983 -#ifdef CONFIG_POWERMAC
8984 - if ( _machine == _MACH_Pmac )
8988 -#ifdef CONFIG_GEMINI
8989 if ( _machine == _MACH_gemini )
8992 while(!smp_commenced)
8995 diff -urN linux.orig/arch/ppc/kernel/syscalls.c linux/arch/ppc/kernel/syscalls.c
8996 --- linux.orig/arch/ppc/kernel/syscalls.c Sun Mar 25 18:31:49 2001
8997 +++ linux/arch/ppc/kernel/syscalls.c Thu Jul 11 15:43:29 2002
8999 struct file * file = NULL;
9002 - down(¤t->mm->mmap_sem);
9004 if (!(flags & MAP_ANONYMOUS)) {
9005 if (fd >= NR_OPEN || !(file = current->files->fd[fd]))
9007 ret = do_mmap(file, addr, len, prot, flags, offset);
9010 - up(¤t->mm->mmap_sem);
9014 @@ -248,14 +246,9 @@
9016 asmlinkage int sys_uname(struct old_utsname * name)
9023 - err = copy_to_user(name, &system_utsname, sizeof (*name));
9025 - return err ? -EFAULT : 0;
9026 + if (name && !copy_to_user(name, &system_utsname, sizeof (*name)))
9031 asmlinkage int sys_olduname(struct oldold_utsname * name)
9033 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname)))
9037 error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN);
9038 error -= __put_user(0,name->sysname+__OLD_UTS_LEN);
9039 error -= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN);
9040 @@ -279,18 +271,6 @@
9041 error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
9042 error = __put_user(0,name->machine+__OLD_UTS_LEN);
9043 error = error ? -EFAULT : 0;
9051 - * Those are normally defined in arch/ppc/kernel/pci.c. But when CONFIG_PCI is
9052 - * not defined, this file is not linked at all, so here are the "empty" versions
9054 -asmlinkage int sys_pciconfig_read() { return -ENOSYS; }
9055 -asmlinkage int sys_pciconfig_write() { return -ENOSYS; }
9056 -asmlinkage long sys_pciconfig_iobase() { return -ENOSYS; }
9059 diff -urN linux.orig/arch/ppc/kernel/time.c linux/arch/ppc/kernel/time.c
9060 --- linux.orig/arch/ppc/kernel/time.c Sun Mar 25 18:31:49 2001
9061 +++ linux/arch/ppc/kernel/time.c Thu Jul 11 15:43:29 2002
9064 #include <asm/machdep.h>
9066 -#include <asm/time.h>
9069 void smp_local_timer_interrupt(struct pt_regs *);
9074 unsigned long cpu = smp_processor_id();
9080 @@ -106,13 +106,6 @@
9081 if ( !smp_processor_id() )
9085 - /* -- BenH -- I'm removing this for now since it can cause various
9086 - * troubles with local-time RTCs. Now that we have a
9087 - * /dev/rtc that uses ppc_md.set_rtc_time() on mac, it
9088 - * should be possible to program the RTC from userland
9092 * update the rtc when needed
9095 /* do it again in 60 s */
9096 last_rtc_update = xtime.tv_sec;
9102 @@ -192,10 +184,10 @@
9104 __initfunc(void time_init(void))
9106 - long time_offset = 0;
9108 if (ppc_md.time_init != NULL)
9109 - time_offset = ppc_md.time_init();
9111 + ppc_md.time_init();
9114 if ((_get_PVR() >> 16) == 1) {
9115 /* 601 processor: dec counts down by 128 every 128ns */
9116 @@ -208,12 +200,6 @@
9118 xtime.tv_sec = ppc_md.get_rtc_time();
9120 - if (time_offset) {
9121 - struct timezone tz;
9122 - tz.tz_minuteswest = time_offset/60;
9123 - tz.tz_dsttime = 0; /* Not handled correctly by the kernel anyway */
9124 - do_sys_settimeofday(NULL, &tz);
9127 set_dec(decrementer_count);
9128 /* allow updates right away */
9129 diff -urN linux.orig/arch/ppc/kernel/time.h linux/arch/ppc/kernel/time.h
9130 --- linux.orig/arch/ppc/kernel/time.h Thu Jan 1 01:00:00 1970
9131 +++ linux/arch/ppc/kernel/time.h Thu Jul 11 15:43:29 2002
9135 + * Common time prototypes and such for all ppc machines.
9137 + * Written by Cort Dougan (cort@cs.nmt.edu) to merge
9138 + * Paul Mackerras' version and mine for PReP and Pmac.
9141 +#include <linux/mc146818rtc.h>
9144 +extern unsigned decrementer_count;
9145 +extern unsigned count_period_num;
9146 +extern unsigned count_period_den;
9147 +extern unsigned long mktime(unsigned int, unsigned int, unsigned int,
9148 + unsigned int, unsigned int, unsigned int);
9149 +extern void to_tm(int tim, struct rtc_time * tm);
9150 +extern time_t last_rtc_update;
9152 +int via_calibrate_decr(void);
9154 +/* Accessor functions for the decrementer register. */
9155 +static __inline__ unsigned int get_dec(void)
9159 + asm volatile("mfspr %0,22" : "=r" (ret) :);
9163 +static __inline__ void set_dec(unsigned int val)
9165 + asm volatile("mtspr 22,%0" : : "r" (val));
9167 diff -urN linux.orig/arch/ppc/kernel/traps.c linux/arch/ppc/kernel/traps.c
9168 --- linux.orig/arch/ppc/kernel/traps.c Sun Mar 25 18:31:48 2001
9169 +++ linux/arch/ppc/kernel/traps.c Thu Jul 11 15:43:29 2002
9170 @@ -100,27 +100,26 @@
9174 - printk("Machine check in kernel mode. (regs at %p)\n", regs);
9175 - printk("Caused by (from srr1): ");
9176 - switch( regs->msr & 0x001F0000) {
9178 - printk("L2 data cache parity error\n");
9179 + printk("Machine check in kernel mode.\n");
9180 + printk("Caused by (from msr): ");
9181 + printk("regs %p ",regs);
9182 + switch( regs->msr & 0x0000F000)
9185 + printk("Machine check signal - probably due to mm fault\n"
9186 + "with mmu off\n");
9189 - printk("Machine check signal\n");
9190 - printk("(probably due to access of bad physical address\n");
9194 printk("Transfer error ack signal\n");
9198 printk("Data parity signal\n");
9202 printk("Address parity signal\n");
9205 - printk("Unknown values in srr1\n");
9206 + printk("Unknown values in msr\n");
9209 #if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
9210 @@ -156,52 +155,9 @@
9211 _exception(SIGTRAP, regs);
9214 -/* Illegal instruction emulation support. Originally written to
9215 - * provide the PVR to user applications using the mfspr rd, PVR.
9216 - * Return non-zero if we can't emulate, or EFAULT if the associated
9217 - * memory access caused an access fault. Return zero on success.
9219 - * There are a couple of ways to do this, either "decode" the instruction
9220 - * or directly match lots of bits. In this case, matching lots of
9221 - * bits is faster and easier.
9224 -#define INST_MFSPR_PVR 0x7c1f42a6
9225 -#define INST_MFSPR_PVR_MASK 0xfc1fffff
9228 -emulate_instruction(struct pt_regs *regs)
9235 - if (!user_mode(regs))
9239 - if (get_user(instword, (uint *)(regs->nip)))
9242 - /* Emulate the mfspr rD, PVR.
9245 - if ((instword & INST_MFSPR_PVR_MASK) == INST_MFSPR_PVR) {
9246 - rd = (instword >> 21) & 0x1f;
9247 - regs->gpr[rd] = _get_PVR();
9256 ProgramCheckException(struct pt_regs *regs)
9260 if (regs->msr & 0x100000) {
9261 /* IEEE FP exception */
9262 _exception(SIGFPE, regs);
9263 @@ -213,13 +169,7 @@
9265 _exception(SIGTRAP, regs);
9267 - /* Try to emulate it if we should. */
9268 - if ((errcode = emulate_instruction(regs))) {
9269 - if (errcode == EFAULT)
9270 - _exception(SIGBUS, regs);
9272 - _exception(SIGILL, regs);
9274 + _exception(SIGILL, regs);
9278 diff -urN linux.orig/arch/ppc/lib/string.S linux/arch/ppc/lib/string.S
9279 --- linux.orig/arch/ppc/lib/string.S Sun Mar 25 18:31:49 2001
9280 +++ linux/arch/ppc/lib/string.S Thu Jul 11 15:43:29 2002
9282 #include <asm/processor.h>
9283 #include <asm/errno.h>
9285 -CACHELINE_BYTES = 32
9286 -LG_CACHELINE_BYTES = 5
9287 -CACHELINE_MASK = 0x1f
9288 -CACHELINE_WORDS = 8
9297 -#if 0 /* Clever, but breaks fb stuff -- paulus */
9299 - * Use dcbz on the complete cache lines in the destination if
9300 - * we are setting to zero. This requires that the destination
9301 - * area is cacheable. -- paulus
9305 - clrlwi r7,r6,32-LG_CACHELINE_BYTES
9307 - srwi r9,r8,LG_CACHELINE_BYTES
9308 - addic. r9,r9,-1 /* total number of complete cachelines */
9310 - xori r0,r7,CACHELINE_MASK & ~3
9319 - addi r6,r6,CACHELINE_BYTES
9321 - clrlwi r5,r8,32-LG_CACHELINE_BYTES
9326 + rlwinm r0,r5,32-2,2,31
9330 @@ -140,94 +107,11 @@
9333 bgt backwards_memcpy
9335 + /* fall through */
9339 -#if 0 /* Clever, but will probably break fb stuff -- paulus */
9341 - * This version uses dcbz on the complete cache lines in the
9342 - * destination area to reduce memory traffic. This requires that
9343 - * the destination area is cacheable.
9344 - * We only use this version if the source and dest don't overlap.
9347 - add r7,r3,r5 /* test if the src & dst overlap */
9351 - crand 0,0,4 /* cr0.lt &= cr1.lt */
9352 - blt forwards_memcpy /* if regions overlap */
9357 - andi. r0,r0,CACHELINE_MASK /* # bytes to start of cache line */
9360 - cmplw 0,r5,r0 /* is this more than total to do? */
9361 - blt 63f /* if not much to do */
9362 - andi. r8,r0,3 /* get it word-aligned first */
9366 -70: lbz r9,4(r4) /* do some bytes */
9374 -72: lwzu r9,4(r4) /* do some words */
9378 -58: srwi. r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */
9379 - clrlwi r5,r5,32-LG_CACHELINE_BYTES
9420 - .global forwards_memcpy
9423 + rlwinm. r7,r5,32-3,3,31 /* r0 = r5 >> 3 */
9426 beq 2f /* if less than 8 bytes to do */
9427 @@ -334,167 +218,106 @@
9429 .globl __copy_tofrom_user
9435 - andi. r0,r0,CACHELINE_MASK /* # bytes to start of cache line */
9438 - cmplw 0,r5,r0 /* is this more than total to do? */
9439 - blt 63f /* if not much to do */
9440 - andi. r8,r0,3 /* get it word-aligned first */
9443 -70: lbz r9,4(r4) /* do some bytes */
9452 -72: lwzu r9,4(r4) /* do some words */
9456 -58: srwi. r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */
9457 - clrlwi r5,r5,32-LG_CACHELINE_BYTES
9465 -13: lwzu r10,16(r4)
9469 -17: stwu r10,16(r6)
9473 -23: lwzu r10,16(r4)
9477 -27: stwu r10,16(r6)
9493 + li r3,0 /* success return value */
9494 + beq 2f /* if less than 8 bytes to do */
9495 + andi. r0,r6,3 /* get dest word aligned */
9509 +3: cmpwi 0,r5,0 /* do 1 byte at a time for the remainder */
9518 +5: subfic r0,r0,4 /* copy bytes until we have the */
9519 + mtctr r0 /* destination 4-byte aligned */
9529 -/* read fault, initial single-byte copy */
9532 -/* write fault, initial single-byte copy */
9537 -/* read fault, initial word copy */
9540 -/* write fault, initial word copy */
9544 -/* read fault in 2nd half of cacheline loop */
9545 -106: addi r5,r5,-16
9546 -/* read fault in 1st half of cacheline loop */
9549 -/* write fault in 2nd half of cacheline loop */
9550 -107: addi r5,r5,-16
9551 -/* fault on dcbz (effectively a write fault) */
9552 -/* or write fault in 1st half of cacheline loop */
9554 -92: li r3,LG_CACHELINE_BYTES
9556 -/* read fault in final word loop */
9559 -/* write fault in final word loop */
9564 -/* read fault in final byte loop */
9567 -/* write fault in final byte loop */
9572 - * At this stage the number of bytes not copied is
9573 - * r5 + (ctr << r3), and r4 is 0 for read or 1 for write.
9582 +/* we come here on a fault in the 8-byte-at-a-time loop */
9583 +88: subi r4,r4,8 /* compensate for the lwzu */
9585 + rlwimi r5,r0,3,0,28 /* use the byte-at-a-time loop to */
9586 + b 3b /* copy up to the byte at fault */
9587 +/* here on a write fault in the single-word copy */
9590 +/* here on a read fault in the initial single-byte copy */
9595 -/* for read fault, clear out the destination: r3 bytes starting at 4(r6) */
9607 +/* here on a read fault in the final single-byte copy */
9610 +/* clear out the rest of the destination: r3 bytes starting at 4(r6) */
9634 +/* here on a write fault in the initial single-byte copy */
9638 +/* here on a write fault in the final single-byte copy */
9642 .section __ex_table,"a"
9691 + /*rlwinm r0,r4,32-2,2,31*/
9695 diff -urN linux.orig/arch/ppc/mm/extable.c linux/arch/ppc/mm/extable.c
9696 --- linux.orig/arch/ppc/mm/extable.c Sun Mar 25 18:31:48 2001
9697 +++ linux/arch/ppc/mm/extable.c Thu Jul 11 15:43:29 2002
9699 #include <linux/module.h>
9700 #include <asm/uaccess.h>
9702 -extern struct exception_table_entry __start___ex_table[];
9703 -extern struct exception_table_entry __stop___ex_table[];
9706 - * The exception table needs to be sorted because we use the macros
9707 - * which put things into the exception table in a variety of segments
9708 - * such as the prep, pmac, chrp, etc. segments as well as the init
9709 - * segment and the main kernel text segment.
9712 -sort_ex_table(struct exception_table_entry *start,
9713 - struct exception_table_entry *finish)
9715 - struct exception_table_entry el, *p, *q;
9717 - /* insertion sort */
9718 - for (p = start + 1; p < finish; ++p) {
9719 - /* start .. p-1 is sorted */
9720 - if (p[0].insn < p[-1].insn) {
9721 - /* move element p down to its right place */
9725 - /* el comes before q[-1], move q[-1] up one */
9728 - } while (q > start && el.insn < q[-1].insn);
9735 -sort_exception_table(void)
9737 - sort_ex_table(__start___ex_table, __stop___ex_table);
9739 +extern const struct exception_table_entry __start___ex_table[];
9740 +extern const struct exception_table_entry __stop___ex_table[];
9742 static inline unsigned long
9743 search_one_table(const struct exception_table_entry *first,
9748 -#ifndef CONFIG_MODULES
9749 +#if 1 /*ndef CONFIG_MODULES*/
9750 /* There is only the kernel to search. */
9751 ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr);
9752 if (ret) return ret;
9753 diff -urN linux.orig/arch/ppc/mm/fault.c linux/arch/ppc/mm/fault.c
9754 --- linux.orig/arch/ppc/mm/fault.c Sun Mar 25 18:31:48 2001
9755 +++ linux/arch/ppc/mm/fault.c Thu Jul 11 15:43:29 2002
9757 (error_code&0x80000000)?"I/O ":"",
9758 (regs->trap == 0x400)?"instr":"data"
9761 - if (regs->trap == 0x400)
9762 - error_code &= 0x48200000;
9765 #if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
9766 if (debugger_fault_handler && regs->trap == 0x300) {
9767 debugger_fault_handler(regs);
9768 diff -urN linux.orig/arch/ppc/mm/init.c linux/arch/ppc/mm/init.c
9769 --- linux.orig/arch/ppc/mm/init.c Sun Mar 25 18:31:48 2001
9770 +++ linux/arch/ppc/mm/init.c Thu Jul 11 15:43:30 2002
9771 @@ -416,12 +416,7 @@
9773 void iounmap(void *addr)
9775 - /* For support of dynamic hot swap on the cPCI bus this routine
9776 - is now necessary. This has been well tested on a Motorola
9777 - MPC750 (Mesquite) processor board. Johnnie Peters
9779 - if (addr > high_memory && (unsigned long) addr < ioremap_bot)
9780 - return vfree((void *) (PAGE_MASK & (unsigned long) addr));
9784 unsigned long iopa(unsigned long addr)
9785 @@ -933,21 +928,15 @@
9786 /* On the powerpc, no user access
9787 forces R/W kernel access */
9789 - map_page(v, p, f);
9795 #else /* CONFIG_8xx */
9796 - for (i = 0; i < phys_mem.n_regions; ++i) {
9797 - v = (ulong)__va(phys_mem.regions[i].address);
9798 - p = phys_mem.regions[i].address;
9799 - for (s = 0; s < phys_mem.regions[i].size; s += PAGE_SIZE) {
9800 + for (i = 0; i < phys_mem.n_regions; ++i) {
9801 + v = (ulong)__va(phys_mem.regions[i].address);
9802 + p = phys_mem.regions[i].address;
9803 + for (s = 0; s < phys_mem.regions[i].size; s += PAGE_SIZE) {
9804 /* On the MPC8xx, we want the page shared so we
9805 * don't get ASID compares on kernel space.
9807 - f = _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_SHARED;
9808 + f = _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_SHARED;
9810 /* I don't really need the rest of this code, but
9811 * I grabbed it because I think the line:
9812 @@ -957,14 +946,14 @@
9813 * the MPC8xx, the PAGE_DIRTY takes care of that
9814 * for us (along with the RW software state).
9816 - if ((char *) v < _stext || (char *) v >= etext)
9817 - f |= _PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE;
9818 + if ((char *) v < _stext || (char *) v >= etext)
9819 + f |= _PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE;
9820 +#endif /* CONFIG_8xx */
9826 -#endif /* CONFIG_8xx */
9830 /* This can get called from ioremap, so don't make it an initfunc, OK? */
9831 @@ -1044,9 +1033,6 @@
9835 -#ifdef CONFIG_BOOTX_TEXT
9836 -extern boot_infos_t *disp_bi;
9838 __initfunc(void MMU_init(void))
9841 @@ -1066,6 +1052,7 @@
9842 #endif /* CONFIG_GEMINI */
9844 end_of_DRAM = prep_find_end_of_memory();
9845 +*(unsigned long *)(KERNELBASE) = 0xdeadbeef;
9847 _SDR1 = __pa(Hash) | (Hash_mask >> 10);
9848 ioremap_base = 0xf8000000;
9849 @@ -1095,13 +1082,7 @@
9850 struct device_node *macio = find_devices("mac-io");
9851 if (macio && macio->n_addrs)
9852 base = macio->addrs[0].address;
9853 - /* Hrm... we have it at 0x80000000 on some machines
9854 - * and this is covered by the userland segment
9855 - * registers. Isn't that bad ? Well, the BAT takes
9856 - * precedence, but I don't like it. --BenH
9858 - if (base >= 0xf0000000)
9859 - setbat(0, base, base, 0x100000, IO_PAGE);
9860 + setbat(0, base, base, 0x100000, IO_PAGE);
9861 ioremap_base = 0xf0000000;
9864 @@ -1140,10 +1121,6 @@
9865 ioremap(0x80000000, 0x4000);
9866 ioremap(0x81000000, 0x4000);
9867 #endif /* CONFIG_8xx */
9868 -#ifdef CONFIG_BOOTX_TEXT
9869 - if (_machine == _MACH_Pmac)
9875 @@ -1275,8 +1252,8 @@
9876 #endif /* CONFIG_BLK_DEV_INITRD */
9879 - addr < (rtas_data + KERNELBASE) ||
9880 - addr >= (rtas_data + KERNELBASE + rtas_size))
9881 + addr < (rtas_data & PAGE_MASK) ||
9882 + addr >= (rtas_data+rtas_size))
9883 #endif /* CONFIG_8xx */
9886 @@ -1337,7 +1314,6 @@
9889 #endif /* CONFIG_MBX */
9893 * On systems with Open Firmware, collect information about
9894 @@ -1404,7 +1380,6 @@
9895 if (boot_infos == 0) {
9896 /* record which bits the prom is using */
9897 get_mem_prop("available", &phys_avail);
9898 - remove_mem_piece(&phys_avail, __max_memory, ~__max_memory, 0);
9899 prom_mem = phys_mem;
9900 for (i = 0; i < phys_avail.n_regions; ++i)
9901 remove_mem_piece(&prom_mem,
9902 diff -urN linux.orig/arch/ppc/pmac_defconfig linux/arch/ppc/pmac_defconfig
9903 --- linux.orig/arch/ppc/pmac_defconfig Sun Mar 25 18:31:50 2001
9904 +++ linux/arch/ppc/pmac_defconfig Thu Jul 11 15:43:30 2002
9906 CONFIG_NET_ETHERNET=y
9910 # CONFIG_NET_VENDOR_3COM is not set
9911 # CONFIG_LANCE is not set
9912 # CONFIG_NET_VENDOR_SMC is not set
9914 CONFIG_FB_PLATINUM=y
9915 CONFIG_FB_VALKYRIE=y
9920 # CONFIG_FB_S3TRIO is not set
9921 diff -urN linux.orig/arch/ppc/xmon/start.c linux/arch/ppc/xmon/start.c
9922 --- linux.orig/arch/ppc/xmon/start.c Sun Mar 25 18:31:50 2001
9923 +++ linux/arch/ppc/xmon/start.c Thu Jul 11 15:43:30 2002
9925 #include <asm/prom.h>
9926 #include <asm/bootx.h>
9927 #include <asm/pmu.h>
9928 -#include <asm/feature.h>
9930 static volatile unsigned char *sccc, *sccd;
9931 unsigned long TXRDY, RXRDY;
9932 extern void xmon_printf(const char *fmt, ...);
9933 +extern void map_bootx_text(void);
9934 extern void drawchar(char);
9935 extern void drawstring(const char *str);
9936 -static int xmon_expect(const char *str, unsigned int timeout);
9938 static int console = 0;
9939 static int use_screen = 0;
9940 -static int via_modem = 0;
9941 -static int xmon_use_sccb = 0;
9942 -static struct device_node *macio_node;
9944 -#define TB_SPEED 25000000
9946 -static inline unsigned int readtb(void)
9950 - asm volatile("mftb %0" : "=r" (ret) :);
9954 void buf_access(void)
9957 if ( _machine == _MACH_Pmac )
9959 struct device_node *np;
9960 + extern boot_infos_t *boot_infos;
9962 -#ifdef CONFIG_BOOTX_TEXT
9963 - extern boot_infos_t *disp_bi;
9965 - /* needs to be hacked if xmon_printk is to be used
9966 - from within find_via_pmu() */
9967 - if (!via_modem && disp_bi && find_via_pmu()) {
9968 +#ifdef CONFIG_BOOTX_TEXT
9969 + if (boot_infos != 0 && find_via_pmu()) {
9970 printk(KERN_INFO "xmon uses screen and keyboard\n");
9982 np = find_devices("mac-io");
9983 if (np && np->n_addrs) {
9985 - addr = np->addrs[0].address + 0x13020;
9986 + addr = np->addrs[0].address + 0x13000;
9987 + /* use the B channel on the iMac, A channel on others */
9988 + if (addr >= 0xf0000000)
9989 + addr += 0x20; /* use A channel */
9991 - base = (volatile unsigned char *)
9992 - ioremap(addr & PAGE_MASK, PAGE_SIZE);
9993 + base = (volatile unsigned char *) ioremap(addr & PAGE_MASK, PAGE_SIZE);
9994 sccc = base + (addr & ~PAGE_MASK);
9995 - sccd = sccc + 0x10;
9997 + sccd = sccc + (0xc1013030 - 0xc1013020);
9999 + sccd = sccc + (0xf3013030 - 0xf3013020);
10005 xmon_write(void *handle, void *ptr, int nb)
10011 #ifdef CONFIG_BOOTX_TEXT
10013 @@ -111,23 +101,19 @@
10015 if (!scc_initialized)
10018 for (i = 0; i < nb; ++i) {
10019 while ((*sccc & TXRDY) == 0)
10020 if (adb_hardware == ADB_VIAPMU)
10023 - if (c == '\n' && !ct) {
10034 + if ( console && (*p != '\r'))
10035 + printk("%c", *p);
10041 + xmon_write(handle, "\r", 1);
10045 @@ -213,30 +199,23 @@
10046 if (adb_hardware == ADB_VIAPMU)
10051 + if ( 0/*console*/ )
10052 + *p++ = ppc_md.kbd_getkeycode();
10061 -xmon_read_poll(void)
10063 - if ((*sccc & RXRDY) == 0) {
10064 - if (adb_hardware == ADB_VIAPMU)
10072 static unsigned char scc_inittab[] = {
10073 13, 0, /* set baud rate divisor */
10075 14, 1, /* baud rate gen enable, src=rtxc */
10076 11, 0x50, /* clocks = br gen */
10077 - 5, 0xea, /* tx 8 bits, assert DTR & RTS */
10078 - 4, 0x46, /* x16 clock, 1 stop */
10079 + 5, 0x6a, /* tx 8 bits, assert RTS */
10080 + 4, 0x44, /* x16 clock, 1 stop */
10081 3, 0xc1, /* rx enable, 8 bits */
10084 @@ -256,21 +235,6 @@
10088 - if (macio_node != 0) {
10091 - feature_set(macio_node, FEATURE_Serial_enable);
10093 - feature_set(macio_node, FEATURE_Modem_power);
10095 - while (readtb() - t0 < 3*TB_SPEED)
10099 - if (xmon_use_sccb) {
10103 for (i = 20000; i != 0; --i) {
10104 x = *sccc; eieio();
10106 @@ -282,18 +246,6 @@
10109 scc_initialized = 1;
10112 - xmon_write(0, "ATE1V1\r", 7);
10113 - if (xmon_expect("OK", 5)) {
10114 - xmon_write(0, "ATA\r", 4);
10115 - if (xmon_expect("CONNECT", 40))
10118 - xmon_write(0, "+++", 3);
10119 - xmon_expect("OK", 3);
10125 @@ -366,35 +318,6 @@
10126 static char *lineptr;
10127 static int lineleft;
10129 -int xmon_expect(const char *str, unsigned int timeout)
10134 - timeout *= TB_SPEED;
10139 - c = xmon_read_poll();
10141 - if (readtb() - t0 > timeout) {
10142 - printk("timeout\n");
10150 - if (c != '\r' && lineptr < &line[sizeof(line) - 1])
10154 - } while (strstr(line, str) == NULL);
10161 @@ -467,15 +390,3 @@
10177 diff -urN linux.orig/arch/ppc/xmon/xmon.c linux/arch/ppc/xmon/xmon.c
10178 --- linux.orig/arch/ppc/xmon/xmon.c Sun Mar 25 18:31:50 2001
10179 +++ linux/arch/ppc/xmon/xmon.c Thu Jul 11 15:43:30 2002
10181 extern int setjmp(u_int *);
10182 extern void longjmp(u_int *, int);
10184 -extern void xmon_enter(void);
10185 -extern void xmon_leave(void);
10187 #define GETWORD(v) (((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3])
10189 static char *help_string = "\
10190 @@ -142,7 +139,6 @@
10192 set_msr(msr & ~0x8000); /* disable interrupts */
10198 @@ -155,7 +151,6 @@
10203 set_msr(msr); /* restore interrupt enable */
10206 diff -urN linux.orig/include/asm-ppc/irq-compat.h linux/include/asm-ppc/irq-compat.h
10207 --- linux.orig/include/asm-ppc/irq-compat.h Thu Jan 1 01:00:00 1970
10208 +++ linux/include/asm-ppc/irq-compat.h Thu Jul 11 15:43:30 2002
10210 +#include <asm/irq.h>
10212 +//#define NUM_8259_INTERRUPTS 16
10213 +//#define NUM_OPENPIC_INTERRUPTS 20
10214 +//#define is_8259_irq(n) ((n) < NUM_8259_INTERRUPTS)
10215 +#define openpic_to_irq(n) ((n)+NUM_8259_INTERRUPTS)
10216 +//#define irq_to_openpic(n) ((n)-NUM_8259_INTERRUPTS)
10217 +//#define IRQ_8259_CASCADE NUM_8259_INTERRUPTS
10218 diff -urN linux.orig/include/asm-ppc/ohare-compat.h linux/include/asm-ppc/ohare-compat.h
10219 --- linux.orig/include/asm-ppc/ohare-compat.h Thu Jan 1 01:00:00 1970
10220 +++ linux/include/asm-ppc/ohare-compat.h Thu Jul 11 15:43:30 2002
10222 +#define OH_BAY_RESET 2 /* a guess */
10223 +#define OH_IDE_ENABLE 0x20
10224 +#define OH_IDE_POWER 0x40 /* a guess */
10225 +#define OH_BAY_ENABLE 0x80
10226 +#define OH_IDE_RESET 0x100 /* 0-based, a guess */
10227 +#define OH_VIA_ENABLE 0x10000
10228 +#define OH_IDECD_POWER 0x800000
10229 diff -urN linux.orig/include/asm-ppc/page.h linux/include/asm-ppc/page.h
10230 --- linux.orig/include/asm-ppc/page.h Sun Mar 25 18:37:39 2001
10231 +++ linux/include/asm-ppc/page.h Thu Jul 11 15:43:30 2002
10233 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
10235 extern void clear_page(unsigned long page);
10236 -extern void copy_page(unsigned long to, unsigned long from);
10237 +#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
10239 /* map phys->virtual and virtual->phys for RAM pages */
10241 diff -urN linux.orig/include/asm-ppc/pf-compat.h linux/include/asm-ppc/pf-compat.h
10242 --- linux.orig/include/asm-ppc/pf-compat.h Thu Jan 1 01:00:00 1970
10243 +++ linux/include/asm-ppc/pf-compat.h Thu Jul 11 15:43:30 2002
10245 +#define PF_TRACESYS 0x00000020 /* tracing system calls */
10246 +#define PF_PTRACED 0x00000010 /* set if ptrace (0) has been called */