1 diff -urN linux.orig/arch/ppc/boot/Makefile linux/arch/ppc/boot/Makefile
2 --- linux.orig/arch/ppc/boot/Makefile Sun Mar 25 18:31:49 2001
3 +++ linux/arch/ppc/boot/Makefile Fri Jul 12 19:00:55 2002
5 zvmlinux.initrd: zvmlinux
6 $(LD) $(ZLINKFLAGS) -o zvmlinux.initrd.tmp $(OBJECTS)
7 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
8 - --add-section=initrd=../coffboot/ramdisk.image.gz \
9 + --add-section=initrd=ramdisk.image.gz \
10 --add-section=image=../coffboot/vmlinux.gz \
11 zvmlinux.initrd.tmp zvmlinux.initrd
12 $(CC) $(CFLAGS) -DINITRD_OFFSET=`sh offset $(OBJDUMP) zvmlinux.initrd initrd` \
15 $(LD) $(ZLINKFLAGS) -o zvmlinux.initrd.tmp $(OBJECTS)
16 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
17 - --add-section=initrd=../coffboot/ramdisk.image.gz \
18 + --add-section=initrd=ramdisk.image.gz \
19 --add-section=image=../coffboot/vmlinux.gz \
20 zvmlinux.initrd.tmp $@
21 rm zvmlinux.initrd.tmp
22 diff -urN linux.orig/arch/ppc/coffboot/Makefile linux/arch/ppc/coffboot/Makefile
23 --- linux.orig/arch/ppc/coffboot/Makefile Sun Mar 25 18:31:49 2001
24 +++ linux/arch/ppc/coffboot/Makefile Thu Jul 11 15:43:29 2002
26 LD = $(CROSS_COMPILE)ld
27 CFLAGS = $(CPPFLAGS) -O -fno-builtin -I$(HPATH)
28 OBJCOPY = $(CROSS_COMPILE)objcopy
29 -OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
30 -COFF_LD_ARGS = -e _start -T ld.script -Ttext 500000 -Tdata 510000 -Bstatic
31 -CHRP_LD_ARGS = -Ttext 0x01000000
32 +OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment \
33 + --add-section=image=vmlinux.gz
34 +LD_ARGS = -e _start -T ld.script -Ttext 500000 -Tdata 510000 -Bstatic
37 -COFFOBJS = coffcrt0.o start.o coffmain.o misc.o string.o zlib.o image.o
38 -CHRPOBJS = crt0.o start.o chrpmain.o misc.o string.o zlib.o image.o
39 +OBJS = crt0.o start.o main.o misc.o string.o zlib.o
40 LIBS = $(TOPDIR)/lib/lib.a
42 ifeq ($(CONFIG_PPC64),y)
44 hack-coff: hack-coff.c
45 $(HOSTCC) $(HOSTCFLAGS) -o hack-coff hack-coff.c
47 -znetboot: vmlinux.coff zImage vmlinux.elf
48 - cp vmlinux.coff $(TFTPIMAGE)
49 - cp vmlinux.elf $(TFTPIMAGE).elf
51 -znetboot.initrd: vmlinux.coff.initrd vmlinux.elf.initrd
52 - cp vmlinux.coff.initrd $(TFTPIMAGE)
53 - cp vmlinux.elf.initrd $(TFTPIMAGE).elf
56 # mount -t hfs /dev/fd0 /mnt
57 # cp vmlinux.coff /mnt
60 -coffboot: $(COFFOBJS) no_initrd.o ld.script
61 - $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) no_initrd.o $(LIBS)
63 -coffboot.initrd: $(COFFOBJS) initrd.o ld.script
64 - $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) initrd.o $(LIBS)
65 +znetboot: vmlinux.coff
66 + cp vmlinux.coff $(TFTPIMAGE)
68 -piggyback: piggyback.c
69 - $(HOSTCC) $(HOSTCFLAGS) -DKERNELBASE=$(KERNELBASE) -o piggyback piggyback.c
70 +znetboot.initrd: vmlinux.coff.initrd
71 + cp vmlinux.coff.initrd $(TFTPIMAGE)
74 - $(HOSTCC) $(HOSTCFLAGS) -o mknote mknote.c
75 +coffboot: $(OBJS) ld.script
76 + $(LD) -o coffboot $(LD_ARGS) $(OBJS) $(LIBS)
78 -image.o: piggyback vmlinux.gz
79 - ./piggyback image < vmlinux.gz | $(AS) -o image.o
82 -initrd.o: ramdisk.image.gz piggyback
83 - ./piggyback initrd < ramdisk.image.gz | $(AS) -o initrd.o
84 +zImage.initrd: vmlinux.coff.initrd
86 -vmlinux.coff: coffboot hack-coff
87 +vmlinux.coff: coffboot hack-coff vmlinux.gz
88 $(OBJCOPY) $(OBJCOPY_ARGS) coffboot $@
90 ln -sf vmlinux.coff zImage
92 -vmlinux.coff.initrd: coffboot.initrd hack-coff
93 - $(OBJCOPY) $(OBJCOPY_ARGS) coffboot.initrd $@
94 +vmlinux.coff.initrd: coffboot hack-coff vmlinux.gz ramdisk.image.gz
95 + $(OBJCOPY) $(OBJCOPY_ARGS) --add-section=initrd=ramdisk.image.gz \
99 -vmlinux.elf: $(CHRPOBJS) no_initrd.o mknote
100 - $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) no_initrd.o $(LIBS)
102 - $(OBJCOPY) $@ $@ --add-section=.note=note -R .comment
104 -vmlinux.elf.initrd: $(CHRPOBJS) initrd.o mknote
105 - $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) initrd.o $(LIBS)
107 - $(OBJCOPY) $@ $@ --add-section=.note=note -R .comment
110 - $(LD) -o $@ $(COFF_LD_ARGS) dummy.o $(LIBS)
112 -miboot.image: micoffboot hack-coff vmlinux.gz
113 - $(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=vmlinux.gz micoffboot $@
116 -miboot.image.initrd: micoffboot hack-coff vmlinux.gz ramdisk.image.gz
117 - $(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=vmlinux.gz \
118 - --add-section=initrd=ramdisk.image.gz micoffboot $@
121 -zImage: vmlinux.coff vmlinux.elf miboot.image
123 -zImage.initrd: vmlinux.coff.initrd vmlinux.elf.initrd miboot.image.initrd
128 znetboot.initrd: vmlinux.gz
130 -miboot.image: vmlinux.gz
132 -miboot.image.initrd: vmlinux.gz
140 rm -f hack-coff coffboot zImage vmlinux.coff vmlinux.gz
141 - rm -f mknote piggyback vmlinux.elf note
142 - rm -f micoffboot miboot.image
145 diff -urN linux.orig/arch/ppc/coffboot/chrpmain.c linux/arch/ppc/coffboot/chrpmain.c
146 --- linux.orig/arch/ppc/coffboot/chrpmain.c Sun Mar 25 18:31:49 2001
147 +++ linux/arch/ppc/coffboot/chrpmain.c Thu Jan 1 01:00:00 1970
150 - * Copyright (C) Paul Mackerras 1997.
152 - * This program is free software; you can redistribute it and/or
153 - * modify it under the terms of the GNU General Public License
154 - * as published by the Free Software Foundation; either version
155 - * 2 of the License, or (at your option) any later version.
157 -#include "nonstdio.h"
160 -extern void *finddevice(const char *);
161 -extern int getprop(void *, const char *, void *, int);
162 -void gunzip(void *, int, unsigned char *, int *);
163 -void stop_imac_ethernet(void);
164 -void stop_imac_usb(void);
166 -#define get_16be(x) (*(unsigned short *)(x))
167 -#define get_32be(x) (*(unsigned *)(x))
169 -#define RAM_END (16 << 20)
171 -#define PROG_START 0x00010000
172 -#define PROG_SIZE 0x003f0000
174 -#define SCRATCH_SIZE (128 << 10)
177 -char *begin_avail, *end_avail;
179 -unsigned int heap_use;
180 -unsigned int heap_max;
183 -extern char image_data[];
184 -extern int image_len;
185 -extern char initrd_data[];
186 -extern int initrd_len;
189 -boot(int a1, int a2, void *prom)
195 - unsigned initrd_start, initrd_size;
196 - extern char _start;
198 - printf("chrpboot starting: loaded at 0x%x\n", &_start);
200 - initrd_size = initrd_len;
201 - initrd_start = (RAM_END - initrd_size) & ~0xFFF;
204 - claim(initrd_start, RAM_END - initrd_start, 0);
205 - printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n",
206 - initrd_start, initrd_data, initrd_size);
207 - memcpy((char *)initrd_start, initrd_data, initrd_size);
211 - /* claim 3MB starting at PROG_START */
212 - claim(PROG_START, PROG_SIZE, 0);
213 - dst = (void *) PROG_START;
214 - if (im[0] == 0x1f && im[1] == 0x8b) {
215 - /* claim some memory for scratch space */
216 - avail_ram = (char *) claim(0, SCRATCH_SIZE, 0x10);
217 - begin_avail = avail_high = avail_ram;
218 - end_avail = avail_ram + SCRATCH_SIZE;
219 - printf("heap at 0x%x\n", avail_ram);
220 - printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len);
221 - gunzip(dst, PROG_SIZE, im, &len);
222 - printf("done %u bytes\n", len);
223 - printf("%u bytes of heap consumed, max in use %u\n",
224 - avail_high - begin_avail, heap_max);
226 - memmove(dst, im, len);
229 - flush_cache(dst, len);
231 - stop_imac_ethernet();
235 - sa = (unsigned long)PROG_START;
236 - printf("start address = 0x%x\n", sa);
238 - (*(void (*)())sa)(a1, a2, prom);
240 - printf("returned?\n");
246 -#define eieio() asm volatile("eieio");
248 -void stop_imac_ethernet(void)
250 - void *macio, *enet;
251 - unsigned int macio_addr[5], enet_reg[6];
253 - volatile unsigned int *dbdma;
255 - macio = finddevice("/pci/mac-io");
256 - enet = finddevice("/pci/mac-io/ethernet");
257 - if (macio == NULL || enet == NULL)
259 - len = getprop(macio, "assigned-addresses", macio_addr, sizeof(macio_addr));
260 - if (len != sizeof(macio_addr))
262 - len = getprop(enet, "reg", enet_reg, sizeof(enet_reg));
263 - if (len != sizeof(enet_reg))
265 - printf("macio base %x, dma at %x & %x\n",
266 - macio_addr[2], enet_reg[2], enet_reg[4]);
268 - /* hope this is mapped... */
269 - dbdma = (volatile unsigned int *) (macio_addr[2] + enet_reg[2]);
270 - *dbdma = 0x80; /* clear the RUN bit */
272 - dbdma = (volatile unsigned int *) (macio_addr[2] + enet_reg[4]);
273 - *dbdma = 0x80; /* clear the RUN bit */
277 -void stop_imac_usb(void)
280 - unsigned int usb_addr[5];
282 - volatile unsigned int *usb_ctrl;
284 - usb = finddevice("/pci/usb");
287 - len = getprop(usb, "assigned-addresses", usb_addr, sizeof(usb_addr));
288 - if (len != sizeof(usb_addr))
290 - printf("usb base %x\n", usb_addr[2]);
292 - usb_ctrl = (volatile unsigned int *) (usb_addr[2] + 8);
293 - *usb_ctrl = 0x01000000; /* cpu_to_le32(1) */
300 - struct memchunk *next;
303 -static struct memchunk *freechunks;
305 -void *zalloc(void *x, unsigned items, unsigned size)
308 - struct memchunk **mpp, *mp;
311 - size = (size + 7) & -8;
313 - if (heap_use > heap_max)
314 - heap_max = heap_use;
315 - for (mpp = &freechunks; (mp = *mpp) != 0; mpp = &mp->next) {
316 - if (mp->size == size) {
323 - if (avail_ram > avail_high)
324 - avail_high = avail_ram;
325 - if (avail_ram > end_avail) {
326 - printf("oops... out of memory\n");
332 -void zfree(void *x, void *addr, unsigned nb)
334 - struct memchunk *mp = addr;
336 - nb = (nb + 7) & -8;
338 - if (avail_ram == addr + nb) {
343 - mp->next = freechunks;
348 -#define EXTRA_FIELD 4
350 -#define COMMENT 0x10
351 -#define RESERVED 0xe0
355 -void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
363 - if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
364 - printf("bad gzipped data\n");
367 - if ((flags & EXTRA_FIELD) != 0)
368 - i = 12 + src[10] + (src[11] << 8);
369 - if ((flags & ORIG_NAME) != 0)
370 - while (src[i++] != 0)
372 - if ((flags & COMMENT) != 0)
373 - while (src[i++] != 0)
375 - if ((flags & HEAD_CRC) != 0)
378 - printf("gunzip: ran out of data in header\n");
384 - r = inflateInit2(&s, -MAX_WBITS);
386 - printf("inflateInit2 returned %d\n", r);
389 - s.next_in = src + i;
390 - s.avail_in = *lenp - i;
392 - s.avail_out = dstlen;
393 - r = inflate(&s, Z_FINISH);
394 - if (r != Z_OK && r != Z_STREAM_END) {
395 - printf("inflate returned %d msg: %s\n", r, s.msg);
398 - *lenp = s.next_out - (unsigned char *) dst;
401 diff -urN linux.orig/arch/ppc/coffboot/coffcrt0.S linux/arch/ppc/coffboot/coffcrt0.S
402 --- linux.orig/arch/ppc/coffboot/coffcrt0.S Sun Mar 25 18:31:49 2001
403 +++ linux/arch/ppc/coffboot/coffcrt0.S Thu Jan 1 01:00:00 1970
406 - * Copyright (C) Paul Mackerras 1997.
408 - * This program is free software; you can redistribute it and/or
409 - * modify it under the terms of the GNU General Public License
410 - * as published by the Free Software Foundation; either version
411 - * 2 of the License, or (at your option) any later version.
429 diff -urN linux.orig/arch/ppc/coffboot/coffmain.c linux/arch/ppc/coffboot/coffmain.c
430 --- linux.orig/arch/ppc/coffboot/coffmain.c Sun Mar 25 18:31:49 2001
431 +++ linux/arch/ppc/coffboot/coffmain.c Thu Jan 1 01:00:00 1970
434 - * Copyright (C) Paul Mackerras 1997.
436 - * This program is free software; you can redistribute it and/or
437 - * modify it under the terms of the GNU General Public License
438 - * as published by the Free Software Foundation; either version
439 - * 2 of the License, or (at your option) any later version.
441 -#include "nonstdio.h"
444 -extern void *finddevice(const char *);
445 -extern int getprop(void *, const char *, void *, int);
446 -extern char *claim(unsigned, unsigned, unsigned);
447 -void gunzip(void *, int, unsigned char *, int *);
449 -#define get_16be(x) (*(unsigned short *)(x))
450 -#define get_32be(x) (*(unsigned *)(x))
452 -#define RAM_START 0xc0000000
453 -#define PROG_START RAM_START
454 -#define RAM_END (RAM_START + 0x800000) /* only 8M mapped with BATs */
459 -extern char _start[], _end[];
460 -extern char image_data[];
461 -extern int image_len;
462 -extern char initrd_data[];
463 -extern int initrd_len;
466 -boot(int a1, int a2, void *prom)
472 - unsigned initrd_start, initrd_size;
474 - printf("coffboot starting: loaded at 0x%x\n", _start);
475 - setup_bats(RAM_START);
477 - initrd_size = initrd_len;
478 - initrd_start = (RAM_END - initrd_size) & ~0xFFF;
481 - claim(initrd_start - RAM_START, RAM_END - initrd_start, 0);
482 - printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n",
483 - initrd_start, initrd_data, initrd_size);
484 - memcpy((char *)initrd_start, initrd_data, initrd_size);
488 - /* claim 3MB starting at 0 */
489 - claim(0, 3 << 20, 0);
490 - dst = (void *) RAM_START;
491 - if (im[0] == 0x1f && im[1] == 0x8b) {
492 - /* claim 512kB for scratch space */
493 - avail_ram = claim(0, 512 << 10, 0x10) + RAM_START;
494 - end_avail = avail_ram + (512 << 10);
495 - printf("avail_ram = %x\n", avail_ram);
496 - printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len);
497 - gunzip(dst, 3 << 20, im, &len);
498 - printf("done %u bytes\n", len);
500 - memmove(dst, im, len);
503 - flush_cache(dst, len);
505 - sa = (unsigned long)PROG_START;
506 - printf("start address = 0x%x\n", sa);
511 - (*(void (*)())sa)(a1, a2, prom);
513 - printf("returned?\n");
518 -void *zalloc(void *x, unsigned items, unsigned size)
520 - void *p = avail_ram;
523 - size = (size + 7) & -8;
525 - if (avail_ram > end_avail) {
526 - printf("oops... out of memory\n");
532 -void zfree(void *x, void *addr, unsigned nb)
537 -#define EXTRA_FIELD 4
539 -#define COMMENT 0x10
540 -#define RESERVED 0xe0
544 -void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
552 - if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
553 - printf("bad gzipped data\n");
556 - if ((flags & EXTRA_FIELD) != 0)
557 - i = 12 + src[10] + (src[11] << 8);
558 - if ((flags & ORIG_NAME) != 0)
559 - while (src[i++] != 0)
561 - if ((flags & COMMENT) != 0)
562 - while (src[i++] != 0)
564 - if ((flags & HEAD_CRC) != 0)
567 - printf("gunzip: ran out of data in header\n");
573 - r = inflateInit2(&s, -MAX_WBITS);
575 - printf("inflateInit2 returned %d\n", r);
578 - s.next_in = src + i;
579 - s.avail_in = *lenp - i;
581 - s.avail_out = dstlen;
582 - r = inflate(&s, Z_FINISH);
583 - if (r != Z_OK && r != Z_STREAM_END) {
584 - printf("inflate returned %d msg: %s\n", r, s.msg);
587 - *lenp = s.next_out - (unsigned char *) dst;
590 diff -urN linux.orig/arch/ppc/coffboot/crt0.S linux/arch/ppc/coffboot/crt0.S
591 --- linux.orig/arch/ppc/coffboot/crt0.S Sun Mar 25 18:31:49 2001
592 +++ linux/arch/ppc/coffboot/crt0.S Thu Jul 11 15:43:29 2002
604 diff -urN linux.orig/arch/ppc/coffboot/dummy.c linux/arch/ppc/coffboot/dummy.c
605 --- linux.orig/arch/ppc/coffboot/dummy.c Sun Mar 25 18:31:49 2001
606 +++ linux/arch/ppc/coffboot/dummy.c Thu Jan 1 01:00:00 1970
612 diff -urN linux.orig/arch/ppc/coffboot/misc.S linux/arch/ppc/coffboot/misc.S
613 --- linux.orig/arch/ppc/coffboot/misc.S Sun Mar 25 18:31:49 2001
614 +++ linux/arch/ppc/coffboot/misc.S Thu Jul 11 15:43:29 2002
620 - rlwinm 5,5,16,16,31 /* r3 = 1 for 601, 4 for 604 */
625 + rlwinm 3,3,16,16,31 /* r3 = 1 for 601, 4 for 604 */
628 - mtibatl 3,0 /* invalidate BAT first */
629 - ori 3,3,4 /* set up BAT registers for 601 */
634 -4: mtdbatu 3,0 /* invalidate BATs first */
636 - ori 3,3,0xff /* set up BAT registers for 604 */
643 + ori 4,4,4 /* set up BAT registers for 601 */
649 +4: ori 4,4,0xfe /* set up BAT registers for 604 */
658 diff -urN linux.orig/arch/ppc/coffboot/mknote.c linux/arch/ppc/coffboot/mknote.c
659 --- linux.orig/arch/ppc/coffboot/mknote.c Sun Mar 25 18:31:49 2001
660 +++ linux/arch/ppc/coffboot/mknote.c Thu Jan 1 01:00:00 1970
663 - * Copyright (C) Cort Dougan 1999.
665 - * This program is free software; you can redistribute it and/or
666 - * modify it under the terms of the GNU General Public License
667 - * as published by the Free Software Foundation; either version
668 - * 2 of the License, or (at your option) any later version.
670 - * Generate a note section as per the CHRP specification.
676 -#define PL(x) printf("%c%c%c%c", ((x)>>24)&0xff, ((x)>>16)&0xff, ((x)>>8)&0xff, (x)&0xff );
682 - PL(strlen("PowerPC")+1);
688 - printf("PowerPC"); printf("%c", 0);
705 diff -urN linux.orig/arch/ppc/coffboot/no_initrd.c linux/arch/ppc/coffboot/no_initrd.c
706 --- linux.orig/arch/ppc/coffboot/no_initrd.c Sun Mar 25 18:31:49 2001
707 +++ linux/arch/ppc/coffboot/no_initrd.c Thu Jan 1 01:00:00 1970
709 -char initrd_data[1];
711 diff -urN linux.orig/arch/ppc/coffboot/piggyback.c linux/arch/ppc/coffboot/piggyback.c
712 --- linux.orig/arch/ppc/coffboot/piggyback.c Sun Mar 25 18:31:49 2001
713 +++ linux/arch/ppc/coffboot/piggyback.c Thu Jan 1 01:00:00 1970
717 -extern long ce_exec_config[];
719 -main(int argc, char *argv[])
721 - int i, cnt, pos, len;
722 - unsigned int cksum, val;
724 - unsigned char buf[8192];
727 - fprintf(stderr, "usage: %s name <in-file >out-file\n",
731 - fprintf(stdout, "#\n");
732 - fprintf(stdout, "# Miscellaneous data structures:\n");
733 - fprintf(stdout, "# WARNING - this file is automatically generated!\n");
734 - fprintf(stdout, "#\n");
735 - fprintf(stdout, "\n");
736 - fprintf(stdout, "\t.data\n");
737 - fprintf(stdout, "\t.globl %s_data\n", argv[1]);
738 - fprintf(stdout, "%s_data:\n", argv[1]);
741 - while ((len = read(0, buf, sizeof(buf))) > 0)
744 - lp = (unsigned char *)buf;
745 - len = (len + 3) & ~3; /* Round up to longwords */
746 - for (i = 0; i < len; i += 4)
750 - fprintf(stdout, "\t.long\t");
752 - fprintf(stdout, "0x%02X%02X%02X%02X", lp[0], lp[1], lp[2], lp[3]);
753 - val = *(unsigned long *)lp;
759 - fprintf(stdout, " # %x \n", pos+i-12);
763 - fprintf(stdout, ",");
768 - fprintf(stdout, "0\n");
772 - fprintf(stdout, "\t.globl %s_len\n", argv[1]);
773 - fprintf(stdout, "%s_len:\t.long\t0x%x\n", argv[1], pos);
776 - fprintf(stderr, "cksum = %x\n", cksum);
780 diff -urN linux.orig/arch/ppc/coffboot/start.c linux/arch/ppc/coffboot/start.c
781 --- linux.orig/arch/ppc/coffboot/start.c Sun Mar 25 18:31:49 2001
782 +++ linux/arch/ppc/coffboot/start.c Thu Jul 11 15:43:29 2002
784 if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
787 - boot(a1, a2, promptr);
788 + coffboot(a1, a2, promptr);
796 -int writestring(void *f, char *ptr, int nb)
801 - for (i = 0; i < nb; ++i) {
802 - if (ptr[i] == '\n') {
804 - write(f, ptr + w, i - w);
811 - write(f, ptr + w, nb - w);
816 read(void *handle, void *ptr, int nb)
823 -claim(unsigned int virt, unsigned int size, unsigned int align)
831 - unsigned int align;
835 - args.service = "claim";
840 - args.align = align;
846 getprop(void *phandle, const char *name, void *buf, int buflen)
852 - return writestring(f, &ch, 1) == 1? c: -1;
855 + return write(f, &ch, 1) == 1? c: -1;
863 - return writestring(f, str, n) == n? 0: -1;
864 + return write(f, str, n) == n? 0: -1;
872 - printk("read(stdin) returned -1\n");
873 + printk("read(stdin) returned -1\r\n");
879 n = vsprintf(sprint_buf, fmt, args);
881 - writestring(stdout, sprint_buf, n);
882 + write(stdout, sprint_buf, n);
888 n = vsprintf(sprint_buf, fmt, args);
890 - writestring(stdout, sprint_buf, n);
891 + write(stdout, sprint_buf, n);
894 diff -urN linux.orig/arch/ppc/common_defconfig linux/arch/ppc/common_defconfig
895 --- linux.orig/arch/ppc/common_defconfig Sun Mar 25 18:31:50 2001
896 +++ linux/arch/ppc/common_defconfig Fri Jul 12 18:54:54 2002
898 # CONFIG_GEMINI is not set
899 # CONFIG_MBX is not set
900 # CONFIG_SMP is not set
905 diff -urN linux.orig/arch/ppc/config.in linux/arch/ppc/config.in
906 --- linux.orig/arch/ppc/config.in Fri Nov 2 17:39:05 2001
907 +++ linux/arch/ppc/config.in Thu Jul 11 15:43:29 2002
910 bool 'Symmetric multi-processing support' CONFIG_SMP
912 -if [ "$CONFIG_6xx" = "y" ]; then
913 - bool 'Altivec (G4) support' CONFIG_ALTIVEC
916 if [ "$CONFIG_ALL_PPC" != "y" ]; then
917 define_bool CONFIG_MACH_SPECIFIC y
919 diff -urN linux.orig/arch/ppc/kernel/Makefile linux/arch/ppc/kernel/Makefile
920 --- linux.orig/arch/ppc/kernel/Makefile Sun Mar 25 18:31:48 2001
921 +++ linux/arch/ppc/kernel/Makefile Fri Jul 12 19:09:44 2002
924 # Note 2! The CFLAGS definitions are now in the main makefile...
926 -# Once a gas that groks -mvec is generally available, we'll use it...
928 -#ifdef CONFIG_ALTIVEC
929 -# $(CC) $(CFLAGS) -D__ASSEMBLY__ -Wa,-mvec -c $< -o $*.o
931 $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $*.o
935 OX_OBJS := ppc_ksyms.o setup.o
938 ifeq ($(CONFIG_MBX),y)
939 O_OBJS += mbx_setup.o mbx_pci.o softemu8xx.o i8259.o ppc8xx_pic.o
942 ifeq ($(CONFIG_APUS),y)
943 O_OBJS += apus_setup.o prom.o openpic.o
945 +ifneq ($(CONFIG_MBX),y)
946 +O_OBJS += prep_time.o pmac_time.o chrp_time.o \
947 + pmac_setup.o pmac_support.o \
948 + prep_pci.o pmac_pci.o chrp_pci.o \
949 + residual.o prom.o openpic.o feature.o \
950 + prep_nvram.o open_pic.o i8259.o pmac_pic.o indirect_pci.o \
951 + gemini_pci.o gemini_prom.o gemini_setup.o
952 +OX_OBJS += chrp_setup.o prep_setup.o
956 -PMAC_OBJS = pmac_time.o pmac_setup.o pmac_support.o pmac_pci.o pmac_pic.o \
957 - feature.o openpic.o open_pic.o prom.o
958 -CHRP_OBJS = $(PMAC_OBJS) chrp_time.o chrp_pci.o i8259.o indirect_pci.o
959 -CHRPX_OBJS = chrp_setup.o
960 -PREP_OBJS = prep_time.o prep_pci.o residual.o prep_nvram.o i8259.o \
961 - indirect_pci.o openpic.o open_pic.o prom.o
962 -PREPX_OBJS = prep_setup.o
964 -ifeq ($(CONFIG_ALL_PPC),y)
965 -O_OBJS += $(sort $(PMAC_OBJS) $(PREP_OBJS) $(CHRP_OBJS))
966 -OX_OBJS += $(PMACX_OBJS) $(PREPX_OBJS) $(CHRPX_OBJS)
968 -ifeq ($(CONFIG_PMAC),y)
969 -O_OBJS += $(PMAC_OBJS)
970 -OX_OBJS += $(PMACX_OBJS)
972 -ifeq ($(CONFIG_PREP),y)
973 -O_OBJS += $(PREP_OBJS)
974 -OX_OBJS += $(PREPX_OBJS)
976 -ifeq ($(CONFIG_CHRP),y)
977 -O_OBJS += $(CHRP_OBJS)
978 -OX_OBJS += $(CHRPX_OBJS)
981 -GEMINI_OBJS = $(PREP_OBJS) gemini_pci.o gemini_prom.o gemini_setup.o
982 -ifeq ($(CONFIG_GEMINI),y)
983 -O_OBJS += $(GEMINI_OBJS)
984 -OX_OBJS += $(PREPX_OBJS)
988 diff -urN linux.orig/arch/ppc/kernel/apus_setup.c linux/arch/ppc/kernel/apus_setup.c
989 --- linux.orig/arch/ppc/kernel/apus_setup.c Sun Mar 25 18:31:49 2001
990 +++ linux/arch/ppc/kernel/apus_setup.c Fri Jul 12 17:02:19 2002
992 #include <asm/machdep.h>
995 -#include <asm/time.h>
997 #include "local_irq.h"
999 unsigned long apus_get_rtc_time(void);
1000 diff -urN linux.orig/arch/ppc/kernel/chrp_pci.c linux/arch/ppc/kernel/chrp_pci.c
1001 --- linux.orig/arch/ppc/kernel/chrp_pci.c Sun Mar 25 18:31:48 2001
1002 +++ linux/arch/ppc/kernel/chrp_pci.c Thu Jul 11 15:43:29 2002
1005 #include <asm/pgtable.h>
1006 #include <asm/irq.h>
1007 +#include <asm/irq-compat.h>
1008 #include <asm/hydra.h>
1009 #include <asm/prom.h>
1010 #include <asm/gg2.h>
1012 #include <asm/machdep.h>
1015 -#include "open_pic.h"
1018 #define pci_config_addr(bus, dev, offset) \
1020 for( dev=pci_devices ; dev; dev=dev->next )
1023 - dev->irq = dev->irq + open_pic.irq_offset;
1024 + dev->irq = openpic_to_irq( dev->irq );
1025 /* these need to be absolute addrs for OF and Matrox FB -- Cort */
1026 if ( dev->vendor == PCI_VENDOR_ID_MATROX )
1028 diff -urN linux.orig/arch/ppc/kernel/chrp_setup.c linux/arch/ppc/kernel/chrp_setup.c
1029 --- linux.orig/arch/ppc/kernel/chrp_setup.c Sun Mar 25 18:31:49 2001
1030 +++ linux/arch/ppc/kernel/chrp_setup.c Thu Jul 11 16:22:09 2002
1032 #include <linux/pci.h>
1033 #include <linux/openpic.h>
1034 #include <linux/version.h>
1035 -#include <linux/delay.h>
1037 #include <asm/mmu.h>
1038 #include <asm/processor.h>
1040 #include <asm/dma.h>
1041 #include <asm/machdep.h>
1042 #include <asm/irq.h>
1043 +#include <asm/irq-compat.h>
1044 #include <asm/adb.h>
1045 #include <asm/hydra.h>
1046 #include <asm/keyboard.h>
1048 -#include <asm/time.h>
1050 #include "local_irq.h"
1052 #include "open_pic.h"
1054 int chrp_set_rtc_time(unsigned long nowtime);
1055 unsigned long rtas_event_scan_rate = 0, rtas_event_scan_ct = 0;
1056 void chrp_calibrate_decr(void);
1057 -long chrp_time_init(void);
1058 +void chrp_time_init(void);
1060 void chrp_setup_pci_ptrs(void);
1062 @@ -359,6 +359,81 @@
1067 +chrp_do_IRQ(struct pt_regs *regs,
1072 + unsigned long bits = 0;
1073 + int openpic_eoi_done = 0;
1077 + unsigned int loops = 1000000;
1078 + while (test_bit(0, &global_irq_lock)) {
1079 + if (smp_processor_id() == global_irq_holder) {
1080 + printk("uh oh, interrupt while we hold global irq lock!\n");
1086 + if (loops-- == 0) {
1087 + printk("do_IRQ waiting for irq lock (holder=%d)\n", global_irq_holder);
1094 +#endif /* __SMP__ */
1096 + irq = openpic_irq(smp_processor_id());
1097 + if (irq == IRQ_8259_CASCADE)
1100 + * This magic address generates a PCI IACK cycle.
1102 + * This should go in the above mask/ack code soon. -- Cort
1104 + if ( chrp_int_ack_special )
1105 + irq = *chrp_int_ack_special;
1107 + irq = i8259_irq(0);
1109 + * Acknowledge as soon as possible to allow i8259
1110 + * interrupt nesting */
1111 + openpic_eoi(smp_processor_id());
1112 + openpic_eoi_done = 1;
1114 + if (irq == OPENPIC_VEC_SPURIOUS)
1117 + * Spurious interrupts should never be
1120 + ppc_spurious_interrupts++;
1121 + openpic_eoi_done = 1;
1124 + bits = 1UL << irq;
1128 + printk(KERN_DEBUG "Bogus interrupt %d from PC = %lx\n",
1130 + ppc_spurious_interrupts++;
1134 + ppc_irq_dispatch_handler( regs, irq );
1137 + if (!openpic_eoi_done)
1138 + openpic_eoi(smp_processor_id());
1142 chrp_init_IRQ(void))
1145 (*(unsigned long *)get_property(np,
1146 "8259-interrupt-acknowledge", NULL));
1148 - open_pic.irq_offset = NUM_8259_INTERRUPTS;
1149 + open_pic.irq_offset = 16;
1150 for ( i = 16 ; i < NR_IRQS ; i++ )
1151 irq_desc[i].ctl = &open_pic;
1154 irq_desc[i].ctl = &i8259_pic;
1157 - request_irq(HYDRA_INT_ADB_NMI+open_pic.irq_offset,
1158 + request_irq(openpic_to_irq(HYDRA_INT_ADB_NMI),
1159 xmon_irq, 0, "NMI", 0);
1160 #endif /* CONFIG_XMON */
1163 ppc_md.get_cpuinfo = chrp_get_cpuinfo;
1164 ppc_md.irq_cannonicalize = chrp_irq_cannonicalize;
1165 ppc_md.init_IRQ = chrp_init_IRQ;
1166 - ppc_md.do_IRQ = open_pic_do_IRQ;
1167 + ppc_md.do_IRQ = chrp_do_IRQ;
1169 ppc_md.init = chrp_init2;
1173 call_rtas( "display-character", 1, 1, NULL, *s++ );
1176 -void chrp_indicator(int x)
1178 - call_rtas("set-indicator", 3, 1, NULL, 6, 0, x);
1180 diff -urN linux.orig/arch/ppc/kernel/chrp_time.c linux/arch/ppc/kernel/chrp_time.c
1181 --- linux.orig/arch/ppc/kernel/chrp_time.c Sun Mar 25 18:31:49 2001
1182 +++ linux/arch/ppc/kernel/chrp_time.c Thu Jul 11 15:43:29 2002
1184 #include <asm/processor.h>
1185 #include <asm/nvram.h>
1186 #include <asm/prom.h>
1187 -#include <asm/time.h>
1190 static int nvram_as1 = NVRAM_AS1;
1191 static int nvram_as0 = NVRAM_AS0;
1192 static int nvram_data = NVRAM_DATA;
1194 -__initfunc(long chrp_time_init(void))
1195 +__initfunc(void chrp_time_init(void))
1197 struct device_node *rtcs;
1200 rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
1201 if (rtcs == NULL || rtcs->addrs == NULL)
1204 base = rtcs->addrs[0].address;
1207 nvram_data = base + 1;
1211 int chrp_cmos_clock_read(int addr)
1212 diff -urN linux.orig/arch/ppc/kernel/gemini_setup.c linux/arch/ppc/kernel/gemini_setup.c
1213 --- linux.orig/arch/ppc/kernel/gemini_setup.c Sun Mar 25 18:31:49 2001
1214 +++ linux/arch/ppc/kernel/gemini_setup.c Thu Jul 11 15:45:25 2002
1216 #include <linux/blk.h>
1217 #include <linux/console.h>
1218 #include <linux/openpic.h>
1219 -#include <linux/delay.h>
1221 #include <asm/system.h>
1222 #include <asm/pgtable.h>
1225 #include <asm/m48t35.h>
1226 #include <asm/gemini.h>
1227 -#include <asm/processor.h>
1229 -#include <asm/time.h>
1231 #include "local_irq.h"
1232 #include "open_pic.h"
1235 ioremap( GEMINI_MPIC_ADDR, sizeof( struct OpenPIC ));
1239 +extern unsigned long loops_per_jiffy;
1240 extern int root_mountflags;
1241 extern char cmd_line[];
1243 @@ -258,6 +258,14 @@
1248 +#define L2CR_PIPE_LATEWR (0x01800000) /* late-write SRAM */
1249 +#define L2CR_L2CTL (0x00100000) /* RAM control */
1250 +#define L2CR_INST_DISABLE (0x00400000) /* disable for insn's */
1251 +#define L2CR_L2I (0x00200000) /* global invalidate */
1252 +#define L2CR_L2E (0x80000000) /* enable */
1253 +#define L2CR_L2WT (0x00080000) /* write-through */
1255 void __init gemini_init_l2(void)
1261 cache |= L2CR_PIPE_LATEWR|L2CR_L2CTL|L2CR_INST_DISABLE;
1262 - _set_L2CR(cache|L2CR_L2E);
1264 + _set_L2CR(cache|L2CR_L2I|L2CR_L2E);
1269 #define gemini_rtc_write(val,x) (writeb((val),(GEMINI_RTC+(x))))
1271 /* ensure that the RTC is up and running */
1272 -long __init gemini_time_init(void)
1273 +void __init gemini_time_init(void)
1278 gemini_rtc_write((reg & ~(M48T35_RTC_STOPPED)), M48T35_RTC_CONTROL);
1279 gemini_rtc_write((reg | M48T35_RTC_SET), M48T35_RTC_CONTROL);
1285 diff -urN linux.orig/arch/ppc/kernel/head.S linux/arch/ppc/kernel/head.S
1286 --- linux.orig/arch/ppc/kernel/head.S Fri Nov 2 17:39:05 2001
1287 +++ linux/arch/ppc/kernel/head.S Thu Jul 11 15:43:29 2002
1289 * Copyright (C) 1996 Paul Mackerras.
1290 * MPC8xx modifications Copyright (C) 1997 Dan Malek (dmalek@jlc.net).
1291 * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
1292 - * AltiVec additions by Kumar Gala (kumar.gala@motorola.com).
1294 * This file contains the low-level support and setup for the
1295 * PowerPC platform, including trap and interrupt dispatch.
1297 * modify it under the terms of the GNU General Public License
1298 * as published by the Free Software Foundation; either version
1299 * 2 of the License, or (at your option) any later version.
1302 - * Add sys_rt_sigreturn in DoSyscall Handler.
1303 - * Giovanna Ambrosini (ambrosini@lightning.ch).
1308 #define REST_16FPRS(n, base) REST_8FPRS(n, base); REST_8FPRS(n+8, base)
1309 #define REST_32FPRS(n, base) REST_16FPRS(n, base); REST_16FPRS(n+16, base)
1312 - * Once a version of gas that understands the AltiVec instructions
1313 - * is freely available, we can do this the normal way... - paulus
1315 -#define LVX(r,a,b) .long (31<<26)+((r)<<21)+((a)<<16)+((b)<<11)+(103<<1)
1316 -#define STVX(r,a,b) .long (31<<26)+((r)<<21)+((a)<<16)+((b)<<11)+(231<<1)
1317 -#define MFVSCR(r) .long (4<<26)+((r)<<11)+(770<<1)
1318 -#define MTVSCR(r) .long (4<<26)+((r)<<11)+(802<<1)
1320 -#define SAVE_VR(n,b,base) li b,TSS_VR0+(16*(n)); STVX(n,b,base)
1321 -#define SAVE_2VR(n,b,base) SAVE_VR(n,b,base); SAVE_VR(n+1,b,base)
1322 -#define SAVE_4VR(n,b,base) SAVE_2VR(n,b,base); SAVE_2VR(n+2,b,base)
1323 -#define SAVE_8VR(n,b,base) SAVE_4VR(n,b,base); SAVE_4VR(n+4,b,base)
1324 -#define SAVE_16VR(n,b,base) SAVE_8VR(n,b,base); SAVE_8VR(n+8,b,base)
1325 -#define SAVE_32VR(n,b,base) SAVE_16VR(n,b,base); SAVE_16VR(n+16,b,base)
1326 -#define REST_VR(n,b,base) li b,TSS_VR0+(16*(n)); LVX(n,b,base)
1327 -#define REST_2VR(n,b,base) REST_VR(n,b,base); REST_VR(n+1,b,base)
1328 -#define REST_4VR(n,b,base) REST_2VR(n,b,base); REST_2VR(n+2,b,base)
1329 -#define REST_8VR(n,b,base) REST_4VR(n,b,base); REST_4VR(n+4,b,base)
1330 -#define REST_16VR(n,b,base) REST_8VR(n,b,base); REST_8VR(n+8,b,base)
1331 -#define REST_32VR(n,b,base) REST_16VR(n,b,base); REST_16VR(n+16,b,base)
1336 @@ -262,15 +235,66 @@
1338 /* Switch MMU off, clear BATs and flush TLB */
1343 - bl setup_init_bats
1344 -#ifndef CONFIG_APUS
1345 -#ifdef CONFIG_BOOTX_TEXT
1349 +/* Use the first pair of BAT registers to map the 1st 16MB
1350 + * of RAM to KERNELBASE. From this point on we can't safely
1351 + * call OF any more.
1353 + lis r11,KERNELBASE@h
1355 + rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
1358 + ori r11,r11,4 /* set up BAT registers for 601 */
1359 + li r8,0x7f /* valid, block length = 8MB */
1360 + oris r9,r11,0x800000@h /* set up BAT reg for 2nd 8M */
1361 + oris r10,r8,0x800000@h /* set up BAT reg for 2nd 8M */
1362 + mtspr IBAT0U,r11 /* N.B. 601 has valid bit in */
1363 + mtspr IBAT0L,r8 /* lower BAT register */
1369 + ori r11,r11,BL_8M<<2|0x2 /* set up an 8MB mapping */
1370 + ori r11,r11,0xfe /* set up an 8MB mapping */
1371 + lis r8,CYBERBASEp@h
1373 + addis r8,r8,KERNELBASE@h
1376 + ori r11,r11,BL_256M<<2|0x2 /* set up BAT registers for 604 */
1377 + li r8,2 /* R/W access */
1379 + * If the MMU is off clear the bats. See clear_bat() -- Cort
1381 +#ifndef CONFIG_GEMINI
1383 + * allow secondary cpus to get at all of ram in early bootup
1384 + * since their init_task may be up there -- Cort
1386 + oris r18,r8,0x10000000@h
1387 + oris r21,r11,(KERNELBASE+0x10000000)@h
1388 + mtspr DBAT1L,r18 /* N.B. 6xx (not 601) have valid */
1389 + mtspr DBAT1U,r21 /* bit in upper BAT register */
1393 + oris r18,r8,0x20000000@h
1394 + oris r21,r11,(KERNELBASE+0x20000000)@h
1395 + mtspr DBAT2L,r18 /* N.B. 6xx (not 601) have valid */
1396 + mtspr DBAT2U,r21 /* bit in upper BAT register */
1399 +#endif /* ndef CONFIG_GEMINI */
1401 + mtspr DBAT0L,r8 /* N.B. 6xx (not 601) have valid */
1402 + mtspr DBAT0U,r11 /* bit in upper BAT register */
1407 /* Unfortunately the APUS specific instructions bloat the
1408 * code so it cannot fit in the 0x100 bytes available. We have
1409 @@ -396,15 +420,6 @@
1410 #endif /* CONFIG_8xx */
1413 -/* Hack for sleep on Core99 machines
1415 -#ifdef CONFIG_POWERMAC
1420 -#endif /* CONFIG_POWERMAC */
1423 * GCC sometimes accesses words at negative offsets from the stack
1424 * pointer, although the SysV ABI says it shouldn't. To cope with
1426 #endif /* CONFIG_GEMINI */
1428 STD_EXCEPTION(0x100, Reset, UnknownException)
1433 STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
1434 @@ -636,26 +651,7 @@
1435 STD_EXCEPTION(0xd00, SingleStep, SingleStepException)
1437 STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
1439 -#ifndef CONFIG_ALTIVEC
1440 STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
1443 - * The Altivec unavailable trap is at 0x0f20. Foo.
1444 - * We effectively remap it to 0x3000.
1449 - addi r3,r1,STACK_FRAME_OVERHEAD
1451 - bl transfer_to_handler
1452 - .long UnknownException
1456 - b AltiVecUnavailable
1457 -#endif /* CONFIG_ALTIVEC */
1461 @@ -1173,24 +1169,9 @@
1462 STD_EXCEPTION(0x2f00, Trap_2f, UnknownException)
1465 -#ifdef CONFIG_ALTIVEC
1466 -AltiVecUnavailable:
1468 - bne load_up_altivec /* if from user, just load it up */
1470 - bl transfer_to_handler /* if from kernel, take a trap */
1471 - .long KernelAltiVec
1474 -/* here are the bits of trap 0xf00 which got displaced */
1478 -#endif /* CONFIG_ALTIVEC */
1480 -#else /* CONFIG_8xx */
1483 -#endif /* CONFIG_8xx */
1487 * This code finishes saving the registers to the exception frame
1488 @@ -1345,7 +1326,11 @@
1489 /* Construct the high word of the PPC-style PTE */
1490 mfsrin r5,r3 /* get segment reg for segment */
1491 rlwinm r5,r5,7,1,24 /* put VSID in 0x7fffff80 bits */
1493 +#ifndef __SMP__ /* do this later for SMP */
1494 oris r5,r5,0x8000 /* set V (valid) bit */
1497 rlwimi r5,r3,10,26,31 /* put in API (abbrev page index) */
1498 /* Get the address of the primary PTE group in the hash table */
1499 .globl hash_page_patch_A
1500 @@ -1457,7 +1442,6 @@
1504 - clrlwi r5,r5,1 /* clear valid bit (0x80000000) */
1505 stw r5,0(r3) /* clear V (valid) bit in PTE */
1508 @@ -1509,7 +1493,6 @@
1516 @@ -1649,145 +1632,24 @@
1517 #endif /* __SMP__ */
1520 -#ifdef CONFIG_ALTIVEC
1521 -/* Note that the AltiVec support is closely modeled after the FP
1522 - * support. Changes to one are likely to be applicable to the
1526 - * Disable AltiVec for the task which had AltiVec previously,
1527 - * and save its AltiVec registers in its thread_struct.
1528 - * Enables AltiVec for use in the kernel on return.
1529 - * On SMP we know the AltiVec units are free, since we give it up every
1530 - * switch. -- Kumar
1533 - oris r5,r5,MSR_VEC@h
1535 - mtmsr r5 /* enable use of AltiVec now */
1538 - * For SMP, we don't do lazy AltiVec switching because it just gets too
1539 - * horrendously complex, especially when a task switches from one CPU
1540 - * to another. Instead we call giveup_altivec in switch_to.
1543 -#ifndef CONFIG_APUS
1544 - lis r6,-KERNELBASE@h
1546 - lis r6,CYBERBASEp@h
1549 - addis r3,r6,last_task_used_altivec@ha
1550 - lwz r4,last_task_used_altivec@l(r3)
1554 - addi r4,r4,TSS /* want TSS of last_task_used_altivec */
1555 - SAVE_32VR(0,r20,r4)
1559 - lwz r5,PT_REGS(r4)
1561 - lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5)
1563 - andc r4,r4,r20 /* disable altivec for previous task */
1564 - stw r4,_MSR-STACK_FRAME_OVERHEAD(r5)
1566 -#endif /* __SMP__ */
1567 - /* enable use of AltiVec after return */
1568 - oris r23,r23,MSR_VEC@h
1569 - mfspr r5,SPRG3 /* current task's TSS (phys) */
1573 - REST_32VR(0,r20,r5)
1577 - stw r4,last_task_used_altivec@l(r3)
1578 -#endif /* __SMP__ */
1579 - /* restore registers and return */
1585 - REST_4GPRS(3, r21)
1586 - /* we haven't used ctr or xer */
1590 - REST_2GPRS(22, r21)
1591 - lwz r21,GPR21(r21)
1596 - * AltiVec unavailable trap from kernel - print a message, but let
1597 - * the task use AltiVec in the kernel until it returns to user mode.
1601 - oris r3,r3,MSR_VEC@h
1602 - stw r3,_MSR(r1) /* enable use of AltiVec after return */
1605 - mr r4,r2 /* current */
1609 -87: .string "AltiVec used in kernel (task=%p, pc=%x) \n"
1613 - * giveup_altivec(tsk)
1614 - * Disable AltiVec for the task given as the argument,
1615 - * and save the AltiVec registers in its thread_struct.
1616 - * Enables AltiVec for use in the kernel on return.
1619 - .globl giveup_altivec
1622 - oris r5,r5,MSR_VEC@h
1624 - mtmsr r5 /* enable use of AltiVec now */
1627 - beqlr- /* if no previous owner, done */
1628 - addi r3,r3,TSS /* want TSS of task */
1629 - lwz r5,PT_REGS(r3)
1631 - SAVE_32VR(0, r4, r3)
1636 - lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5)
1638 - andc r4,r4,r3 /* disable AltiVec for previous task */
1639 - stw r4,_MSR-STACK_FRAME_OVERHEAD(r5)
1643 - lis r4,last_task_used_altivec@ha
1644 - stw r5,last_task_used_altivec@l(r4)
1645 -#endif /* __SMP__ */
1646 +#else /* CONFIG_8xx */
1650 -#endif /* CONFIG_ALTIVEC */
1651 +#endif /* CONFIG_8xx */
1654 - addi r4, r3, mmu_off_return - _start
1655 + addi r4, r3, __secondary_start - _start
1657 andi. r0,r3,MSR_DR|MSR_IR /* MMU enabled? */
1661 + ori r3,r3,MSR_DR|MSR_IR
1662 + xori r3,r3,MSR_DR|MSR_IR
1671 * This code is jumped to from the startup code to copy
1672 @@ -1798,6 +1660,10 @@
1673 addi r9,r9,0x6f58 /* translate source addr */
1674 cmpw r31,r9 /* (we have to on chrp) */
1676 +#if 0 // still needed ? breaks on me if I don't disable this
1677 + rlwinm r4,r4,0,8,31 /* translate source address */
1678 + add r4,r4,r3 /* to region mapped with BATs */
1680 7: addis r9,r26,klimit@ha /* fetch klimit */
1681 lwz r25,klimit@l(r9)
1682 addis r25,r25,-KERNELBASE@h
1683 @@ -1845,12 +1711,6 @@
1687 -#else /* CONFIG_8xx */
1691 -#endif /* CONFIG_8xx */
1695 ori r1,r0,MSR_DR|MSR_IR
1696 @@ -1913,7 +1773,7 @@
1698 rlwinm r9,r9,16,16,31
1700 - beq 6f /* not needed for 601 */
1701 + beq 4f /* not needed for 601 */
1703 andi. r0,r11,HID0_DCE
1704 ori r11,r11,HID0_ICE|HID0_DCE
1705 @@ -1930,24 +1790,14 @@
1706 cmpi 0,r9,4 /* check for 604 */
1707 cmpi 1,r9,9 /* or 604e */
1708 cmpi 2,r9,10 /* or mach5 */
1709 - cmpi 3,r9,8 /* check for 750 (G3) */
1710 - cmpi 4,r9,12 /* or 7400 (G4) */
1714 ori r11,r11,HID0_SIED|HID0_BHTE /* for 604[e], enable */
1716 ori r11,r11,HID0_BTCD
1721 - ori r11,r11,HID0_SGE|HID0_BHTE|HID0_BTIC|HID0_ABE /* for g3/g4, enable */
1722 - rlwinm r11,r11,0,23,21 /* clear HID0_SPD */
1725 5: mtspr HID0,r11 /* superscalar exec & br history tbl */
1728 #endif /* CONFIG_8xx */
1730 /* if we're the second cpu stack and r2 are different
1731 @@ -2028,10 +1878,10 @@
1732 li r3,MSR_KERNEL & ~(MSR_IR|MSR_DR)
1737 /* Load up the kernel context */
1739 + SYNC /* Force all PTE updates to finish */
1740 tlbia /* Clear all TLB entries */
1741 sync /* wait for tlbia/tlbie to finish */
1743 @@ -2088,7 +1938,6 @@
1744 #endif /* __SMP__ */
1748 rfi /* enable MMU and jump to start_kernel */
1751 @@ -2126,11 +1975,9 @@
1753 #endif /* SHOW_SYSCALLS */
1754 cmpi 0,r0,0x7777 /* Special case for 'sys_sigreturn' */
1755 - cmpi 1,r0,0x6666 /* Special case for 'sys_rt_sigreturn' */
1758 - lwz r10,TASK_PTRACE(r2)
1759 - andi. r10,r10,PT_TRACESYS
1760 + lwz r10,TASK_FLAGS(r2)
1761 + andi. r10,r10,PF_TRACESYS
1763 cmpli 0,r0,NR_syscalls
1765 @@ -2175,12 +2022,6 @@
1767 10: addi r3,r1,STACK_FRAME_OVERHEAD
1769 - cmpi 0,r3,0 /* Check for restarted system call */
1772 -/* sys_rt_sigreturn */
1773 -16: addi r3,r1,STACK_FRAME_OVERHEAD
1774 - bl sys_rt_sigreturn
1775 cmpi 0,r3,0 /* Check for restarted system call */
1778 @@ -2273,9 +2114,6 @@
1779 mflr r20 /* Return to switch caller */
1781 li r0,MSR_FP /* Disable floating-point */
1782 -#ifdef CONFIG_ALTIVEC
1783 - oris r0,r0,MSR_VEC@h
1784 -#endif /* CONFIG_ALTIVEC */
1788 @@ -2589,38 +2427,6 @@
1792 - * Copy a whole page. We use the dcbz instruction on the destination
1793 - * to reduce memory traffic (it eliminates the unnecessary reads of
1794 - * the destination into cache). This requires that the destination
1798 - li r0,4096/CACHE_LINE_SIZE
1824 * Flush entries from the hash table with VSIDs in the range
1827 @@ -2798,6 +2604,7 @@
1830 lwz r4,rtas_data@l(r4)
1831 + addis r4,r4,-KERNELBASE@h
1832 lis r6,1f@ha /* physical return address for rtas */
1834 addis r6,r6,-KERNELBASE@h
1835 @@ -2817,7 +2624,6 @@
1841 1: addis r9,r1,-KERNELBASE@h
1842 lwz r8,20(r9) /* get return address */
1843 @@ -2826,7 +2632,6 @@
1848 rfi /* return to caller */
1849 #endif /* CONFIG_8xx */
1851 @@ -2851,6 +2656,30 @@
1854 #endif /* CONFIG_8xx */
1857 + * We put a few things here that have to be page-aligned.
1858 + * This stuff goes at the beginning of the data segment,
1859 + * which is page-aligned.
1864 + .globl empty_zero_page
1868 + .globl swapper_pg_dir
1873 + * This space gets a copy of optional info passed to us by the bootstrap
1874 + * Used to pass parameters into the kernel like root=/dev/sda1, etc.
1881 * An undocumented "feature" of 604e requires that the v bit
1882 @@ -2895,117 +2724,4 @@
1887 -/* Use the first pair of BAT registers to map the 1st 16MB
1888 - * of RAM to KERNELBASE. From this point on we can't safely
1889 - * call OF any more.
1892 - lis r11,KERNELBASE@h
1894 - rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
1897 - ori r11,r11,4 /* set up BAT registers for 601 */
1898 - li r8,0x7f /* valid, block length = 8MB */
1899 - oris r9,r11,0x800000@h /* set up BAT reg for 2nd 8M */
1900 - oris r10,r8,0x800000@h /* set up BAT reg for 2nd 8M */
1901 - mtspr IBAT0U,r11 /* N.B. 601 has valid bit in */
1902 - mtspr IBAT0L,r8 /* lower BAT register */
1908 - ori r11,r11,BL_8M<<2|0x2 /* set up an 8MB mapping */
1909 - ori r11,r11,0xfe /* set up an 8MB mapping */
1910 - lis r8,CYBERBASEp@h
1912 - addis r8,r8,KERNELBASE@h
1915 - ori r11,r11,BL_256M<<2|0x2 /* set up BAT registers for 604 */
1916 - li r8,2 /* R/W access */
1918 - * If the MMU is off clear the bats. See clear_bat() -- Cort
1920 -#ifndef CONFIG_GEMINI
1922 - * allow secondary cpus to get at all of ram in early bootup
1923 - * since their init_task may be up there -- Cort
1925 - oris r18,r8,0x10000000@h
1926 - oris r21,r11,(KERNELBASE+0x10000000)@h
1927 - mtspr DBAT1L,r18 /* N.B. 6xx (not 601) have valid */
1928 - mtspr DBAT1U,r21 /* bit in upper BAT register */
1932 - oris r18,r8,0x20000000@h
1933 - oris r21,r11,(KERNELBASE+0x20000000)@h
1934 - mtspr DBAT2L,r18 /* N.B. 6xx (not 601) have valid */
1935 - mtspr DBAT2U,r21 /* bit in upper BAT register */
1938 -#endif /* ndef CONFIG_GEMINI */
1940 - mtspr DBAT0L,r8 /* N.B. 6xx (not 601) have valid */
1941 - mtspr DBAT0U,r11 /* bit in upper BAT register */
1947 -#ifdef CONFIG_BOOTX_TEXT
1950 - * setup the display bat prepared for us in prom.c
1955 - lis r8, disp_BATL@h
1956 - ori r8, r8, disp_BATL@l
1959 - lis r11, disp_BATU@h
1960 - ori r11, r11, disp_BATU@l
1966 - rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
1976 - * We put a few things here that have to be page-aligned.
1977 - * This stuff goes at the beginning of the data segment,
1978 - * which is page-aligned.
1983 - .globl empty_zero_page
1987 - .globl swapper_pg_dir
1992 - * This space gets a copy of optional info passed to us by the bootstrap
1993 - * Used to pass parameters into the kernel like root=/dev/sda1, etc.
2000 diff -urN linux.orig/arch/ppc/kernel/irq.c linux/arch/ppc/kernel/irq.c
2001 --- linux.orig/arch/ppc/kernel/irq.c Sun Mar 25 18:31:48 2001
2002 +++ linux/arch/ppc/kernel/irq.c Thu Jul 11 15:43:29 2002
2005 #include "local_irq.h"
2007 -extern atomic_t ipi_recv;
2008 -extern atomic_t ipi_sent;
2009 -void enable_irq(unsigned int irq_nr);
2010 +extern volatile unsigned long ipi_count;
2011 void enable_irq(unsigned int irq_nr);
2012 void disable_irq(unsigned int irq_nr);
2014 @@ -139,21 +137,20 @@
2018 - p = &irq_desc[irq].action;
2019 - while ((action = *p) != NULL && action->dev_id != dev_id)
2020 - p = &action->next;
2021 - if (action == NULL)
2024 - /* Found it - now free it */
2025 - save_flags(flags);
2027 - *p = action->next;
2028 - if (irq_desc[irq].action == NULL)
2030 - restore_flags(flags);
2031 - irq_kfree(action);
2033 + for (p = &irq_desc[irq].action; (action = *p) != NULL; p = &action->next)
2035 + if (action->dev_id == dev_id)
2037 + /* Found it - now free it */
2038 + save_flags(flags);
2040 + *p = action->next;
2041 + restore_flags(flags);
2042 + irq_kfree(action);
2049 action = (struct irqaction *)
2050 @@ -244,10 +241,8 @@
2053 /* should this be per processor send/receive? */
2054 - /* should this be per processor send/receive? */
2055 - len += sprintf(buf+len, "IPI: (recv/sent) %10lu/%lu\n",
2056 - atomic_read(&ipi_recv), atomic_read(&ipi_sent));
2057 -#endif /* __SMP__ */
2058 + len += sprintf(buf+len, "IPI: %10lu\n", ipi_count);
2060 len += sprintf(buf+len, "BAD: %10u\n", ppc_spurious_interrupts);
2063 @@ -322,14 +317,10 @@
2064 atomic_t global_bh_count;
2065 atomic_t global_bh_lock;
2067 -extern unsigned long *_get_SP(void);
2069 static void show(char * str)
2073 unsigned long *stack;
2075 int cpu = smp_processor_id();
2077 printk("\n%s, CPU %d:\n", str, cpu);
2078 @@ -341,10 +332,6 @@
2079 atomic_read(&global_bh_count),
2080 ppc_local_bh_count[0],
2081 ppc_local_bh_count[1]);
2083 - printk(" CPU: %d last CPU: %d\n", current->processor,current->last_processor);
2084 - print_backtrace (_get_SP());
2086 stack = (unsigned long *) &str;
2087 for (i = 40; i ; i--) {
2088 unsigned long x = *++stack;
2090 printk("<[%08lx]> ", x);
2096 static inline void wait_on_bh(void)
2097 diff -urN linux.orig/arch/ppc/kernel/local_irq.h linux/arch/ppc/kernel/local_irq.h
2098 --- linux.orig/arch/ppc/kernel/local_irq.h Sun Mar 25 18:31:49 2001
2099 +++ linux/arch/ppc/kernel/local_irq.h Thu Jul 11 15:43:29 2002
2102 struct irqaction *action;
2103 struct hw_interrupt_type *ctl;
2107 extern struct irqdesc irq_desc[NR_IRQS];
2108 diff -urN linux.orig/arch/ppc/kernel/mbx_pci.c linux/arch/ppc/kernel/mbx_pci.c
2109 --- linux.orig/arch/ppc/kernel/mbx_pci.c Sun Mar 25 18:31:49 2001
2110 +++ linux/arch/ppc/kernel/mbx_pci.c Thu Jul 11 15:43:29 2002
2114 #include <asm/mbx.h>
2115 -#include <asm/machdep.h>
2120 * This blows......The MBX uses the Tundra QSpan PCI bridge. When
2121 diff -urN linux.orig/arch/ppc/kernel/mbx_setup.c linux/arch/ppc/kernel/mbx_setup.c
2122 --- linux.orig/arch/ppc/kernel/mbx_setup.c Sun Mar 25 18:31:49 2001
2123 +++ linux/arch/ppc/kernel/mbx_setup.c Thu Jul 11 15:43:29 2002
2125 #include <linux/init.h>
2126 #include <linux/blk.h>
2127 #include <linux/ioport.h>
2128 -#include <linux/delay.h>
2130 #include <asm/mmu.h>
2131 #include <asm/processor.h>
2133 #include <asm/ide.h>
2134 #include <asm/mbx.h>
2135 #include <asm/machdep.h>
2136 -#include <asm/keyboard.h>
2137 -#include <asm/8xx_immap.h>
2138 -#include <asm/time.h>
2141 #include "local_irq.h"
2143 static int mbx_set_rtc_time(unsigned long time);
2144 unsigned long mbx_get_rtc_time(void);
2145 void mbx_calibrate_decr(void);
2147 -extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
2148 -extern int pckbd_getkeycode(unsigned int scancode);
2149 -extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
2151 -extern char pckbd_unexpected_up(unsigned char keycode);
2152 -extern void pckbd_leds(unsigned char leds);
2153 -extern void pckbd_init_hw(void);
2154 -extern unsigned char pckbd_sysrq_xlate[128];
2156 extern int mackbd_setkeycode(unsigned int scancode, unsigned int keycode);
2157 extern int mackbd_getkeycode(unsigned int scancode);
2158 extern int mackbd_translate(unsigned char scancode, unsigned char *keycode,
2160 extern void mackbd_leds(unsigned char leds);
2161 extern void mackbd_init_hw(void);
2163 +extern unsigned long loops_per_jiffy;
2165 unsigned long empty_zero_page[1024];
2167 #ifdef CONFIG_BLK_DEV_RAM
2169 ppc_md.kbd_leds = pckbd_leds;
2170 ppc_md.kbd_init_hw = pckbd_init_hw;
2171 #ifdef CONFIG_MAGIC_SYSRQ
2172 - ppc_md.sysrq_xlate = pckbd_sysrq_xlate;
2173 + ppc_md.kbd_sysrq_xlate = pckbd_sysrq_xlate;
2177 diff -urN linux.orig/arch/ppc/kernel/misc.S linux/arch/ppc/kernel/misc.S
2178 --- linux.orig/arch/ppc/kernel/misc.S Sun Mar 25 18:37:30 2001
2179 +++ linux/arch/ppc/kernel/misc.S Thu Jul 11 15:43:29 2002
2180 @@ -125,33 +125,12 @@
2184 -#if defined(CONFIG_SMP)
2187 - rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */
2190 - lis r9,hash_table_lock@h
2191 - ori r9,r9,hash_table_lock@l
2192 - lwz r8,PROCESSOR(r2)
2200 -#endif /* CONFIG_SMP */
2208 - stw r0,0(r9) /* clear hash_table_lock */
2214 @@ -159,32 +138,11 @@
2215 * Flush MMU TLB for a particular address
2218 -#if defined(CONFIG_SMP)
2221 - rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */
2224 - lis r9,hash_table_lock@h
2225 - ori r9,r9,hash_table_lock@l
2226 - lwz r8,PROCESSOR(r2)
2234 -#endif /* CONFIG_SMP */
2242 - stw r0,0(r9) /* clear hash_table_lock */
2248 @@ -317,8 +275,10 @@
2249 stwcx. r5,0,r3 /* Update with new value */
2250 bne- 10b /* Retry if "reservation" (i.e. lock) lost */
2254 + cmpi 0,r5,0 /* Return 'true' IFF 0 */
2259 _GLOBAL(atomic_clear_mask)
2261 @@ -354,10 +314,8 @@
2262 * The *_ns versions don't do byte-swapping.
2272 @@ -365,10 +323,8 @@
2283 @@ -376,10 +332,8 @@
2294 @@ -387,10 +341,8 @@
2305 @@ -398,10 +350,8 @@
2316 @@ -409,10 +359,8 @@
2327 @@ -421,10 +369,8 @@
2338 @@ -433,10 +379,8 @@
2349 @@ -444,10 +388,8 @@
2360 @@ -455,10 +397,8 @@
2371 @@ -466,59 +406,48 @@
2375 - * Extended precision shifts.
2377 - * Updated to be valid for shift counts from 0 to 63 inclusive.
2379 + * Extended precision shifts
2381 * R3/R4 has 64 bit value
2382 * R5 has shift count
2385 - * ashrdi3: arithmetic right shift (sign propagation)
2386 - * lshrdi3: logical right shift
2387 - * ashldi3: left shift
2388 + * ashrdi3: XXXYYY/ZZZAAA -> SSSXXX/YYYZZZ
2389 + * ashldi3: XXXYYY/ZZZAAA -> YYYZZZ/AAA000
2390 + * lshrdi3: XXXYYY/ZZZAAA -> 000XXX/YYYZZZ
2394 - srw r4,r4,r5 # LSW = count > 31 ? 0 : LSW >> count
2395 - addi r7,r5,32 # could be xori, or addi with -32
2396 - slw r6,r3,r6 # t1 = count > 31 ? 0 : MSW << (32-count)
2397 - rlwinm r8,r7,0,32 # t3 = (count < 32) ? 32 : 0
2398 - sraw r7,r3,r7 # t2 = MSW >> (count-32)
2399 - or r4,r4,r6 # LSW |= t1
2400 - slw r7,r7,r8 # t2 = (count < 32) ? 0 : t2
2401 - sraw r3,r3,r5 # MSW = MSW >> count
2402 - or r4,r4,r7 # LSW |= t2
2405 + slw r7,r3,r6 /* isolate YYY */
2406 + srw r4,r4,r5 /* isolate ZZZ */
2407 + or r4,r4,r7 /* YYYZZZ */
2408 + sraw r3,r3,r5 /* SSSXXX */
2413 - slw r3,r3,r5 # MSW = count > 31 ? 0 : MSW << count
2414 - addi r7,r5,32 # could be xori, or addi with -32
2415 - srw r6,r4,r6 # t1 = count > 31 ? 0 : LSW >> (32-count)
2416 - slw r7,r4,r7 # t2 = count < 32 ? 0 : LSW << (count-32)
2417 - or r3,r3,r6 # MSW |= t1
2418 - slw r4,r4,r5 # LSW = LSW << count
2419 - or r3,r3,r7 # MSW |= t2
2422 + srw r7,r4,r6 /* isolate ZZZ */
2423 + slw r4,r4,r5 /* AAA000 */
2424 + slw r3,r3,r5 /* YYY--- */
2425 + or r3,r3,r7 /* YYYZZZ */
2430 - srw r4,r4,r5 # LSW = count > 31 ? 0 : LSW >> count
2431 - addi r7,r5,32 # could be xori, or addi with -32
2432 - slw r6,r3,r6 # t1 = count > 31 ? 0 : MSW << (32-count)
2433 - srw r7,r3,r7 # t2 = count < 32 ? 0 : MSW >> (count-32)
2434 - or r4,r4,r6 # LSW |= t1
2435 - srw r3,r3,r5 # MSW = MSW >> count
2436 - or r4,r4,r7 # LSW |= t2
2439 + slw r7,r3,r6 /* isolate YYY */
2440 + srw r4,r4,r5 /* isolate ZZZ */
2441 + or r4,r4,r7 /* YYYZZZ */
2442 + srw r3,r3,r5 /* 000XXX */
2456 mr r3,r1 /* Close enough */
2457 @@ -563,14 +492,6 @@
2458 isync /* Handle erratas in some cases */
2471 Copyright © 1997-1998 by PowerLogix R & D, Inc.
2472 @@ -592,17 +513,6 @@
2474 Thur, Dec. 12, 1998.
2475 - First public release, contributed by PowerLogix.
2477 - Sat, Aug. 7, 1999.
2478 - - Terry: Made sure code disabled interrupts before running. (Previously
2479 - it was assumed interrupts were already disabled).
2480 - - Terry: Updated for tentative G4 support. 4MB of memory is now flushed
2481 - instead of 2MB. (Prob. only 3 is necessary).
2482 - - Terry: Updated for workaround to HID0[DPM] processor bug
2483 - during global invalidates.
2485 - Thu, July 13, 2000.
2486 - - Terry: Added isync to correct for an errata.
2488 Author: Terry Greeniaus (tgree@phys.ualberta.ca)
2489 Please e-mail updates to this file to me, thanks!
2490 @@ -641,94 +551,80 @@
2491 causes cache pushes from the L1 cache to go to the L2 cache
2492 instead of to main memory.
2495 - * Summary: this procedure ignores the L2I bit in the value passed in,
2496 - * flushes the cache if it was already enabled, always invalidates the
2497 - * cache, then enables the cache if the L2E bit is set in the value
2503 - /* Make sure this is a 750 or 7400 chip */
2504 + /* Make sure this is a 750 chip */
2506 rlwinm r4,r4,16,16,31
2508 - cmpwi cr1,r4,0x000c
2512 - /* Turn off interrupts and data relocation. */
2513 - mfmsr r7 /* Save MSR in r7 */
2514 - rlwinm r4,r7,0,17,15
2515 - rlwinm r4,r4,0,28,26 /* Turn off DR bit */
2522 + /* Get the current enable bit of the L2CR into r4 */
2526 + /* See if we want to perform a global inval this time. */
2527 + rlwinm r6,r3,0,10,10 /* r6 contains the new invalidate bit */
2528 + rlwinm. r5,r3,0,0,0 /* r5 contains the new enable bit */
2529 + rlwinm r3,r3,0,11,9 /* Turn off the invalidate bit */
2530 + rlwimi r3,r4,0,0,0 /* Keep the enable bit the same as it was. */
2531 + bne dontDisableCache /* Only disable the cache if L2CRApply
2532 + has the enable bit off */
2535 + /* Disable the cache. First, we turn off interrupts.
2536 + An interrupt while we are flushing the cache could bring
2537 + in data which may not get properly flushed. */
2538 + rlwinm r4,r7,0,17,15 /* Turn off EE bit */
2543 - /* Get the current enable bit of the L2CR into r4 */
2546 - /* Tweak some bits */
2547 - rlwinm r5,r3,0,0,0 /* r5 contains the new enable bit */
2548 - rlwinm r3,r3,0,11,9 /* Turn off the invalidate bit */
2549 - rlwinm r3,r3,0,1,31 /* Turn off the enable bit */
2551 - /* Check to see if we need to flush */
2552 - rlwinm. r4,r4,0,0,0
2555 - /* Flush the cache. First, read the first 4MB of memory (physical) to
2556 - * put new data in the cache. (Actually we only need
2557 - * the size of the L2 cache plus the size of the L1 cache, but 4MB will
2558 - * cover everything just to be safe).
2561 - /**** Might be a good idea to set L2DO here - to prevent instructions
2562 - from getting into the cache. But since we invalidate
2563 - the next time we enable the cache it doesn't really matter.
2568 + Now, read the first 2MB of memory to put new data in the cache.
2569 + (Actually we only need the size of the L2 cache plus the size
2570 + of the L1 cache, but 2MB will cover everything just to be safe).
2577 - addi r4,r4,32 /* Go to start of next cache line */
2578 + lis r4,KERNELBASE@h
2580 + addi r4,r4,0x0020 /* Go to start of next cache line */
2583 - /* Now, flush the first 4MB of memory */
2585 + /* Now, flush the first 2MB of memory */
2589 + lis r4,KERNELBASE@h
2593 - addi r4,r4,32 /* Go to start of next cache line */
2597 - /* Set up the L2CR configuration bits (and switch L2 off) */
2599 + addi r4,r4,0x0020 /* Go to start of next cache line */
2602 + /* Turn off the L2CR enable bit. */
2603 + rlwinm r3,r3,0,1,31
2606 + /* Set up the L2CR configuration bits */
2611 - /* Before we perform the global invalidation, we must disable dynamic
2612 - * power management via HID0[DPM] to work around a processor bug where
2613 - * DPM can possibly interfere with the state machine in the processor
2614 - * that invalidates the L2 cache tags.
2616 - mfspr r8,HID0 /* Save HID0 in r8 */
2617 - rlwinm r4,r8,0,12,10 /* Turn off HID0[DPM] */
2619 - mtspr HID0,r4 /* Disable DPM */
2620 + /* Reenable interrupts if necessary. */
2628 /* Perform a global invalidation */
2633 - isync /* For errata */
2635 /* Wait for the invalidation to complete */
2637 @@ -740,38 +636,25 @@
2641 - /* Restore HID0[DPM] to whatever it was before */
2647 /* See if we need to enable the cache */
2652 /* Enable the cache */
2657 - /* Restore MSR (restores EE and DR bits to original state) */
2667 /* Make sure this is a 750 chip */
2671 - cmpwi cr1,r3,0x000c
2672 + rlwinm r3,r3,16,16,31
2678 /* Return the L2CR contents */
2681 @@ -779,6 +662,16 @@
2682 /* --- End of PowerLogix code ---
2697 * These are used in the alignment trap handler when emulating
2698 @@ -1036,7 +929,11 @@
2699 .long sys_getresuid /* 165 */
2700 .long sys_query_module
2703 .long sys_nfsservctl
2705 + .long sys_ni_syscall
2708 .long sys_getresgid /* 170 */
2710 @@ -1058,18 +955,4 @@
2711 .long sys_ni_syscall /* streams1 */
2712 .long sys_ni_syscall /* streams2 */
2714 - .long sys_ni_syscall /* 190 */ /* MacOnLinux - old */
2715 - .long sys_ni_syscall /* 191 */ /* Unused */
2716 - .long sys_ni_syscall /* 192 - reserved - mmap2 */
2717 - .long sys_ni_syscall /* 193 - reserved - truncate64 */
2718 - .long sys_ni_syscall /* 194 - reserved - ftruncate64 */
2719 - .long sys_ni_syscall /* 195 - reserved - stat64 */
2720 - .long sys_ni_syscall /* 196 - reserved - lstat64 */
2721 - .long sys_ni_syscall /* 197 - reserved - fstat64 */
2722 - .long sys_pciconfig_read /* 198 */
2723 - .long sys_pciconfig_write /* 199 */
2724 - .long sys_pciconfig_iobase /* 200 */
2725 - .long sys_ni_syscall /* 201 - reserved - MacOnLinux - new */
2726 - .rept NR_syscalls-201
2727 - .long sys_ni_syscall
2729 + .space (NR_syscalls-183)*4
2730 diff -urN linux.orig/arch/ppc/kernel/mk_defs.c linux/arch/ppc/kernel/mk_defs.c
2731 --- linux.orig/arch/ppc/kernel/mk_defs.c Fri Nov 2 17:39:05 2001
2732 +++ linux/arch/ppc/kernel/mk_defs.c Thu Jul 11 15:43:29 2002
2734 * #defines from the assembly-language output.
2737 -#include <linux/config.h>
2738 +#include <stddef.h>
2739 #include <linux/signal.h>
2740 #include <linux/sched.h>
2741 #include <linux/kernel.h>
2743 #include <asm/page.h>
2744 #include <asm/pgtable.h>
2745 #include <asm/processor.h>
2746 +#include <asm/pf-compat.h>
2748 #define DEFINE(sym, val) \
2749 asm volatile("\n#define\t" #sym "\t%0" : : "i" (val))
2751 DEFINE(PGD, offsetof(struct mm_struct, pgd));
2752 DEFINE(LAST_SYSCALL, offsetof(struct thread_struct, last_syscall));
2753 DEFINE(PT_REGS, offsetof(struct thread_struct, regs));
2754 - DEFINE(PT_TRACESYS, PT_TRACESYS);
2755 + DEFINE(PF_TRACESYS, PF_TRACESYS);
2756 DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
2757 - DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));
2758 DEFINE(NEED_RESCHED, offsetof(struct task_struct, need_resched));
2759 DEFINE(TSS_FPR0, offsetof(struct thread_struct, fpr[0]));
2760 DEFINE(TSS_FPSCR, offsetof(struct thread_struct, fpscr));
2761 -#ifdef CONFIG_ALTIVEC
2762 - DEFINE(TSS_VR0, offsetof(struct thread_struct, vr[0]));
2763 - DEFINE(TSS_VRSAVE, offsetof(struct thread_struct, vrsave));
2764 - DEFINE(TSS_VSCR, offsetof(struct thread_struct, vscr));
2765 -#endif /* CONFIG_ALTIVEC */
2767 /* Interrupt register frame */
2768 DEFINE(TASK_UNION_SIZE, sizeof(union task_union));
2769 DEFINE(STACK_FRAME_OVERHEAD, STACK_FRAME_OVERHEAD);
2770 diff -urN linux.orig/arch/ppc/kernel/open_pic.c linux/arch/ppc/kernel/open_pic.c
2771 --- linux.orig/arch/ppc/kernel/open_pic.c Sun Mar 25 18:31:49 2001
2772 +++ linux/arch/ppc/kernel/open_pic.c Thu Jul 11 15:43:29 2002
2777 - * Common support routines for platforms with an OpenPIC interrupt controller
2781 #include <linux/stddef.h>
2782 #include <linux/init.h>
2783 #include <linux/sched.h>
2784 #include <linux/signal.h>
2785 #include <linux/openpic.h>
2786 #include <asm/irq.h>
2787 -#include <asm/processor.h>
2788 #include "open_pic.h"
2791 -extern volatile unsigned char *chrp_int_ack_special;
2793 -void open_pic_do_IRQ(struct pt_regs *regs, int cpu, int isfake)
2796 - int openpic_eoi_done = 0;
2800 - unsigned int loops = 1000000;
2801 - while (test_bit(0, &global_irq_lock)) {
2802 - if (smp_processor_id() == global_irq_holder) {
2803 - printk("uh oh, interrupt while we hold global irq lock!\n");
2809 - if (loops-- == 0) {
2810 - printk("do_IRQ waiting for irq lock (holder=%d)\n", global_irq_holder);
2817 +void openpic_ipi_action(int cpl, void *dev_id, struct pt_regs *regs)
2819 + smp_message_recv(cpl-OPENPIC_VEC_IPI);
2821 #endif /* __SMP__ */
2823 - irq = openpic_irq(smp_processor_id());
2824 - /* make sure open_pic.irq_offset is set to something!
2825 - * do we really need the _MACH_Pmac test??
2827 - if (!(_machine == _MACH_Pmac) && (irq == open_pic.irq_offset))
2830 - * This magic address generates a PCI IACK cycle.
2832 - * This should go in the above mask/ack code soon. -- Cort
2834 - if ( chrp_int_ack_special )
2835 - irq = *chrp_int_ack_special;
2836 -#ifndef CONFIG_PMAC
2838 - irq = i8259_irq(0);
2841 - * Acknowledge as soon as possible to allow i8259
2842 - * interrupt nesting */
2843 - openpic_eoi(smp_processor_id());
2844 - openpic_eoi_done = 1;
2846 - if (irq == OPENPIC_VEC_SPURIOUS)
2849 - * Spurious interrupts should never be
2852 - ppc_spurious_interrupts++;
2853 - openpic_eoi_done = 1;
2859 - printk(KERN_DEBUG "Bogus interrupt %d from PC = %lx\n",
2861 - ppc_spurious_interrupts++;
2865 - ppc_irq_dispatch_handler( regs, irq );
2868 - if (!openpic_eoi_done)
2869 - openpic_eoi(smp_processor_id());
2870 +void chrp_mask_and_ack_irq(unsigned int irq_nr)
2872 + if ((_machine != _MACH_gemini) && is_8259_irq(irq_nr))
2873 + i8259_pic.mask_and_ack(irq_nr);
2877 -void openpic_ipi_action(int cpl, void *dev_id, struct pt_regs *regs)
2878 +static void chrp_mask_irq(unsigned int irq_nr)
2880 - smp_message_recv(cpl-OPENPIC_VEC_IPI);
2881 + if ((_machine != _MACH_gemini) && is_8259_irq(irq_nr))
2882 + i8259_pic.disable(irq_nr);
2884 + openpic_disable_irq(irq_nr-open_pic.irq_offset);
2886 -#endif /* __SMP__ */
2888 +static void chrp_unmask_irq(unsigned int irq_nr)
2890 + if ((_machine != _MACH_gemini) && is_8259_irq(irq_nr))
2891 + i8259_pic.enable(irq_nr);
2893 + openpic_enable_irq(irq_nr-open_pic.irq_offset);
2896 struct hw_interrupt_type open_pic = {
2901 - openpic_enable_irq,
2902 - openpic_disable_irq,
2903 - /* Theorically, the mask&ack should be NULL for OpenPIC. However, doing
2904 - * so shows tons of bogus interrupts coming in.
2905 - * This problem is apparently due to the common code always calling
2906 - * unmask(). I apparently (need more test) fixed it in the 2.4 new IRQ
2907 - * management by cleanly implementing the handler's end() function, so
2908 - * neither mask nor unmask are needed. In the meantime, the fix below will
2909 - * work for 2.2 -Benh
2911 - * Hopefully this will fix my bogus interrups on MTX
2912 - * I merged everthing together so we don't have the same code in three
2913 - * places. This might cause stability problems, but I'd rather
2914 - * get it right once than three different times because someone forgot
2915 - * to make the same change to PReP or something --Troy
2917 - openpic_disable_irq,
2920 + chrp_mask_and_ack_irq,
2923 diff -urN linux.orig/arch/ppc/kernel/open_pic.h linux/arch/ppc/kernel/open_pic.h
2924 --- linux.orig/arch/ppc/kernel/open_pic.h Sun Mar 25 18:31:49 2001
2925 +++ linux/arch/ppc/kernel/open_pic.h Thu Jul 11 15:43:29 2002
2928 extern struct hw_interrupt_type open_pic;
2930 -void open_pic_do_IRQ(struct pt_regs *regs, int cpu, int isfake);
2931 void openpic_ipi_action(int cpl, void *dev_id, struct pt_regs *regs);
2932 void openpic_enable_IPI(u_int ipi);
2933 void do_openpic_setup_cpu(void);
2934 diff -urN linux.orig/arch/ppc/kernel/openpic.c linux/arch/ppc/kernel/openpic.c
2935 --- linux.orig/arch/ppc/kernel/openpic.c Fri Nov 2 17:39:05 2001
2936 +++ linux/arch/ppc/kernel/openpic.c Thu Jul 11 15:43:29 2002
2939 * Fixed up IPI and restructured a bit
2940 * Cort Dougan <cort@ppc.kernel.org>
2942 - * Added initialisation code for Apple Core99 machines, tweaked a few things
2943 - * to avoid bogus interrupts and to make sure the disable function exits with
2944 - * the interrupt actually masked. --BenH
2945 - * Todo: map interrupts to all available CPUs after the ack round
2947 * This file is subject to the terms and conditions of the GNU General Public
2948 * License. See the file COPYING in the main directory of this archive
2951 #include <asm/irq.h>
2952 #include "open_pic.h"
2954 -#include <asm/prom.h>
2957 #define REGISTER_DEBUG
2958 #undef REGISTER_DEBUG
2961 -extern int use_of_interrupt_tree;
2963 +#define OPENPIC_SENSE_POLARITY 0x00800000 /* Undoc'd */
2965 volatile struct OpenPIC *OpenPIC = NULL;
2966 u_int OpenPIC_NumInitSenses __initdata = 0;
2971 -static inline u_int in_le32(volatile u_int *addr)
2972 +static inline u_int ld_le32(volatile u_int *addr)
2980 - val = in_le32(addr);
2981 + val = ld_le32(addr);
2982 #ifdef REGISTER_DEBUG
2983 printk("openpic_read(0x%08x) = 0x%08x\n", (u_int)addr, val);
2987 openpic_setfield(addr, OPENPIC_MASK);
2988 /* wait until it's not in use */
2989 - /* BenH: Is this code really enough ? I would rather check the result
2990 - * and eventually retry ...
2992 while (openpic_read(addr) & OPENPIC_ACTIVITY);
2993 openpic_writefield(addr, mask | OPENPIC_MASK, field | OPENPIC_MASK);
2995 @@ -164,20 +151,7 @@
2997 * Initialize the OpenPIC
3002 - * With BootX, we consider the controller as beeing already initialized by MacOS
3003 - * and we only mask out interrupts.
3004 - * With OF booting, we initialize the interrupts that we find in the device tree,
3005 - * other ones are just masked out.
3006 - * Note: We might want to adjust priorities too.
3009 -/* Not an init func, called on pbook wakeup --BenH */
3012 -openpic_init(int main_pic)
3013 +__initfunc(void openpic_init(int main_pic))
3017 @@ -207,16 +181,13 @@
3018 OPENPIC_FEATURE_LAST_SOURCE_SHIFT) + 1;
3019 printk("OpenPIC Version %s (%d CPUs and %d IRQ sources) at %p\n", version,
3020 NumProcessors, NumSources, OpenPIC);
3021 - /* Apple's OpenPIC is an IBM MPIC without the timer. */
3022 - if (_machine != _MACH_Pmac) {
3023 - timerfreq = openpic_read(&OpenPIC->Global.Timer_Frequency);
3024 - printk("OpenPIC timer frequency is ");
3026 - printk("%d Hz\n", timerfreq);
3028 - printk("not set\n");
3031 + timerfreq = openpic_read(&OpenPIC->Global.Timer_Frequency);
3032 + printk("OpenPIC timer frequency is ");
3034 + printk("%d Hz\n", timerfreq);
3036 + printk("not set\n");
3040 /* Initialize timer interrupts */
3041 @@ -229,60 +200,24 @@
3043 /* Initialize IPI interrupts */
3044 for (i = 0; i < OPENPIC_NUM_IPI; i++) {
3045 - openpic_initipi(i, 10+i, OPENPIC_VEC_IPI+i);
3046 + openpic_initipi(i, 10, OPENPIC_VEC_IPI+i);
3049 - if (_machine != _MACH_Pmac) {
3050 - /* Initialize external interrupts */
3051 - for (i = 0; i < NumSources; i++) {
3052 - /* Enabled, Priority 8 */
3053 - openpic_initirq(i, 8, open_pic.irq_offset+i, 0,
3054 - i < OpenPIC_NumInitSenses ? OpenPIC_InitSenses[i] : 1);
3056 - openpic_mapirq(i, 1<<0);
3059 - /* Prevent any interrupt from occurring during initialisation.
3060 - * Hum... I believe this is not necessary, Apple does that in
3061 - * Darwin's PowerExpress code.
3063 - openpic_set_priority(0, 0xf);
3065 - /* First disable all interrupts and map them to CPU 0 */
3066 - for (i = 0; i < NumSources; i++) {
3067 - openpic_disable_irq(i);
3068 - openpic_mapirq(i, 1<<0);
3071 - /* If we use the device tree, then lookup all interrupts and
3072 - * initialize them according to sense infos found in the tree
3074 - if (use_of_interrupt_tree) {
3075 - struct device_node* np = find_all_nodes();
3078 - pri = strcmp(np->name, "programmer-switch") ? 2 : 7;
3079 - for (j=0;j<np->n_intrs;j++) {
3080 - openpic_initirq( np->intrs[j].line,
3082 - np->intrs[j].line,
3084 - np->intrs[j].sense);
3085 - irq_desc[np->intrs[j].line].level = np->intrs[j].sense;
3090 - /* Fixme: read level value from controller */
3091 - printk("openpic: WARNING, openpic running without interrupt tree\n");
3093 + /* Initialize external interrupts */
3094 + for (i = 0; i < NumSources; i++) {
3095 + /* Enabled, Priority 8 */
3096 + openpic_initirq(i, 8, open_pic.irq_offset+i, 0,
3097 + i < OpenPIC_NumInitSenses ? OpenPIC_InitSenses[i] : 1);
3099 + openpic_mapirq(i, 1<<0);
3103 /* Initialize the spurious interrupt */
3104 openpic_set_spurious(OPENPIC_VEC_SPURIOUS);
3106 /* Gemini has no i8259 */
3107 - if (( _machine != _MACH_gemini ) && (_machine != _MACH_Pmac)) {
3108 + if ( _machine != _MACH_gemini )
3110 /* SIOint (8259 cascade) is special */
3111 openpic_initirq(0, 8, open_pic.irq_offset, 1, 1);
3112 openpic_mapirq(0, 1<<0);
3113 @@ -292,14 +227,6 @@
3115 openpic_set_priority(0, 0);
3116 openpic_disable_8259_pass_through();
3118 - /* We ack pending interrupts to avoid blocking them */
3119 - if (_machine == _MACH_Pmac) {
3120 - for (i = 0; i < NumSources; i++) {
3121 - (void)openpic_irq(0);
3128 @@ -311,10 +238,6 @@
3130 openpic_setfield(&OpenPIC->Global.Global_Configuration0,
3131 OPENPIC_CONFIG_RESET);
3132 - /* Wait for reset to complete */
3133 - while(openpic_readfield(&OpenPIC->Global.Global_Configuration0,
3134 - OPENPIC_CONFIG_RESET))
3142 openpic_write(&OpenPIC->THIS_CPU.EOI, 0);
3143 - (void)openpic_read(&OpenPIC->THIS_CPU.EOI);
3147 @@ -465,12 +387,12 @@
3149 for ( i = 0; i < OPENPIC_NUM_IPI ; i++ )
3150 openpic_enable_IPI(i);
3153 /* let the openpic know we want intrs */
3154 for ( i = 0; i < NumSources ; i++ )
3155 openpic_mapirq(i, openpic_read(&OpenPIC->Source[i].Destination)
3156 | (1<<smp_processor_id()) );
3159 openpic_set_priority(smp_processor_id(), 0);
3162 @@ -506,43 +428,14 @@
3164 void openpic_enable_irq(u_int irq)
3166 - /* on SMP, we get IPI vector numbers here, we should handle them
3167 - * or at least ignore them.
3169 - if (irq < 0 || irq >= NumSources)
3171 + check_arg_irq(irq);
3172 openpic_clearfield(&OpenPIC->Source[irq].Vector_Priority, OPENPIC_MASK);
3173 - /* make sure mask gets to controller before we return to user */
3176 - } while(openpic_readfield(&OpenPIC->Source[irq].Vector_Priority,
3180 -u_int openpic_get_enable(u_int irq)
3182 - if (irq < 0 || irq >= NumSources)
3184 - return !openpic_readfield(&OpenPIC->Source[irq].Vector_Priority,
3188 void openpic_disable_irq(u_int irq)
3192 - /* on SMP, we get IPI vector numbers here, we should handle them
3193 - * or at least ignore them.
3195 - if (irq < 0 || irq >= NumSources)
3197 + check_arg_irq(irq);
3198 openpic_setfield(&OpenPIC->Source[irq].Vector_Priority, OPENPIC_MASK);
3199 - /* make sure mask gets to controller before we return to user */
3201 - mb(); /* sync is probably useless here */
3202 - vp = openpic_readfield(&OpenPIC->Source[irq].Vector_Priority,
3203 - OPENPIC_MASK | OPENPIC_ACTIVITY);
3204 - } while((vp & OPENPIC_ACTIVITY) && !(vp & OPENPIC_MASK));
3208 @@ -561,11 +454,10 @@
3210 openpic_safe_writefield(&OpenPIC->Source[irq].Vector_Priority,
3211 OPENPIC_PRIORITY_MASK | OPENPIC_VECTOR_MASK |
3212 - OPENPIC_POLARITY_MASK | OPENPIC_SENSE_MASK,
3213 + OPENPIC_SENSE_POLARITY | OPENPIC_SENSE_LEVEL,
3214 (pri << OPENPIC_PRIORITY_SHIFT) | vec |
3215 - (pol ? OPENPIC_POLARITY_POSITIVE :
3216 - OPENPIC_POLARITY_NEGATIVE) |
3217 - (sense ? OPENPIC_SENSE_LEVEL : OPENPIC_SENSE_EDGE));
3218 + (pol ? OPENPIC_SENSE_POLARITY : 0) |
3219 + (sense ? OPENPIC_SENSE_LEVEL : 0));
3224 OPENPIC_SENSE_LEVEL,
3225 (sense ? OPENPIC_SENSE_LEVEL : 0));
3228 #ifdef CONFIG_PMAC_PBOOK
3229 static u32 save_ipi_vp[OPENPIC_NUM_IPI];
3230 static u32 save_irq_src_vp[OPENPIC_MAX_SOURCES];
3231 diff -urN linux.orig/arch/ppc/kernel/pci.c linux/arch/ppc/kernel/pci.c
3232 --- linux.orig/arch/ppc/kernel/pci.c Sun Mar 25 18:31:48 2001
3233 +++ linux/arch/ppc/kernel/pci.c Thu Jul 11 15:43:29 2002
3235 #include <linux/init.h>
3236 #include <linux/config.h>
3237 #include <linux/openpic.h>
3238 -#include <linux/capability.h>
3239 -#include <linux/sched.h>
3240 -#include <linux/errno.h>
3242 #include <asm/processor.h>
3244 #include <asm/prom.h>
3245 #include <asm/pci-bridge.h>
3246 -#include <asm/pci.h>
3247 #include <asm/residual.h>
3248 #include <asm/byteorder.h>
3249 #include <asm/irq.h>
3250 #include <asm/gg2.h>
3251 -#include <asm/uaccess.h>
3257 for (; node != 0;node = node->sibling) {
3258 class_code = (unsigned int *) get_property(node, "class-code", 0);
3259 - if(class_code && (*class_code >> 8) == PCI_CLASS_BRIDGE_PCI)
3260 + if((*class_code >> 8) == PCI_CLASS_BRIDGE_PCI)
3261 fix_intr(node->child, dev);
3262 reg = (unsigned int *) get_property(node, "reg", 0);
3263 if (reg == 0 || ((reg[0] >> 8) & 0xff) != dev->devfn)
3264 @@ -110,156 +105,3 @@
3271 -pci_dev_io_base(unsigned char bus, unsigned char devfn, int physical)
3273 - if (!ppc_md.pci_dev_io_base) {
3274 - /* Please, someone fix this for non-pmac machines, we
3275 - * need either the virtual or physical PCI IO base
3279 - return ppc_md.pci_dev_io_base(bus, devfn, physical);
3283 -pci_dev_mem_base(unsigned char bus, unsigned char devfn)
3285 - /* Default memory base is 0 (1:1 mapping) */
3286 - if (!ppc_md.pci_dev_mem_base) {
3287 - /* Please, someone fix this for non-pmac machines.*/
3290 - return ppc_md.pci_dev_mem_base(bus, devfn);
3293 -/* Returns the root-bridge number (Uni-N number) of a device */
3295 -pci_dev_root_bridge(unsigned char bus, unsigned char devfn)
3297 - /* Defaults to 0 */
3298 - if (!ppc_md.pci_dev_root_bridge)
3300 - return ppc_md.pci_dev_root_bridge(bus, devfn);
3304 - * Those syscalls are derived from the Alpha versions, they
3305 - * allow userland apps to retreive the per-device iobase and
3306 - * mem-base. They also provide wrapper for userland to do
3307 - * config space accesses.
3308 - * The "host_number" returns the number of the Uni-N sub bridge
3312 -sys_pciconfig_read(unsigned long bus, unsigned long dfn,
3313 - unsigned long off, unsigned long len,
3314 - unsigned char *buf)
3316 - unsigned char ubyte;
3317 - unsigned short ushort;
3318 - unsigned int uint;
3321 - if (!capable(CAP_SYS_ADMIN))
3323 - if (!pcibios_present())
3328 - err = pcibios_read_config_byte(bus, dfn, off, &ubyte);
3329 - put_user(ubyte, buf);
3332 - err = pcibios_read_config_word(bus, dfn, off, &ushort);
3333 - put_user(ushort, (unsigned short *)buf);
3336 - err = pcibios_read_config_dword(bus, dfn, off, &uint);
3337 - put_user(uint, (unsigned int *)buf);
3347 -sys_pciconfig_write(unsigned long bus, unsigned long dfn,
3348 - unsigned long off, unsigned long len,
3349 - unsigned char *buf)
3351 - unsigned char ubyte;
3352 - unsigned short ushort;
3353 - unsigned int uint;
3356 - if (!capable(CAP_SYS_ADMIN))
3358 - if (!pcibios_present())
3363 - err = get_user(ubyte, buf);
3366 - err = pcibios_write_config_byte(bus, dfn, off, ubyte);
3367 - if (err != PCIBIOS_SUCCESSFUL) {
3372 - err = get_user(ushort, (unsigned short *)buf);
3375 - err = pcibios_write_config_word(bus, dfn, off, ushort);
3376 - if (err != PCIBIOS_SUCCESSFUL) {
3381 - err = get_user(uint, (unsigned int *)buf);
3384 - err = pcibios_write_config_dword(bus, dfn, off, uint);
3385 - if (err != PCIBIOS_SUCCESSFUL) {
3396 -/* Provide information on locations of various I/O regions in physical
3397 - * memory. Do this on a per-card basis so that we choose the right
3399 - * Note that the returned IO or memory base is a physical address
3403 -sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
3405 - long result = -EOPNOTSUPP;
3408 - case IOBASE_BRIDGE_NUMBER:
3409 - return (long)pci_dev_root_bridge(bus, devfn);
3410 - case IOBASE_MEMORY:
3411 - return (long)pci_dev_mem_base(bus, devfn);
3413 - result = (long)pci_dev_io_base(bus, devfn, 1);
3415 - result = -EOPNOTSUPP;
3421 diff -urN linux.orig/arch/ppc/kernel/pmac_pci.c linux/arch/ppc/kernel/pmac_pci.c
3422 --- linux.orig/arch/ppc/kernel/pmac_pci.c Fri Nov 2 17:39:05 2001
3423 +++ linux/arch/ppc/kernel/pmac_pci.c Thu Jul 11 15:43:29 2002
3425 struct bridge_data **bridges, *bridge_list;
3428 -struct uninorth_data {
3429 - struct device_node* node;
3430 - volatile unsigned int* cfg_addr;
3431 - volatile unsigned int* cfg_data;
3433 - void* iobase_phys;
3436 -static struct uninorth_data uninorth_bridges[3];
3437 -static int uninorth_count;
3438 -static int uninorth_default = -1;
3442 static void add_bridges(struct device_node *dev, unsigned long *mem_ptr);
3449 -/* This routines figures out on which root bridge a given PCI device
3452 - * WARNING: When passed the address of the bridge itself (11), it must
3453 - * return the AGP bus. Currently, it returns 0, which is by
3454 - * chance the AGP one. We may have to improve that however...
3458 -pmac_pci_dev_root_bridge(unsigned char bus, unsigned char dev_fn)
3460 - struct device_node *node, *bridge_node;
3461 - int bridge = uninorth_default;
3463 - if (uninorth_count == 0)
3465 - if (bus == 0 && PCI_SLOT(dev_fn) < 11)
3468 - /* We look for the OF device corresponding to this bus/devfn pair. If we
3469 - * don't find it, we default to the external PCI */
3470 - bridge_node = NULL;
3471 - node = find_pci_device_OFnode(bus, dev_fn & 0xf8);
3473 - /* note: we don't stop on the first occurrence since we need to go
3474 - * up to the root bridge */
3476 - if (node->type && !strcmp(node->type, "pci")
3477 - && device_is_compatible(node, "uni-north"))
3478 - bridge_node = node;
3479 - node=node->parent;
3482 - if (bridge_node) {
3484 - for (i=0;i<uninorth_count;i++)
3485 - if (uninorth_bridges[i].node == bridge_node) {
3491 - if (bridge == -1) {
3492 - printk(KERN_WARNING "pmac_pci: no default bridge !\n");
3501 -pmac_pci_dev_io_base(unsigned char bus, unsigned char devfn, int physical)
3504 - if (uninorth_count != 0)
3505 - bridge = pmac_pci_dev_root_bridge(bus, devfn);
3506 - if (bridge == -1) {
3507 - struct bridge_data *bp;
3509 - if (bus > max_bus || (bp = bridges[bus]) == 0)
3511 - return physical ? bp->io_base_phys : bp->io_base;
3513 - return physical ? uninorth_bridges[bridge].iobase_phys
3514 - : uninorth_bridges[bridge].iobase;
3519 -pmac_pci_dev_mem_base(unsigned char bus, unsigned char devfn)
3524 -/* This function only works for bus 0, uni-N uses a different mecanism for
3525 - * other busses (see below)
3527 -#define UNI_N_CFA0(devfn, off) \
3528 - ((1 << (unsigned long)PCI_SLOT(dev_fn)) \
3529 - | (((unsigned long)PCI_FUNC(dev_fn)) << 8) \
3530 - | (((unsigned long)(off)) & 0xFCUL))
3532 -/* This one is for type 1 config accesses */
3533 -#define UNI_N_CFA1(bus, devfn, off) \
3534 - ((((unsigned long)(bus)) << 16) \
3535 - |(((unsigned long)(devfn)) << 8) \
3536 - |(((unsigned long)(off)) & 0xFCUL) \
3542 -uni_north_access_data(unsigned char bus, unsigned char dev_fn,
3543 - unsigned char offset)
3546 - unsigned int caddr;
3548 - bridge = pmac_pci_dev_root_bridge(bus, dev_fn);
3550 - caddr = UNI_N_CFA0(dev_fn, offset);
3552 - caddr = UNI_N_CFA1(bus, dev_fn, offset);
3554 - if (bridge == -1) {
3555 - printk(KERN_WARNING "pmac_pci: no default bridge !\n");
3559 - /* Uninorth will return garbage if we don't read back the value ! */
3560 - out_le32(uninorth_bridges[bridge].cfg_addr, caddr);
3561 - (void)in_le32(uninorth_bridges[bridge].cfg_addr);
3562 - /* Yes, offset is & 7, not & 3 ! */
3563 - return (unsigned int)(uninorth_bridges[bridge].cfg_data) + (offset & 0x07);
3567 -int uni_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn,
3568 - unsigned char offset, unsigned char *val)
3570 - unsigned int addr;
3573 - addr = uni_north_access_data(bus, dev_fn, offset);
3575 - return PCIBIOS_DEVICE_NOT_FOUND;
3576 - *val = in_8((volatile unsigned char*)addr);
3577 - return PCIBIOS_SUCCESSFUL;
3581 -int uni_pcibios_read_config_word(unsigned char bus, unsigned char dev_fn,
3582 - unsigned char offset, unsigned short *val)
3584 - unsigned int addr;
3587 - addr = uni_north_access_data(bus, dev_fn, offset);
3589 - return PCIBIOS_DEVICE_NOT_FOUND;
3590 - *val = in_le16((volatile unsigned short*)addr);
3591 - return PCIBIOS_SUCCESSFUL;
3595 -int uni_pcibios_read_config_dword(unsigned char bus, unsigned char dev_fn,
3596 - unsigned char offset, unsigned int *val)
3598 - unsigned int addr;
3601 - addr = uni_north_access_data(bus, dev_fn, offset);
3603 - return PCIBIOS_DEVICE_NOT_FOUND;
3604 - *val = in_le32((volatile unsigned int*)addr);
3605 - return PCIBIOS_SUCCESSFUL;
3609 -int uni_pcibios_write_config_byte(unsigned char bus, unsigned char dev_fn,
3610 - unsigned char offset, unsigned char val)
3612 - unsigned int addr;
3614 - addr = uni_north_access_data(bus, dev_fn, offset);
3616 - return PCIBIOS_DEVICE_NOT_FOUND;
3617 - out_8((volatile unsigned char *)addr, val);
3618 - (void)in_8((volatile unsigned char *)addr);
3619 - return PCIBIOS_SUCCESSFUL;
3623 -int uni_pcibios_write_config_word(unsigned char bus, unsigned char dev_fn,
3624 - unsigned char offset, unsigned short val)
3626 - unsigned int addr;
3628 - addr = uni_north_access_data(bus, dev_fn, offset);
3630 - return PCIBIOS_DEVICE_NOT_FOUND;
3631 - out_le16((volatile unsigned short *)addr, val);
3632 - (void)in_le16((volatile unsigned short *)addr);
3633 - return PCIBIOS_SUCCESSFUL;
3637 -int uni_pcibios_write_config_dword(unsigned char bus, unsigned char dev_fn,
3638 - unsigned char offset, unsigned int val)
3640 - unsigned int addr;
3642 - addr = uni_north_access_data(bus, dev_fn, offset);
3644 - return PCIBIOS_DEVICE_NOT_FOUND;
3645 - out_le32((volatile unsigned int *)addr, val);
3646 - (void)in_le32((volatile unsigned int *)addr);
3647 - return PCIBIOS_SUCCESSFUL;
3652 int pmac_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn,
3653 unsigned char offset, unsigned char *val)
3654 @@ -576,80 +360,6 @@
3658 -#define GRACKLE_PICR1_STG 0x00000040
3659 -#define GRACKLE_PICR1_LOOPSNOOP 0x00000010
3661 -/* N.B. this is called before bridges is initialized, so we can't
3662 - use grackle_pcibios_{read,write}_config_dword. */
3663 -static inline void grackle_set_stg(struct bridge_data *bp, int enable)
3667 - out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
3668 - val = in_le32((volatile unsigned int *)bp->cfg_data);
3669 - val = enable? (val | GRACKLE_PICR1_STG) :
3670 - (val & ~GRACKLE_PICR1_STG);
3671 - out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
3672 - out_le32((volatile unsigned int *)bp->cfg_data, val);
3675 -static inline void grackle_set_loop_snoop(struct bridge_data *bp, int enable)
3679 - out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
3680 - val = in_le32((volatile unsigned int *)bp->cfg_data);
3681 - val = enable? (val | GRACKLE_PICR1_LOOPSNOOP) :
3682 - (val & ~GRACKLE_PICR1_LOOPSNOOP);
3683 - out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
3684 - out_le32((volatile unsigned int *)bp->cfg_data, val);
3688 -fixup_one_level_bus_range(struct device_node *node, int higher)
3690 - for (; node != 0;node = node->sibling) {
3692 - unsigned int *class_code;
3695 - /* For PCI<->PCI bridges or CardBus bridges, we go down */
3696 - class_code = (unsigned int *) get_property(node, "class-code", 0);
3697 - if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
3698 - (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
3700 - bus_range = (int *) get_property(node, "bus-range", &len);
3701 - if (bus_range != NULL && len > 2 * sizeof(int)) {
3702 - if (bus_range[1] > higher)
3703 - higher = bus_range[1];
3705 - higher = fixup_one_level_bus_range(node->child, higher);
3710 -/* This routine fixes the "bus-range" property of all bridges in the
3711 - * system since they tend to have their "last" member wrong on macs
3713 - * Note that the bus numbers manipulated here are OF bus numbers, they
3714 - * are not Linux bus numbers.
3717 -fixup_bus_range(struct device_node *bridge)
3722 - /* Lookup the "bus-range" property for the hose */
3723 - bus_range = (int *) get_property(bridge, "bus-range", &len);
3724 - if (bus_range == NULL || len < 2 * sizeof(int)) {
3725 - printk(KERN_WARNING "Can't get bus-range for %s\n",
3726 - bridge->full_name);
3729 - bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]);
3732 __initfunc(unsigned long pmac_find_bridges(unsigned long mem_start, unsigned long mem_end))
3739 - fixup_bus_range(dev);
3740 bus_range = (int *) get_property(dev, "bus-range", &len);
3741 if (bus_range == NULL || len < 2 * sizeof(int)) {
3742 printk(KERN_WARNING "Can't get bus-range for %s\n",
3743 @@ -702,54 +411,21 @@
3744 printk(KERN_INFO "PCI buses %d..%d", bus_range[0],
3746 printk(" controlled by %s at %x\n", dev->name, addr->address);
3747 - if (device_is_compatible(dev, "uni-north")) {
3748 - int i = uninorth_count++;
3749 - uninorth_bridges[i].cfg_addr = ioremap(addr->address + 0x800000, 0x1000);
3750 - uninorth_bridges[i].cfg_data = ioremap(addr->address + 0xc00000, 0x1000);
3751 - uninorth_bridges[i].node = dev;
3752 - uninorth_bridges[i].iobase_phys = (void *)addr->address;
3753 - /* is 0x10000 enough for io space ? */
3754 - uninorth_bridges[i].iobase = (void *)ioremap(addr->address, 0x10000);
3755 - /* XXX This is the bridge with the PCI expansion bus. This is also the
3756 - * address of the bus that will receive type 1 config accesses and io
3757 - * accesses. Appears to be correct for iMac DV and G4 Sawtooth too.
3758 - * That means that we cannot do io cycles on the AGP bus nor the internal
3759 - * ethernet/fw bus. Fortunately, they appear not to be needed on iMac DV
3762 - if (addr->address == 0xf2000000)
3763 - uninorth_default = i;
3767 bp = (struct bridge_data *) *mem_ptr;
3768 *mem_ptr += sizeof(struct bridge_data);
3769 - if (device_is_compatible(dev, "uni-north")) {
3772 - bp->io_base = uninorth_bridges[uninorth_count-1].iobase;
3773 - bp->io_base_phys = uninorth_bridges[uninorth_count-1].iobase_phys;
3774 - } else if (strcmp(dev->name, "pci") == 0) {
3775 - /* XXX assume this is a mpc106 (grackle) */
3776 - bp->cfg_addr = (volatile unsigned int *)
3777 - ioremap(0xfec00000, 0x1000);
3778 - bp->cfg_data = (volatile unsigned char *)
3779 - ioremap(0xfee00000, 0x1000);
3780 - bp->io_base = (void *) ioremap(0xfe000000, 0x20000);
3781 - bp->io_base_phys = (void *)0xfe000000;
3782 - if (machine_is_compatible("AAPL,PowerBook1998"))
3783 - grackle_set_loop_snoop(bp, 1);
3784 -#if 0 /* Disabled for now, HW problems ??? */
3785 - grackle_set_stg(bp, 1);
3788 - /* a `bandit' or `chaos' bridge */
3789 + if (strcmp(dev->name, "pci") != 0) {
3790 bp->cfg_addr = (volatile unsigned int *)
3791 ioremap(addr->address + 0x800000, 0x1000);
3792 bp->cfg_data = (volatile unsigned char *)
3793 ioremap(addr->address + 0xc00000, 0x1000);
3794 bp->io_base = (void *) ioremap(addr->address, 0x10000);
3795 - bp->io_base_phys = (void *)addr->address;
3798 + bp->cfg_addr = (volatile unsigned int *)
3799 + ioremap(0xfec00000, 0x1000);
3800 + bp->cfg_data = (volatile unsigned char *)
3801 + ioremap(0xfee00000, 0x1000);
3802 + bp->io_base = (void *) ioremap(0xfe000000, 0x20000);
3804 if (isa_io_base == 0)
3805 isa_io_base = (unsigned long) bp->io_base;
3806 @@ -792,13 +468,7 @@
3807 if (pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin) ||
3809 continue; /* No interrupt generated -> no fixup */
3810 - /* We iterate all instances of uninorth for now */
3811 - if (uninorth_count && dev->bus->number == 0) {
3813 - for (i=0;i<uninorth_count;i++)
3814 - fix_intr(uninorth_bridges[i].node->child, dev);
3816 - fix_intr(bp->node->child, dev);
3817 + fix_intr(bp->node->child, dev);
3821 @@ -806,17 +476,9 @@
3823 pmac_setup_pci_ptrs(void))
3825 - struct device_node* np;
3827 - np = find_devices("pci");
3829 - if (device_is_compatible(np, "uni-north")) {
3830 - /* looks like an Core99 powermac */
3831 - set_config_access_method(uni);
3833 - /* looks like a G3 powermac */
3834 - set_config_access_method(grackle);
3836 + if (find_devices("pci") != 0) {
3837 + /* looks like a G3 powermac */
3838 + set_config_access_method(grackle);
3840 set_config_access_method(pmac);
3842 diff -urN linux.orig/arch/ppc/kernel/pmac_pic.c linux/arch/ppc/kernel/pmac_pic.c
3843 --- linux.orig/arch/ppc/kernel/pmac_pic.c Sun Mar 25 18:31:49 2001
3844 +++ linux/arch/ppc/kernel/pmac_pic.c Thu Jul 11 15:43:29 2002
3846 #include <linux/sched.h>
3847 #include <linux/signal.h>
3848 #include <linux/pci.h>
3849 -#include <linux/openpic.h>
3850 #include <asm/pci-bridge.h>
3852 #include <asm/smp.h>
3853 #include <asm/prom.h>
3854 #include "pmac_pic.h"
3855 -#include "open_pic.h"
3857 struct pmac_irq_hw {
3860 static int max_irqs;
3861 static int max_real_irqs;
3863 -extern u_int openpic_read(volatile u_int *addr);
3865 #define MAXCOUNT 10000000
3867 #define GATWICK_IRQ_POOL_SIZE 10
3872 - extern void psurge_smp_message_recv(void);
3875 unsigned long bits = 0;
3881 - psurge_smp_message_recv();
3882 + pmac_smp_message_recv();
3885 /* could be here due to a do_fake_interrupt call but we don't
3886 @@ -356,58 +350,6 @@
3887 struct device_node *irqctrler;
3888 volatile struct pmac_irq_hw *addr;
3893 - /* We first try to detect Apple's new Core99 chipset, since mac-io
3894 - * is quite different on those machines and contains an IBM MPIC2.
3896 - irqctrler = find_type_devices("open-pic");
3897 - if (irqctrler != NULL) {
3898 - printk("PowerMac using OpenPIC irq controller\n");
3899 - if (irqctrler->n_addrs > 0) {
3901 - struct device_node* pswitch;
3902 -#endif /* CONFIG_XMON */
3903 - OpenPIC = (volatile struct OpenPIC *)
3904 - ioremap(irqctrler->addrs[0].address,
3905 - irqctrler->addrs[0].size);
3906 - /* from openpic.c code... --Troy
3907 - * dynamically figure out how many interrupts
3908 - * We should really do something like panic
3909 - * if nr_irq >= OPENPIC_VEC_IPI
3911 - t = openpic_read(&OpenPIC->Global.Feature_Reporting0);
3912 - nr_irq = ((t & OPENPIC_FEATURE_LAST_SOURCE_MASK) >>
3913 - OPENPIC_FEATURE_LAST_SOURCE_SHIFT) + 1;
3915 - for ( i = 0 ; i < nr_irq ; i++ ) {
3916 - irq_desc[i].ctl = &open_pic;
3917 - irq_desc[i].level = 0;
3919 - ppc_md.do_IRQ = open_pic_do_IRQ;
3920 - open_pic.irq_offset = 0;
3923 - pswitch = find_devices("programmer-switch");
3924 - if (pswitch && pswitch->n_intrs)
3925 - request_irq(pswitch->intrs[0].line, xmon_irq, 0,
3927 -#endif /* CONFIG_XMON */
3929 - request_irq(OPENPIC_VEC_IPI, openpic_ipi_action,
3931 - request_irq(OPENPIC_VEC_IPI+1, openpic_ipi_action,
3932 - 0, "IPI1 (invalidate TLB)", 0);
3933 - request_irq(OPENPIC_VEC_IPI+2, openpic_ipi_action,
3934 - 0, "IPI2 (stop CPU)", 0);
3935 - request_irq(OPENPIC_VEC_IPI+3, openpic_ipi_action,
3936 - 0, "IPI3 (reschedule)", 0);
3937 -#endif /* __SMP__ */
3944 * G3 powermacs and 1999 G3 PowerBooks have 64 interrupts,
3946 * sleep_save_intrs() saves the states of all interrupt enables
3947 * and disables all interupts except for the nominated one.
3948 * sleep_restore_intrs() restores the states of all interrupt enables.
3950 - * TODO: Those should be sleep notifiers with high priority.
3952 unsigned int sleep_save_mask[2];
3955 sleep_save_mask[1] = ppc_cached_irq_mask[1];
3956 ppc_cached_irq_mask[0] = 0;
3957 ppc_cached_irq_mask[1] = 0;
3959 - set_bit(viaint, ppc_cached_irq_mask);
3960 + set_bit(viaint, ppc_cached_irq_mask);
3961 out_le32(&pmac_irq_hw[0]->enable, ppc_cached_irq_mask[0]);
3962 if (max_real_irqs > 32)
3963 out_le32(&pmac_irq_hw[1]->enable, ppc_cached_irq_mask[1]);
3969 out_le32(&pmac_irq_hw[0]->enable, 0);
3970 if (max_real_irqs > 32)
3971 out_le32(&pmac_irq_hw[1]->enable, 0);
3972 diff -urN linux.orig/arch/ppc/kernel/pmac_setup.c linux/arch/ppc/kernel/pmac_setup.c
3973 --- linux.orig/arch/ppc/kernel/pmac_setup.c Sun Mar 25 18:37:30 2001
3974 +++ linux/arch/ppc/kernel/pmac_setup.c Tue Jul 16 16:43:35 2002
3976 #include <asm/ide.h>
3977 #include <asm/machdep.h>
3978 #include <asm/keyboard.h>
3979 -#include <asm/time.h>
3982 #include "local_irq.h"
3983 #include "pmac_pic.h"
3985 #undef SHOW_GATWICK_IRQS
3987 -extern long pmac_time_init(void);
3988 -extern unsigned long pmac_get_rtc_time(void);
3989 -extern int pmac_set_rtc_time(unsigned long nowtime);
3990 -extern void pmac_read_rtc_time(void);
3991 -extern void pmac_calibrate_decr(void);
3992 -extern void pmac_setup_pci_ptrs(void);
3993 +unsigned long pmac_get_rtc_time(void);
3994 +int pmac_set_rtc_time(unsigned long nowtime);
3995 +void pmac_read_rtc_time(void);
3996 +void pmac_calibrate_decr(void);
3997 +void pmac_setup_pci_ptrs(void);
3999 extern int mackbd_setkeycode(unsigned int scancode, unsigned int keycode);
4000 extern int mackbd_getkeycode(unsigned int scancode);
4002 extern void mackbd_leds(unsigned char leds);
4003 extern void mackbd_init_hw(void);
4004 #ifdef CONFIG_MAGIC_SYSRQ
4005 -extern unsigned char mackbd_sysrq_xlate[128];
4006 extern unsigned char mac_hid_kbd_sysrq_xlate[128];
4007 extern unsigned char pckbd_sysrq_xlate[128];
4008 +unsigned char mackbd_sysrq_xlate[128];
4009 #endif /* CONFIG_MAGIC_SYSRQ */
4010 extern int keyboard_sends_linux_keycodes;
4011 extern int mac_hid_kbd_translate(unsigned char scancode,
4013 extern char mac_hid_kbd_unexpected_up(unsigned char keycode);
4014 extern void mac_hid_init_hw(void);
4016 -extern void pmac_nvram_update(void);
4018 -extern void *pmac_pci_dev_io_base(unsigned char bus, unsigned char devfn);
4019 -extern void *pmac_pci_dev_mem_base(unsigned char bus, unsigned char devfn);
4020 -extern int pmac_pci_dev_root_bridge(unsigned char bus, unsigned char devfn);
4021 +extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
4022 +extern int pckbd_getkeycode(unsigned int scancode);
4023 +extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
4025 +extern char pckbd_unexpected_up(unsigned char keycode);
4026 +extern void pckbd_leds(unsigned char leds);
4027 +extern void pckbd_init_hw(void);
4029 unsigned char drive_info;
4031 int ppc_override_l2cr = 0;
4032 int ppc_override_l2cr_value;
4034 -static int current_root_goodness = -1;
4036 extern char saved_command_line[];
4038 -extern int pmac_newworld;
4040 #define DEFAULT_ROOT_DEVICE 0x0801 /* sda1 - slightly silly choice */
4042 extern void zs_kgdb_hook(int tty_num);
4043 static void ohare_init(void);
4044 static void init_p2pbridge(void);
4047 -volatile static long int core99_l2_cache;
4048 -void core99_init_l2(void)
4050 - int cpu = smp_processor_id();
4052 - if ( (_get_PVR() >> 16) != 8 && (_get_PVR() >> 16) != 12 )
4056 - core99_l2_cache = _get_L2CR();
4057 - printk("CPU0: L2CR is %lx\n", core99_l2_cache);
4059 - printk("CPU%d: L2CR was %lx\n", cpu, _get_L2CR());
4060 - _set_L2CR(core99_l2_cache);
4061 - printk("CPU%d: L2CR set to %lx\n", cpu, core99_l2_cache);
4064 -#endif /* CONFIG_SMP */
4068 pmac_get_cpuinfo(char *buffer)
4069 @@ -219,10 +196,6 @@
4070 len += sprintf(buffer+len, "l2cr override\t: 0x%x\n", *l2cr);
4074 - /* Indicate newworld/oldworld */
4075 - len += sprintf(buffer+len, "pmac-generation\t: %s\n",
4076 - pmac_newworld ? "NewWorld" : "OldWorld");
4080 @@ -282,10 +255,8 @@
4082 switch (_get_PVR() >> 16) {
4086 case 10: /* mach V (604ev5) */
4089 loops_per_jiffy = *fp / HZ;
4091 @@ -304,11 +275,9 @@
4093 *memory_start_p = pmac_find_bridges(*memory_start_p, *memory_end_p);
4096 - /* Checks "l2cr-value" property in the registry
4097 - * And enable G3/G4 Dynamic Power Management
4099 - if ( (_get_PVR() >> 16) == 8 || (_get_PVR() >> 16) == 12 ) {
4101 + /* Checks "l2cr-value" property in the registry */
4102 + if ( (_get_PVR() >> 16) == 8) {
4103 struct device_node *np = find_devices("cpus");
4105 np = find_type_devices("cpu");
4106 @@ -319,22 +288,17 @@
4107 ppc_override_l2cr = 1;
4108 ppc_override_l2cr_value = *l2cr;
4110 - if (ppc_override_l2cr_value)
4111 - _set_L2CR(ppc_override_l2cr_value);
4112 + _set_L2CR(ppc_override_l2cr_value);
4115 - _set_HID0(_get_HID0() | HID0_DPM);
4118 if (ppc_override_l2cr)
4119 printk(KERN_INFO "L2CR overriden (0x%x), backside cache is %s\n",
4120 ppc_override_l2cr_value, (ppc_override_l2cr_value & 0x80000000)
4121 ? "enabled" : "disabled");
4135 - pmac_nvram_init();
4137 #ifdef CONFIG_DUMMY_CONSOLE
4138 conswitchp = &dummy_con;
4144 + pmac_nvram_init();
4148 @@ -493,14 +456,13 @@
4150 /* can't be initfunc - can be called whenever a disk is first accessed */
4152 -void note_bootable_part(kdev_t dev, int part, int goodness)
4153 +void note_bootable_part(kdev_t dev, int part)
4155 static int found_boot = 0;
4158 /* Do nothing if the root has been set already. */
4159 - if ((goodness < current_root_goodness) &&
4160 - (ROOT_DEV != to_kdev_t(DEFAULT_ROOT_DEVICE)))
4161 + if (ROOT_DEV != to_kdev_t(DEFAULT_ROOT_DEVICE))
4163 p = strstr(saved_command_line, "root=");
4164 if (p != NULL && (p == saved_command_line || p[-1] == ' '))
4166 if (boot_dev == 0 || dev == boot_dev) {
4167 ROOT_DEV = MKDEV(MAJOR(dev), MINOR(dev) + part);
4169 - current_root_goodness = goodness;
4170 + printk(" (root)");
4176 struct adb_request req;
4178 - pmac_nvram_update();
4180 switch (adb_hardware) {
4182 cuda_request(&req, NULL, 2, CUDA_PACKET,
4185 struct adb_request req;
4187 - pmac_nvram_update();
4189 switch (adb_hardware) {
4191 cuda_request(&req, NULL, 2, CUDA_PACKET,
4200 @@ -663,15 +622,11 @@
4201 ppc_md.power_off = pmac_power_off;
4202 ppc_md.halt = pmac_halt;
4204 - ppc_md.time_init = pmac_time_init;
4205 + ppc_md.time_init = NULL;
4206 ppc_md.set_rtc_time = pmac_set_rtc_time;
4207 ppc_md.get_rtc_time = pmac_get_rtc_time;
4208 ppc_md.calibrate_decr = pmac_calibrate_decr;
4210 - ppc_md.pci_dev_root_bridge = pmac_pci_dev_root_bridge;
4211 - ppc_md.pci_dev_mem_base = pmac_pci_dev_mem_base;
4212 - ppc_md.pci_dev_io_base = pmac_pci_dev_io_base;
4215 #ifdef CONFIG_MAC_KEYBOARD
4216 ppc_md.kbd_setkeycode = mackbd_setkeycode;
4217 diff -urN linux.orig/arch/ppc/kernel/pmac_support.c linux/arch/ppc/kernel/pmac_support.c
4218 --- linux.orig/arch/ppc/kernel/pmac_support.c Sun Mar 25 18:31:49 2001
4219 +++ linux/arch/ppc/kernel/pmac_support.c Thu Jul 11 15:43:29 2002
4222 * Miscellaneous procedures for dealing with the PowerMac hardware.
4223 - * Contains support for the nvram.
4225 - * Copyright (C) 2000 Paul Mackerras
4226 - * Copyright (C) 2000 Benjamin Herrenschmidt
4228 - * ToDo: Handle type 0 and type 1 "NameRegistry" NVRAM properties. Those
4229 - * contain, among other things, the brightness, video mode, etc...
4231 #include <linux/kernel.h>
4232 #include <linux/stddef.h>
4233 #include <linux/reboot.h>
4234 #include <linux/nvram.h>
4235 -#include <linux/slab.h>
4236 -#include <linux/delay.h>
4237 #include <asm/init.h>
4238 #include <asm/ptrace.h>
4241 #include <asm/prom.h>
4242 #include <asm/adb.h>
4243 #include <asm/pmu.h>
4244 -#include <asm/machdep.h>
4245 #include <asm/nvram.h>
4246 #include <asm/backlight.h>
4250 -#define NVRAM_SIZE 0x2000 /* 8kB of non-volatile RAM */
4252 -#define CORE99_SIGNATURE 0x5a
4253 -#define CORE99_ADLER_START 0x14
4255 -/* Core99 nvram is a flash */
4256 -#define CORE99_FLASH_STATUS_DONE 0x80
4257 -#define CORE99_FLASH_STATUS_ERR 0x38
4258 -#define CORE99_FLASH_CMD_ERASE_CONFIRM 0xd0
4259 -#define CORE99_FLASH_CMD_ERASE_SETUP 0x20
4260 -#define CORE99_FLASH_CMD_RESET 0xff
4261 -#define CORE99_FLASH_CMD_WRITE_SETUP 0x40
4263 -/* CHRP NVRAM header */
4264 -struct chrp_header {
4272 -struct core99_header {
4273 - struct chrp_header hdr;
4280 * Read and write the non-volatile RAM on PowerMacs and CHRP machines.
4282 static int nvram_naddrs;
4283 static volatile unsigned char *nvram_addr;
4284 static volatile unsigned char *nvram_data;
4285 -static int nvram_mult, is_core_99;
4286 -static int core99_bank = 0;
4287 +static int nvram_mult;
4288 static int nvram_partitions[3];
4290 static struct backlight_controller *backlighter = NULL;
4291 @@ -73,213 +31,22 @@
4292 static int backlight_level = BACKLIGHT_MAX;
4293 static int backlight_enabled = 1;
4295 -/* FIXME: kmalloc fails to allocate the image now that I had to move it
4296 - * before time_init(). For now, I allocate a static buffer here
4297 - * but it's a waste of space on all but core99 machines
4300 -static char* nvram_image;
4302 -static char nvram_image[NVRAM_SIZE];
4305 -extern int pmac_newworld;
4308 -chrp_checksum(struct chrp_header* hdr)
4311 - u16 sum = hdr->signature;
4312 - for (ptr = (u8 *)&hdr->len; ptr < hdr->data; ptr++)
4314 - while (sum > 0xFF)
4315 - sum = (sum & 0xFF) + (sum>>8);
4320 -core99_calc_adler(u8 *buffer)
4325 - buffer += CORE99_ADLER_START;
4328 - for (cnt=0; cnt<(NVRAM_SIZE-CORE99_ADLER_START); cnt++) {
4329 - if ((cnt % 5000) == 0) {
4333 - low += buffer[cnt];
4339 - return (high << 16) | low;
4343 -core99_check(u8* datas)
4345 - struct core99_header* hdr99 = (struct core99_header*)datas;
4346 +#define NVRAM_SIZE 0x2000 /* 8kB of non-volatile RAM */
4348 - if (hdr99->hdr.signature != CORE99_SIGNATURE) {
4350 - printk("Invalid signature\n");
4354 - if (hdr99->hdr.cksum != chrp_checksum(&hdr99->hdr)) {
4356 - printk("Invalid checksum\n");
4360 - if (hdr99->adler != core99_calc_adler(datas)) {
4362 - printk("Invalid adler\n");
4366 - return hdr99->generation;
4370 -core99_erase_bank(int bank)
4374 - u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
4376 - out_8(base, CORE99_FLASH_CMD_ERASE_SETUP);
4377 - out_8(base, CORE99_FLASH_CMD_ERASE_CONFIRM);
4378 - do { stat = in_8(base); }
4379 - while(!(stat & CORE99_FLASH_STATUS_DONE));
4380 - out_8(base, CORE99_FLASH_CMD_RESET);
4381 - if (stat & CORE99_FLASH_STATUS_ERR) {
4382 - printk("nvram: flash error 0x%02x on erase !\n", stat);
4385 - for (i=0; i<NVRAM_SIZE; i++)
4386 - if (base[i] != 0xff) {
4387 - printk("nvram: flash erase failed !\n");
4394 -core99_write_bank(int bank, u8* datas)
4398 - u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
4400 - for (i=0; i<NVRAM_SIZE; i++) {
4401 - out_8(base+i, CORE99_FLASH_CMD_WRITE_SETUP);
4402 - out_8(base+i, datas[i]);
4403 - do { stat = in_8(base); }
4404 - while(!(stat & CORE99_FLASH_STATUS_DONE));
4405 - if (stat & CORE99_FLASH_STATUS_ERR)
4408 - out_8(base, CORE99_FLASH_CMD_RESET);
4409 - if (stat & CORE99_FLASH_STATUS_ERR) {
4410 - printk("nvram: flash error 0x%02x on write !\n", stat);
4413 - for (i=0; i<NVRAM_SIZE; i++)
4414 - if (base[i] != datas[i]) {
4415 - printk("nvram: flash write failed !\n");
4422 -lookup_partitions(void)
4426 - struct chrp_header* hdr;
4428 - if (pmac_newworld) {
4429 - nvram_partitions[pmac_nvram_OF] = -1;
4430 - nvram_partitions[pmac_nvram_XPRAM] = -1;
4431 - nvram_partitions[pmac_nvram_NR] = -1;
4432 - hdr = (struct chrp_header *)buffer;
4437 - for (i=0;i<16;i++)
4438 - buffer[i] = nvram_read_byte(offset+i);
4439 - if (!strcmp(hdr->name, "common"))
4440 - nvram_partitions[pmac_nvram_OF] = offset + 0x10;
4441 - if (!strcmp(hdr->name, "APL,MacOS75")) {
4442 - nvram_partitions[pmac_nvram_XPRAM] = offset + 0x10;
4443 - nvram_partitions[pmac_nvram_NR] = offset + 0x110;
4445 - offset += (hdr->len * 0x10);
4446 - } while(offset < NVRAM_SIZE);
4448 - nvram_partitions[pmac_nvram_OF] = 0x1800;
4449 - nvram_partitions[pmac_nvram_XPRAM] = 0x1300;
4450 - nvram_partitions[pmac_nvram_NR] = 0x1400;
4453 - printk("nvram: OF partition at 0x%x\n", nvram_partitions[pmac_nvram_OF]);
4454 - printk("nvram: XP partition at 0x%x\n", nvram_partitions[pmac_nvram_XPRAM]);
4455 - printk("nvram: NR partition at 0x%x\n", nvram_partitions[pmac_nvram_NR]);
4460 void pmac_nvram_init(void)
4462 struct device_node *dp;
4466 dp = find_devices("nvram");
4468 printk(KERN_ERR "Can't find NVRAM device\n");
4472 nvram_naddrs = dp->n_addrs;
4473 - is_core_99 = device_is_compatible(dp, "nvram,flash");
4474 - printk("pmac nvram is core99: %d\n", is_core_99);
4477 - u32 gen_bank0, gen_bank1;
4479 - if (nvram_naddrs < 1) {
4480 - printk(KERN_ERR "nvram: no address\n");
4484 - nvram_image = kmalloc(NVRAM_SIZE, GFP_KERNEL);
4485 - if (!nvram_image) {
4486 - printk(KERN_ERR "nvram: can't allocate image\n");
4490 - nvram_data = ioremap(dp->addrs[0].address, NVRAM_SIZE*2);
4492 - printk("nvram: Checking bank 0...\n");
4494 - gen_bank0 = core99_check((u8 *)nvram_data);
4495 - gen_bank1 = core99_check((u8 *)nvram_data + NVRAM_SIZE);
4496 - core99_bank = (gen_bank0 < gen_bank1) ? 1 : 0;
4498 - printk("nvram: gen0=%d, gen1=%d\n", gen_bank0, gen_bank1);
4499 - printk("nvram: Active bank is: %d\n", core99_bank);
4501 - for (i=0; i<NVRAM_SIZE; i++)
4502 - nvram_image[i] = nvram_data[i + core99_bank*NVRAM_SIZE];
4503 - } else if (_machine == _MACH_chrp && nvram_naddrs == 1) {
4504 + if (_machine == _MACH_chrp && nvram_naddrs == 1) {
4505 nvram_data = ioremap(dp->addrs[0].address, dp->addrs[0].size);
4507 } else if (nvram_naddrs == 1) {
4508 @@ -288,45 +55,15 @@
4509 } else if (nvram_naddrs == 2) {
4510 nvram_addr = ioremap(dp->addrs[0].address, dp->addrs[0].size);
4511 nvram_data = ioremap(dp->addrs[1].address, dp->addrs[1].size);
4512 - } else if (nvram_naddrs == 0 && adb_controller &&
4513 - adb_controller->kind == ADB_VIAPMU) {
4514 + } else if (nvram_naddrs == 0 && adb_hardware == ADB_VIAPMU) {
4517 printk(KERN_ERR "Don't know how to access NVRAM with %d addresses\n",
4520 - lookup_partitions();
4524 -pmac_nvram_update(void)
4526 - struct core99_header* hdr99;
4528 - if (!is_core_99 || !nvram_data || !nvram_image)
4530 - if (!memcmp(nvram_image, (u8*)nvram_data + core99_bank*NVRAM_SIZE,
4534 - printk("Updating nvram...\n");
4536 - hdr99 = (struct core99_header*)nvram_image;
4537 - hdr99->generation++;
4538 - hdr99->hdr.signature = CORE99_SIGNATURE;
4539 - hdr99->hdr.cksum = chrp_checksum(&hdr99->hdr);
4540 - hdr99->adler = core99_calc_adler(nvram_image);
4541 - core99_bank = core99_bank ? 0 : 1;
4542 - if (core99_erase_bank(core99_bank)) {
4543 - printk("nvram: Error erasing bank %d\n", core99_bank);
4546 - if (core99_write_bank(core99_bank, nvram_image))
4547 - printk("nvram: Error writing bank %d\n", core99_bank);
4550 -unsigned char __pmac
4551 -nvram_read_byte(int addr)
4552 +unsigned char nvram_read_byte(int addr)
4554 struct adb_request req;
4558 return req.reply[1];
4561 - return nvram_image ? nvram_image[addr] : 0;
4562 return nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult];
4564 *nvram_addr = addr >> 5;
4570 -nvram_write_byte(unsigned char val, int addr)
4571 +void nvram_write_byte(unsigned char val, int addr)
4573 struct adb_request req;
4582 - nvram_image[addr] = val;
4585 nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult] = val;
4588 diff -urN linux.orig/arch/ppc/kernel/pmac_time.c linux/arch/ppc/kernel/pmac_time.c
4589 --- linux.orig/arch/ppc/kernel/pmac_time.c Sun Mar 25 18:31:49 2001
4590 +++ linux/arch/ppc/kernel/pmac_time.c Thu Jul 11 15:43:29 2002
4592 #include <asm/system.h>
4594 #include <asm/pgtable.h>
4595 -#include <asm/nvram.h>
4597 -#include <asm/time.h>
4600 /* Apparently the RTC stores seconds since 1 Jan 1904 */
4601 #define RTC_OFFSET 2082844800
4603 /* Bits in IFR and IER */
4604 #define T1_INT 0x40 /* Timer 1 interrupt */
4606 -extern struct timezone sys_tz;
4609 -long pmac_time_init(void)
4614 - delta = ((s32)pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x9)) << 16;
4615 - delta |= ((s32)pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0xa)) << 8;
4616 - delta |= pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0xb);
4617 - if (delta & 0x00800000UL)
4618 - delta |= 0xFF000000UL;
4619 - dst = ((pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x8) & 0x80) != 0);
4620 - printk("GMT Delta read from XPRAM: %d minutes, DST: %s\n", delta/60,
4621 - dst ? "on" : "off");
4627 unsigned long pmac_get_rtc_time(void)
4629 struct adb_request req;
4632 int pmac_set_rtc_time(unsigned long nowtime)
4634 - struct adb_request req;
4637 - nowtime += RTC_OFFSET;
4639 - /* Set the time in the RTC */
4640 - if (adb_controller == 0)
4642 - /* adb_controller->kind, not adb_hardware, since that doesn't
4643 - get set until we call adb_init - paulus. */
4644 - switch (adb_controller->kind) {
4646 - if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME,
4647 - nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0)
4649 - while (!req.complete)
4651 -// if (req.reply_len != 7)
4652 - printk(KERN_ERR "pmac_set_rtc_time: got %d byte reply\n",
4656 - if (pmu_request(&req, NULL, 5, PMU_SET_RTC,
4657 - nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0)
4659 - while (!req.complete)
4661 - if (req.reply_len != 5)
4662 - printk(KERN_ERR "pmac_set_rtc_time: got %d byte reply\n",
4674 diff -urN linux.orig/arch/ppc/kernel/ppc-stub.c linux/arch/ppc/kernel/ppc-stub.c
4675 --- linux.orig/arch/ppc/kernel/ppc-stub.c Sun Mar 25 18:31:49 2001
4676 +++ linux/arch/ppc/kernel/ppc-stub.c Thu Jul 11 15:43:29 2002
4679 static inline void set_msr(int msr)
4681 - asm volatile("mtmsr %0" : : "r" (msr));
4682 + asm volatile("mfmsr %0" : : "r" (msr));
4685 /* Set up exception handlers for tracing and breakpoints
4686 diff -urN linux.orig/arch/ppc/kernel/ppc_asm.tmpl linux/arch/ppc/kernel/ppc_asm.tmpl
4687 --- linux.orig/arch/ppc/kernel/ppc_asm.tmpl Sun Mar 25 18:31:48 2001
4688 +++ linux/arch/ppc/kernel/ppc_asm.tmpl Thu Jul 11 15:43:29 2002
4726 diff -urN linux.orig/arch/ppc/kernel/ppc_htab.c linux/arch/ppc/kernel/ppc_htab.c
4727 --- linux.orig/arch/ppc/kernel/ppc_htab.c Sun Mar 25 18:31:49 2001
4728 +++ linux/arch/ppc/kernel/ppc_htab.c Thu Jul 11 15:43:29 2002
4730 "0.5", "1.0", "(reserved2)", "(reserved3)"
4733 - if ( ((_get_PVR() >> 16) != 8) && ((_get_PVR() >> 16) != 12))
4735 + if ( (_get_PVR() >> 16) != 8) return -EFAULT;
4737 if ( /*!table->maxlen ||*/ (filp->f_pos && !write)) {
4746 + while ( _get_L2CR() & 0x1 )
4747 + /* wait for invalidate to finish */;
4751 diff -urN linux.orig/arch/ppc/kernel/ppc_ksyms.c linux/arch/ppc/kernel/ppc_ksyms.c
4752 --- linux.orig/arch/ppc/kernel/ppc_ksyms.c Tue Jun 11 19:39:18 2002
4753 +++ linux/arch/ppc/kernel/ppc_ksyms.c Fri Jul 12 18:41:29 2002
4755 #include <linux/sched.h>
4756 #include <linux/string.h>
4757 #include <linux/interrupt.h>
4758 -#include <linux/smp_lock.h>
4759 #include <linux/vt_kern.h>
4760 #include <linux/nvram.h>
4762 +#include <asm/page.h>
4763 #include <asm/semaphore.h>
4764 #include <asm/processor.h>
4765 #include <asm/uaccess.h>
4766 +#include <asm/io.h>
4767 #include <asm/ide.h>
4768 +#include <asm/atomic.h>
4769 +#include <asm/bitops.h>
4770 #include <asm/checksum.h>
4771 #include <asm/pgtable.h>
4772 #include <asm/adb.h>
4773 #include <asm/cuda.h>
4774 #include <asm/pmu.h>
4775 #include <asm/prom.h>
4776 +#include <asm/system.h>
4777 #include <asm/pci-bridge.h>
4778 #include <asm/irq.h>
4779 #include <asm/feature.h>
4780 +#include <asm/spinlock.h>
4781 #include <asm/dma.h>
4782 -#include <asm/nvram.h>
4783 -#include <asm/time.h>
4784 +#include <asm/machdep.h>
4786 /* Tell string.h we don't want memcpy etc. as cpp defines */
4787 #define EXPORT_SYMTAB_STROPS
4789 unsigned int, unsigned int, unsigned int);
4790 extern void to_tm(int tim, struct rtc_time * tm);
4792 -long long __ashrdi3(long long, int);
4793 -long long __ashldi3(long long, int);
4794 -long long __lshrdi3(long long, int);
4796 +asmlinkage long long __ashrdi3(long long, int);
4797 +asmlinkage long long __ashldi3(long long, int);
4798 +asmlinkage long long __lshrdi3(long long, int);
4799 +asmlinkage int abs(int);
4801 EXPORT_SYMBOL(clear_page);
4802 EXPORT_SYMBOL(do_signal);
4804 EXPORT_SYMBOL(isa_mem_base);
4805 EXPORT_SYMBOL(pci_dram_offset);
4806 EXPORT_SYMBOL(ISA_DMA_THRESHOLD);
4807 -EXPORT_SYMBOL_NOVERS(DMA_MODE_READ);
4808 +EXPORT_SYMBOL(DMA_MODE_READ);
4809 EXPORT_SYMBOL(DMA_MODE_WRITE);
4810 -#if defined(CONFIG_PREP) || defined(CONFIG_ALL_PPC)
4811 EXPORT_SYMBOL(_prep_type);
4812 EXPORT_SYMBOL(ucSystemType);
4815 EXPORT_SYMBOL(atomic_add);
4816 EXPORT_SYMBOL(atomic_sub);
4817 @@ -167,16 +169,11 @@
4818 EXPORT_SYMBOL(enable_kernel_fp);
4819 EXPORT_SYMBOL(flush_icache_range);
4820 EXPORT_SYMBOL(xchg_u32);
4822 -#ifdef CONFIG_ALTIVEC
4823 -EXPORT_SYMBOL(giveup_altivec);
4827 -EXPORT_SYMBOL(cpu_data);
4828 -EXPORT_SYMBOL(kernel_flag);
4829 -EXPORT_SYMBOL(cpu_number_map);
4830 -EXPORT_SYMBOL(smp_num_cpus);
4831 +EXPORT_SYMBOL(__global_cli);
4832 +EXPORT_SYMBOL(__global_sti);
4833 +EXPORT_SYMBOL(__global_save_flags);
4834 +EXPORT_SYMBOL(__global_restore_flags);
4835 EXPORT_SYMBOL(_spin_lock);
4836 EXPORT_SYMBOL(_spin_unlock);
4837 EXPORT_SYMBOL(spin_trylock);
4838 @@ -184,35 +181,11 @@
4839 EXPORT_SYMBOL(_read_unlock);
4840 EXPORT_SYMBOL(_write_lock);
4841 EXPORT_SYMBOL(_write_unlock);
4843 -/* Global SMP irq stuff */
4844 -EXPORT_SYMBOL(synchronize_irq);
4845 -EXPORT_SYMBOL(synchronize_bh);
4846 -EXPORT_SYMBOL(global_bh_count);
4847 -EXPORT_SYMBOL(global_bh_lock);
4848 -EXPORT_SYMBOL(global_irq_holder);
4849 -EXPORT_SYMBOL(__global_cli);
4850 -EXPORT_SYMBOL(__global_sti);
4851 -EXPORT_SYMBOL(__global_save_flags);
4852 -EXPORT_SYMBOL(__global_restore_flags);
4853 -#endif /* __SMP__ */
4856 EXPORT_SYMBOL(_machine);
4857 EXPORT_SYMBOL(ppc_md);
4858 -EXPORT_SYMBOL(abort);
4861 -EXPORT_SYMBOL(find_devices);
4862 -EXPORT_SYMBOL(find_type_devices);
4863 -EXPORT_SYMBOL(find_compatible_devices);
4864 -EXPORT_SYMBOL(find_path_device);
4865 -EXPORT_SYMBOL(find_phandle);
4866 -EXPORT_SYMBOL(device_is_compatible);
4867 -EXPORT_SYMBOL(machine_is_compatible);
4868 -EXPORT_SYMBOL(find_pci_device_OFnode);
4869 -EXPORT_SYMBOL(find_all_nodes);
4870 -EXPORT_SYMBOL(get_property);
4871 -#endif /* CONFIG_MBX */
4872 #ifdef CONFIG_POWERMAC
4873 EXPORT_SYMBOL(adb_request);
4874 EXPORT_SYMBOL(adb_register);
4875 @@ -227,21 +200,25 @@
4876 EXPORT_SYMBOL(pmu_enable_irled);
4877 #endif /* CONFIG_PMAC_PBOOK */
4878 #ifdef CONFIG_POWERMAC
4879 +EXPORT_SYMBOL(abort);
4880 +EXPORT_SYMBOL(find_devices);
4881 +EXPORT_SYMBOL(find_type_devices);
4882 +EXPORT_SYMBOL(find_compatible_devices);
4883 +EXPORT_SYMBOL(find_path_device);
4884 +EXPORT_SYMBOL(find_phandle);
4885 +EXPORT_SYMBOL(device_is_compatible);
4886 +EXPORT_SYMBOL(machine_is_compatible);
4887 +EXPORT_SYMBOL(find_pci_device_OFnode);
4888 +EXPORT_SYMBOL(get_property);
4889 EXPORT_SYMBOL(pci_io_base);
4890 -EXPORT_SYMBOL(pci_dev_io_base);
4891 -EXPORT_SYMBOL(pci_dev_mem_base);
4892 EXPORT_SYMBOL(pci_device_loc);
4893 EXPORT_SYMBOL(feature_set);
4894 EXPORT_SYMBOL(feature_clear);
4895 EXPORT_SYMBOL(feature_test);
4896 EXPORT_SYMBOL(feature_set_gmac_power);
4897 EXPORT_SYMBOL(feature_set_gmac_phy_reset);
4898 -EXPORT_SYMBOL(feature_set_usb_power);
4899 -EXPORT_SYMBOL(feature_set_firewire_power);
4900 EXPORT_SYMBOL(nvram_read_byte);
4901 EXPORT_SYMBOL(nvram_write_byte);
4902 -EXPORT_SYMBOL(pmac_xpram_read);
4903 -EXPORT_SYMBOL(pmac_xpram_write);
4905 EXPORT_SYMBOL(note_scsi_host);
4906 #endif /* CONFIG_SCSI */
4907 diff -urN linux.orig/arch/ppc/kernel/prep_pci.c linux/arch/ppc/kernel/prep_pci.c
4908 --- linux.orig/arch/ppc/kernel/prep_pci.c Sun Mar 25 18:31:49 2001
4909 +++ linux/arch/ppc/kernel/prep_pci.c Thu Jul 11 15:43:29 2002
4913 #include <linux/types.h>
4914 -#include <linux/string.h>
4915 #include <linux/pci.h>
4916 #include <linux/kernel.h>
4917 #include <linux/init.h>
4919 #include <asm/residual.h>
4920 #include <asm/processor.h>
4921 #include <asm/irq.h>
4922 +#include <asm/irq-compat.h>
4923 #include <asm/machdep.h>
4926 -#include "open_pic.h"
4928 #define MAX_DEVNR 22
4931 unsigned char *Motherboard_routes;
4932 void (*Motherboard_non0)(struct pci_dev *);
4934 -void Powerplus_Map_Non0(struct pci_dev *);
4935 +void Mesquite_Map_Non0(struct pci_dev *);
4937 /* Used for Motorola to store system config register */
4938 static unsigned long *ProcInfo;
4940 +extern void chrp_do_IRQ(struct pt_regs *,int , int);
4942 /* Tables for known hardware */
4944 /* Motorola PowerStackII - Utah */
4945 @@ -508,51 +509,6 @@
4949 -/* Motorola PowerPlus architecture PCI IRQ tables */
4950 -/* Interrupt line values for INTA-D on primary/secondary MPIC inputs */
4952 -struct powerplus_irq_list
4954 - unsigned char primary[4]; /* INT A-D */
4955 - unsigned char secondary[4]; /* INT A-D */
4959 - * For standard PowerPlus boards, bus 0 PCI INTs A-D are routed to
4960 - * OpenPIC inputs 9-12. PCI INTs A-D from the on board P2P bridge
4961 - * are routed to OpenPIC inputs 5-8. These values are offset by
4962 - * 16 in the table to reflect the Linux kernel interrupt value.
4964 -struct powerplus_irq_list Powerplus_pci_IRQ_list =
4971 - * For the MCP750 (system slot board), bus 0 PCI INTs A-D are routed
4972 - * to OpenPIC inputs 8-11. PCI INTs A-D from the on board P2P bridge
4973 - * are routed to OpenPIC inputs 12-15. These values are offset by 16
4974 - * in the table to reflect the Linux kernel interrupt value.
4976 -struct powerplus_irq_list Mesquite_pci_IRQ_list =
4983 - * This table represents the standard PCI swizzle defined in the
4984 - * PCI bus specification.
4986 -static unsigned char prep_pci_intpins[4][4] =
4988 - { 1, 2, 3, 4}, /* Buses 0, 4, 8, ... */
4989 - { 2, 3, 4, 1}, /* Buses 1, 5, 9, ... */
4990 - { 3, 4, 1, 2}, /* Buses 2, 6, 10 ... */
4991 - { 4, 1, 2, 3}, /* Buses 3, 7, 11 ... */
4994 /* We have to turn on LEVEL mode for changed IRQ's */
4995 /* All PCI IRQ's need to be level mode, so this should be something
4996 * other than hard-coded as well... IRQ's are individually mappable
4998 #define MOT_RAVEN_PRESENT 0x1
4999 #define MOT_HAWK_PRESENT 0x2
5001 -int mot_entry = -1;
5002 +/* Keyboard present flag */
5003 +int prep_kbd_present = 1; /* Keyboard present by default */
5008 OpenPIC_InitSenses = mvme2600_openpic_initsenses;
5009 OpenPIC_NumInitSenses = sizeof(mvme2600_openpic_initsenses);
5011 - ppc_md.do_IRQ = open_pic_do_IRQ;
5012 + ppc_md.do_IRQ = chrp_do_IRQ;
5014 /* If raven is present on Motorola store the system config register
5016 @@ -795,17 +752,13 @@
5021 - * If a Motorola MVME2300, 2400, or MCPN750 board is detected
5022 - * disable keyboard controller initialization to avoid system
5024 + /* This is a hack. If this is a 2300 or 2400 mot board then there is
5025 + * no keyboard controller and we have to indicate that.
5027 base_mod = inb(MOTOROLA_BASETYPE_REG);
5028 if ((MotMPIC == MOT_HAWK_PRESENT) || (base_mod == 0xF9) ||
5029 - (base_mod == 0xFA) || (base_mod == 0xE1)) {
5030 - ppc_md.kbd_leds = NULL;
5031 - ppc_md.kbd_init_hw = NULL;
5033 + (base_mod == 0xFA) || (base_mod == 0xE1))
5034 + prep_kbd_present = 0;
5038 @@ -819,35 +772,33 @@
5040 unsigned char *routes;
5041 void (*map_non0_bus)(struct pci_dev *); /* For boards with more than bus 0 devices. */
5042 - struct powerplus_irq_list *pci_irq_list; /* List of PCI MPIC inputs */
5043 - unsigned char secondary_bridge_devfn; /* devfn of secondary bus transparent bridge */
5045 - {0x300, 0x00, 0x00, "MVME 2400", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5046 - {0x010, 0x00, 0x00, "Genesis", Genesis_pci_IRQ_map, Genesis_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5047 - {0x020, 0x00, 0x00, "Powerstack (Series E)", Comet_pci_IRQ_map, Comet_pci_IRQ_routes, NULL, NULL, 0x00},
5048 - {0x040, 0x00, 0x00, "Blackhawk (Powerstack)", Blackhawk_pci_IRQ_map, Blackhawk_pci_IRQ_routes, NULL, NULL, 0x00},
5049 - {0x050, 0x00, 0x00, "Omaha (PowerStack II Pro3000)", Omaha_pci_IRQ_map, Omaha_pci_IRQ_routes, NULL, NULL, 0x00},
5050 - {0x060, 0x00, 0x00, "Utah (Powerstack II Pro4000)", Utah_pci_IRQ_map, Utah_pci_IRQ_routes, NULL, NULL, 0x00},
5051 - {0x0A0, 0x00, 0x00, "Powerstack (Series EX)", Comet2_pci_IRQ_map, Comet2_pci_IRQ_routes, NULL, NULL, 0x00},
5052 - {0x1E0, 0xE0, 0x00, "Mesquite cPCI (MCP750)", Mesquite_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Mesquite_pci_IRQ_list, 0x00},
5053 - {0x1E0, 0xE1, 0x00, "Sitka cPCI (MCPN750)", Sitka_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5054 - {0x1E0, 0xE2, 0x00, "Mesquite cPCI (MCP750) w/ HAC", Mesquite_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Mesquite_pci_IRQ_list, 0xC0},
5055 - {0x1E0, 0xF6, 0x80, "MTX Plus", MTXplus_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xA0},
5056 - {0x1E0, 0xF6, 0x81, "Dual MTX Plus", MTXplus_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xA0},
5057 - {0x1E0, 0xF7, 0x80, "MTX wo/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5058 - {0x1E0, 0xF7, 0x81, "Dual MTX wo/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5059 - {0x1E0, 0xF8, 0x80, "MTX w/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5060 - {0x1E0, 0xF8, 0x81, "Dual MTX w/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5061 - {0x1E0, 0xF9, 0x00, "MVME 2300", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5062 - {0x1E0, 0xFA, 0x00, "MVME 2300SC/2600", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5063 - {0x1E0, 0xFB, 0x00, "MVME 2600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5064 - {0x1E0, 0xFC, 0x00, "MVME 2600/2700 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5065 - {0x1E0, 0xFD, 0x80, "MVME 3600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5066 - {0x1E0, 0xFD, 0x81, "MVME 4600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5067 - {0x1E0, 0xFE, 0x80, "MVME 3600 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5068 - {0x1E0, 0xFE, 0x81, "MVME 4600 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5069 - {0x1E0, 0xFF, 0x00, "MVME 1600-001 or 1600-011", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL, NULL, 0x00},
5070 - {0x000, 0x00, 0x00, "", NULL, NULL, NULL, 0x00}
5071 + {0x300, 0x00, 0x00, "MVME 2400", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5072 + {0x010, 0x00, 0x00, "Genesis", Genesis_pci_IRQ_map, Genesis_pci_IRQ_routes, NULL},
5073 + {0x020, 0x00, 0x00, "Powerstack (Series E)", Comet_pci_IRQ_map, Comet_pci_IRQ_routes, NULL},
5074 + {0x040, 0x00, 0x00, "Blackhawk (Powerstack)", Blackhawk_pci_IRQ_map, Blackhawk_pci_IRQ_routes, NULL},
5075 + {0x050, 0x00, 0x00, "Omaha (PowerStack II Pro3000)", Omaha_pci_IRQ_map, Omaha_pci_IRQ_routes, NULL},
5076 + {0x060, 0x00, 0x00, "Utah (Powerstack II Pro4000)", Utah_pci_IRQ_map, Utah_pci_IRQ_routes, NULL},
5077 + {0x0A0, 0x00, 0x00, "Powerstack (Series EX)", Comet2_pci_IRQ_map, Comet2_pci_IRQ_routes, NULL},
5078 + {0x1E0, 0xE0, 0x00, "Mesquite cPCI (MCP750)", Mesquite_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5079 + {0x1E0, 0xE1, 0x00, "Sitka cPCI (MCPN750)", Sitka_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5080 + {0x1E0, 0xE2, 0x00, "Mesquite cPCI (MCP750) w/ HAC", Mesquite_pci_IRQ_map, Raven_pci_IRQ_routes, Mesquite_Map_Non0},
5081 + {0x1E0, 0xF6, 0x80, "MTX Plus", MTXplus_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5082 + {0x1E0, 0xF6, 0x81, "Dual MTX Plus", MTXplus_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5083 + {0x1E0, 0xF7, 0x80, "MTX wo/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5084 + {0x1E0, 0xF7, 0x81, "Dual MTX wo/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5085 + {0x1E0, 0xF8, 0x80, "MTX w/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5086 + {0x1E0, 0xF8, 0x81, "Dual MTX w/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5087 + {0x1E0, 0xF9, 0x00, "MVME 2300", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5088 + {0x1E0, 0xFA, 0x00, "MVME 2300SC/2600", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5089 + {0x1E0, 0xFB, 0x00, "MVME 2600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5090 + {0x1E0, 0xFC, 0x00, "MVME 2600/2700 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5091 + {0x1E0, 0xFD, 0x80, "MVME 3600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5092 + {0x1E0, 0xFD, 0x81, "MVME 4600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5093 + {0x1E0, 0xFE, 0x80, "MVME 3600 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5094 + {0x1E0, 0xFE, 0x81, "MVME 4600 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5095 + {0x1E0, 0xFF, 0x00, "MVME 1600-001 or 1600-011", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5096 + {0x000, 0x00, 0x00, "", NULL, NULL, NULL}
5099 __initfunc(unsigned long prep_route_pci_interrupts(void))
5101 unsigned char cpu_type;
5102 unsigned char base_mod;
5104 + int mot_entry = -1;
5106 cpu_type = inb(MOTOROLA_CPUTYPE_REG) & 0xF0;
5107 base_mod = inb(MOTOROLA_BASETYPE_REG);
5108 @@ -1038,91 +990,91 @@
5113 - * Remove a device from the kernel PCI device list based on its
5114 - * devfn identifier.
5118 -prep_exclude_pci_device(unsigned char devfn)
5120 +static unsigned int pci_localpirqs[4] =
5122 - struct pci_dev *dev, *pdev = NULL;
5129 - /* Walk the pci device list */
5130 - for(dev=pci_devices; dev; dev=dev->next) {
5131 - if (dev->devfn == devfn)
5134 - * If we find a matching device, adjust
5135 - * the list to remove the device.
5138 - pdev->next = dev->next;
5140 - pci_devices = dev->next;
5141 +static unsigned int pci_remotepirqs[4] =
5154 +static unsigned int pci_remotedev = 0xc0;
5157 -Powerplus_Map_Non0(struct pci_dev *dev)
5158 +Mesquite_Map_Non0(struct pci_dev *pdev)
5160 - struct pci_bus *pbus; /* Parent bus structure pointer */
5161 - struct pci_dev *tdev; /* Temporary device structure */
5162 - unsigned int devnum; /* Accumulated device number */
5163 - unsigned char intline; /* Linux interrupt value */
5164 - unsigned char intpin; /* PCI interrupt pin */
5166 - /* Check for valid PCI dev pointer */
5167 - if (dev == NULL) return;
5169 - /* Fill our temporary device, and get the device number */
5171 - devnum = PCI_SLOT(tdev->devfn);
5173 - /* Read the interrupt pin of the device and adjust for indexing */
5174 - pcibios_read_config_byte(tdev->bus->number, tdev->devfn,
5175 - PCI_INTERRUPT_PIN, &intpin);
5176 + struct pci_bus *pbus; /* Parent Bus Structure Pointer */
5177 + unsigned int devnum; /* Accumulated Device Number */
5178 + unsigned int irq; /* IRQ Value */
5180 - /* If device doesn't request an interrupt, return */
5181 - if ( (intpin < 1) || (intpin > 4) )
5184 + ** Device Interrupt Line register initialization.
5185 + ** The IRQ line number will be generated after
5186 + ** taking into account all the PCI-2-PCI bridge
5187 + ** devices between the device and the Host Bridge.
5189 + devnum = PCI_SLOT(pdev->devfn);
5192 + while ((pbus->parent)->primary != (pbus->parent)->secondary)
5194 + devnum += PCI_SLOT((pbus->self)->devfn);
5196 + pbus = pbus->parent;
5202 + ** By default, get the PCI local domain IRQ value.
5204 + irq = pci_localpirqs[devnum];
5207 + ** Determine if the device is located in the
5208 + ** remote domain or not. We must find the
5209 + ** domain's bridge device located on bus 0.
5213 + while (pbus->primary != 0)
5214 + pbus = pbus->parent;
5218 + ** Check the device/function of domain's bridge
5219 + ** device against the remote device/function.
5220 + ** If the same, then the device is located in
5221 + ** the remote domain. Thus, get the PCI remote
5222 + ** domain IRQ value.
5224 + if ((pbus->self)->devfn == pci_remotedev)
5225 + irq = pci_remotepirqs[devnum];
5227 - /* Walk up to bus 0, adjusting the interrupt pin for the standard
5228 - PCI bus swizzle. */
5230 - intpin = (prep_pci_intpins[devnum % 4][intpin]) - 1;
5231 - pbus = tdev->bus; /* up one level */
5232 - tdev = pbus->self;
5233 - devnum = PCI_SLOT(tdev->devfn);
5234 - } while(tdev->bus->number);
5236 - /* Use the primary interrupt inputs by default */
5237 - intline = mot_info[mot_entry].pci_irq_list->primary[intpin];
5239 - /* If the board has secondary interrupt inputs, walk the bus and
5240 - note the devfn of the bridge from bus 0. If it is the same as
5241 - the devfn of the bus bridge with secondary inputs, use those. */
5242 - if (mot_info[mot_entry].secondary_bridge_devfn)
5244 + ** Validate the IRQ number.
5250 - while (pbus->primary != 0)
5251 - pbus = pbus->parent;
5253 - if ((pbus->self)->devfn == mot_info[mot_entry].secondary_bridge_devfn)
5254 - intline = mot_info[mot_entry].pci_irq_list->secondary[intpin];
5256 + ** Set the device's Interrupt Line register
5257 + ** to the IRQ number and save it in the
5258 + ** device's structure.
5261 + pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, (u8)irq);
5267 - /* Write calculated interrupt value to header and device list */
5268 - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, (u8)intline);
5269 - dev->irq = intline;
5273 int motopenpic_to_irq(int n)
5274 @@ -1130,7 +1082,7 @@
5278 - return(n+open_pic.irq_offset);
5279 + return(openpic_to_irq(n));
5283 @@ -1169,17 +1121,6 @@
5284 dev->devfn, 0x44, short_reg);
5287 - if ((dev = pci_find_device(PCI_VENDOR_ID_WINBOND,
5288 - PCI_DEVICE_ID_WINBOND_82C105, dev))){
5290 - /* Disable LEGIRQ mode so PCI INTs are routed to
5292 - pci_write_config_dword(dev, 0x40, 0x10ff00a1);
5294 - /* Enable LEGIRQ for PCI INT -> 8259 IRQ routing */
5295 - pci_write_config_dword(dev, 0x40, 0x10ff08a1);
5301 @@ -1197,15 +1138,6 @@
5303 prep_route_pci_interrupts();
5306 - * If MTX+, exclude the SL82C105 IDE controller so the driver
5309 - if ( _prep_type == _PREP_Motorola )
5310 - if ( strstr(mot_info[mot_entry].name, "MTX Plus") )
5311 - /* On MTX+, SL82C105 is at IDSEL 0xb function 0x1 */
5312 - prep_exclude_pci_device(PCI_DEVFN(0xb, 0x1));
5316 printk("Setting PCI interrupts for a \"%s\"\n", Motherboard_map_name);
5317 @@ -1219,7 +1151,7 @@
5318 motopenpic_to_irq(Motherboard_map[PCI_SLOT(dev->devfn)]);
5320 pcibios_write_config_byte(dev->bus->number, dev->devfn,
5321 - PCI_INTERRUPT_LINE, dev->irq);
5322 + PCI_INTERRUPT_PIN, dev->irq);
5324 if (Motherboard_non0 != NULL)
5325 Motherboard_non0(dev);
5326 diff -urN linux.orig/arch/ppc/kernel/prep_setup.c linux/arch/ppc/kernel/prep_setup.c
5327 --- linux.orig/arch/ppc/kernel/prep_setup.c Sun Mar 25 18:31:49 2001
5328 +++ linux/arch/ppc/kernel/prep_setup.c Thu Jul 11 15:46:34 2002
5330 #include <linux/timex.h>
5331 #include <linux/pci.h>
5332 #include <linux/openpic.h>
5333 -#include <linux/delay.h>
5335 #include <asm/mmu.h>
5336 #include <asm/processor.h>
5337 #include <asm/residual.h>
5339 +#include <asm/irq-compat.h>
5340 #include <asm/pgtable.h>
5341 #include <asm/ide.h>
5342 #include <asm/cache.h>
5344 #include <asm/prep_nvram.h>
5345 #include <asm/raven.h>
5346 #include <asm/keyboard.h>
5347 -#include <asm/time.h>
5348 -#include <asm/vga.h>
5352 #include "local_irq.h"
5354 #include "open_pic.h"
5355 @@ -102,12 +102,16 @@
5356 extern PTE *Hash, *Hash_end;
5357 extern unsigned long Hash_size, Hash_mask;
5358 extern int probingmem;
5359 +extern unsigned long loops_per_jiffy;
5361 #ifdef CONFIG_BLK_DEV_RAM
5362 extern int rd_doload; /* 1 = load ramdisk, 0 = don't load */
5363 extern int rd_prompt; /* 1 = prompt for ramdisk, 0 = don't prompt */
5364 extern int rd_image_start; /* starting block # of image */
5366 +#ifdef CONFIG_VGA_CONSOLE
5367 +unsigned long vgacon_remap_base;
5375 if (OpenPIC != NULL) {
5376 - open_pic.irq_offset = 16;
5377 for ( i = 16 ; i < 36 ; i++ )
5378 irq_desc[i].ctl = &open_pic;
5380 @@ -615,14 +618,8 @@
5381 irq_desc[i].ctl = &i8259_pic;
5384 - request_irq(OPENPIC_VEC_IPI, openpic_ipi_action,
5385 + request_irq(openpic_to_irq(OPENPIC_VEC_SPURIOUS), openpic_ipi_action,
5387 - request_irq(OPENPIC_VEC_IPI+1, openpic_ipi_action,
5388 - 0, "IPI1 (invalidate TLB)", 0);
5389 - request_irq(OPENPIC_VEC_IPI+2, openpic_ipi_action,
5390 - 0, "IPI2 (stop CPU)", 0);
5391 - request_irq(OPENPIC_VEC_IPI+3, openpic_ipi_action,
5392 - 0, "IPI3 (reschedule)", 0);
5393 #endif /* __SMP__ */
5396 diff -urN linux.orig/arch/ppc/kernel/prep_time.c linux/arch/ppc/kernel/prep_time.c
5397 --- linux.orig/arch/ppc/kernel/prep_time.c Sun Mar 25 18:31:49 2001
5398 +++ linux/arch/ppc/kernel/prep_time.c Thu Jul 11 15:43:29 2002
5400 #include <asm/prep_nvram.h>
5401 #include <asm/mk48t59.h>
5403 -#include <asm/time.h>
5407 * The motorola uses the m48t18 rtc (includes DS1643) whose registers
5408 diff -urN linux.orig/arch/ppc/kernel/process.c linux/arch/ppc/kernel/process.c
5409 --- linux.orig/arch/ppc/kernel/process.c Sun Mar 25 18:31:49 2001
5410 +++ linux/arch/ppc/kernel/process.c Thu Jul 11 15:43:29 2002
5412 #include <asm/mmu_context.h>
5414 int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs);
5415 -int dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs);
5416 extern unsigned long _get_SP(void);
5418 struct task_struct *last_task_used_math = NULL;
5419 -struct task_struct *last_task_used_altivec = NULL;
5420 static struct vm_area_struct init_mmap = INIT_MMAP;
5421 static struct fs_struct init_fs = INIT_FS;
5422 static struct files_struct init_files = INIT_FILES;
5427 -#ifdef CONFIG_ALTIVEC
5429 -dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs)
5431 - if (regs->msr & MSR_VEC)
5432 - giveup_altivec(current);
5433 - memcpy(vrregs, ¤t->tss.vr[0], sizeof(*vrregs));
5438 -enable_kernel_altivec(void)
5441 - if (current->tss.regs && (current->tss.regs->msr & MSR_VEC))
5442 - giveup_altivec(current);
5444 - giveup_altivec(NULL); /* just enable AltiVec for kernel - force */
5446 - giveup_altivec(last_task_used_altivec);
5447 -#endif /* __SMP __ */
5448 - printk("MSR_VEC in enable_altivec_kernel\n");
5450 -#endif /* CONFIG_ALTIVEC */
5453 enable_kernel_fp(void)
5455 @@ -221,53 +194,22 @@
5456 _enable_interrupts(s);
5464 -void print_bits(unsigned int val, struct bits *bits)
5466 - const char *sep = "";
5469 - for (; bits->bit != 0; ++bits) {
5470 - if (val & bits->bit) {
5471 - printk("%s%s", sep, bits->name);
5478 -struct bits msr_bits[] = {
5489 -void show_regs(struct pt_regs *regs)
5490 +void show_regs(struct pt_regs * regs)
5494 printk("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx\n",
5495 regs->nip, regs->xer, regs->link, regs,regs->trap);
5496 - printk("MSR: %08lx ", regs->msr);
5497 - print_bits(regs->msr, msr_bits);
5499 + printk("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
5500 + regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
5501 + regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
5502 + regs->msr&MSR_IR ? 1 : 0,
5503 + regs->msr&MSR_DR ? 1 : 0);
5504 printk("TASK = %p[%d] '%s' mm->pgd %p ",
5505 current, current->pid, current->comm, current->mm->pgd);
5506 printk("Last syscall: %ld ", current->tss.last_syscall);
5507 - if (last_task_used_math)
5508 - printk("\nlast math %p", last_task_used_math);
5509 - if (last_task_used_altivec)
5510 - printk("\nlast altivec %p", last_task_used_altivec);
5512 + printk("\nlast math %p", last_task_used_math);
5515 printk(" CPU: %d last CPU: %d", current->processor,current->last_processor);
5516 #endif /* __SMP__ */
5517 @@ -314,16 +256,12 @@
5519 if (last_task_used_math == current)
5520 last_task_used_math = NULL;
5521 - if (last_task_used_altivec == current)
5522 - last_task_used_altivec = NULL;
5525 void flush_thread(void)
5527 if (last_task_used_math == current)
5528 last_task_used_math = NULL;
5529 - if (last_task_used_altivec == current)
5530 - last_task_used_altivec = NULL;
5534 @@ -381,19 +319,6 @@
5535 if (regs->msr & MSR_FP)
5536 giveup_fpu(current);
5538 -#ifdef CONFIG_ALTIVEC
5540 - * copy altiVec info - assume lazy altiVec switch
5543 - if (regs->msr & MSR_VEC)
5544 - giveup_altivec(current);
5546 - memcpy(&p->tss.vr, ¤t->tss.vr, sizeof(p->tss.vr));
5547 - p->tss.vscr = current->tss.vscr;
5548 - childregs->msr &= ~MSR_VEC;
5549 -#endif /* CONFIG_ALTIVEC */
5551 memcpy(&p->tss.fpr, ¤t->tss.fpr, sizeof(p->tss.fpr));
5552 p->tss.fpscr = current->tss.fpscr;
5553 childregs->msr &= ~MSR_FP;
5555 shove_aux_table(sp);
5556 if (last_task_used_math == current)
5557 last_task_used_math = 0;
5558 - if (last_task_used_altivec == current)
5559 - last_task_used_altivec = 0;
5560 current->tss.fpscr = 0;
5563 @@ -516,10 +439,6 @@
5565 if (regs->msr & MSR_FP)
5566 giveup_fpu(current);
5567 -#ifdef CONFIG_ALTIVEC
5568 - if (regs->msr & MSR_VEC)
5569 - giveup_altivec(current);
5570 -#endif /* CONFIG_ALTIVEC */
5571 error = do_execve(filename, (char **) a1, (char **) a2, regs);
5574 diff -urN linux.orig/arch/ppc/kernel/prom.c linux/arch/ppc/kernel/prom.c
5575 --- linux.orig/arch/ppc/kernel/prom.c Sun Mar 25 18:37:30 2001
5576 +++ linux/arch/ppc/kernel/prom.c Thu Jul 11 15:43:29 2002
5578 #include <linux/string.h>
5579 #include <linux/init.h>
5580 #include <linux/version.h>
5581 -#include <linux/fs.h>
5582 -#include <linux/console.h>
5583 #include <asm/spinlock.h>
5584 #include <asm/prom.h>
5585 #include <asm/page.h>
5586 #include <asm/processor.h>
5587 #include <asm/irq.h>
5588 +#include <asm/irq-compat.h>
5590 #include <asm/smp.h>
5591 #include <asm/bootx.h>
5592 #include <asm/system.h>
5593 #include <asm/gemini.h>
5594 -#include <asm/linux_logo.h>
5595 -#include <asm/mmu.h>
5596 -#include <asm/pgtable.h>
5597 -#include <asm/adb.h>
5598 -#include <asm/pmu.h>
5601 * Properties whose value is longer than this get excluded from our
5602 * copy of the device tree. This way we don't waste space storing
5603 * things like "driver,AAPL,MacOS,PowerPC" properties.
5606 #define MAX_PROPERTY_LENGTH 1024
5610 char *of_stdout_device = 0;
5612 prom_entry prom = 0;
5613 -ihandle prom_chosen = 0, prom_stdout = 0, prom_disp_node = 0;
5614 +ihandle prom_chosen = 0, prom_stdout = 0;
5615 int prom_version = 0;
5617 extern char *klimit;
5619 char *bootdevice = 0;
5621 -unsigned int rtas_data = 0; /* physical pointer */
5622 +unsigned int rtas_data = 0; /* virtual pointer */
5623 unsigned int rtas_entry = 0; /* physical pointer */
5624 unsigned int rtas_size = 0;
5625 unsigned int old_rtas = 0;
5627 -/* Set for a newworld machine */
5628 -int use_of_interrupt_tree = 0;
5629 -int pmac_newworld = 0;
5631 static struct device_node *allnodes = 0;
5633 -#ifdef CONFIG_BOOTX_TEXT
5636 - * The VGA font is in the _pmac section. Can't this cause problems with CHRP
5637 - * using some of the prom_xxxx functions ?
5638 - * All this need to be moved in a separate source file anyway
5641 static void clearscreen(void);
5642 static void flushscreen(void);
5644 +#ifdef CONFIG_BOOTX_TEXT
5646 void drawchar(char c);
5647 void drawstring(const char *c);
5648 -void drawhex(unsigned long v);
5649 +static void drawhex(unsigned long v);
5650 static void scrollscreen(void);
5651 -static void prepare_disp_BAT(void);
5652 -static void boot_console_write(struct console *co, const char *s,
5655 static void draw_byte(unsigned char c, long locX, long locY);
5656 -static void draw_byte_32(unsigned char *bits, unsigned long *base, int rb);
5657 -static void draw_byte_16(unsigned char *bits, unsigned long *base, int rb);
5658 -static void draw_byte_8(unsigned char *bits, unsigned long *base, int rb);
5660 -/* We want those in the data section */
5661 -static long g_loc_X = 0;
5662 -static long g_loc_Y = 0;
5663 -static long g_max_loc_X = 0;
5664 -static long g_max_loc_Y = 0;
5666 -unsigned long disp_BATL = 0;
5667 -unsigned long disp_BATU = 0;
5668 +static void draw_byte_32(unsigned char *bits, unsigned long *base);
5669 +static void draw_byte_16(unsigned char *bits, unsigned long *base);
5670 +static void draw_byte_8(unsigned char *bits, unsigned long *base);
5672 +static long g_loc_X;
5673 +static long g_loc_Y;
5674 +static long g_max_loc_X;
5675 +static long g_max_loc_Y;
5677 #define cmapsz (16*256)
5679 static unsigned char vga_font[cmapsz];
5681 -static struct console boot_cons = {
5683 - boot_console_write,
5694 -static int boot_cons_registered = 0;
5696 -#endif /* CONFIG_BOOTX_TEXT */
5700 static void *call_prom(const char *service, int nargs, int nret, ...);
5701 @@ -175,25 +138,15 @@
5702 unsigned long, struct device_node ***);
5703 static unsigned long finish_node(struct device_node *, unsigned long,
5705 -static unsigned long finish_node_interrupts(struct device_node *, unsigned long);
5706 static unsigned long check_display(unsigned long);
5707 static int prom_next_node(phandle *);
5708 static void *early_get_property(unsigned long, unsigned long, char *);
5710 -#ifdef CONFIG_BOOTX_TEXT
5711 -static void setup_disp_fake_bi(ihandle dp);
5712 -static void prom_welcome(boot_infos_t* bi, unsigned long phys);
5715 extern void enter_rtas(void *);
5716 extern unsigned long reloc_offset(void);
5718 extern char cmd_line[512]; /* XXX */
5719 boot_infos_t *boot_infos = 0; /* init it so it's in data segment not bss */
5720 -#ifdef CONFIG_BOOTX_TEXT
5721 -boot_infos_t *disp_bi = 0;
5722 -boot_infos_t fake_bi = {0,};
5726 * prom_init() is called very early on, before the kernel text
5728 return prom_args.args[nargs];
5734 prom_print(const char *msg)
5737 if (RELOC(prom_stdout) == 0)
5739 #ifdef CONFIG_BOOTX_TEXT
5740 - if (RELOC(disp_bi) != 0)
5741 + if (RELOC(boot_infos) != 0)
5745 @@ -307,22 +260,6 @@
5750 -prom_print_hex(unsigned int v)
5755 - for (i = 0; i < 8; ++i) {
5756 - c = (v >> ((7-i)*4)) & 0xf;
5757 - c += (c >= 10)? ('a' - 10): '0';
5765 unsigned long smp_ibm_chrp_hack __initdata = 0;
5770 char type[16], *path;
5774 ihandle prom_rtas, prom_mmu, prom_op;
5775 unsigned long offset = reloc_offset();
5776 @@ -365,19 +301,22 @@
5777 unsigned long space;
5778 unsigned long ptr, x;
5780 +#ifdef CONFIG_BOOTX_TEXT
5781 + unsigned long flags;
5784 RELOC(boot_infos) = PTRUNRELOC(bi);
5785 if (!BOOT_INFO_IS_V2_COMPATIBLE(bi))
5786 bi->logicalDisplayBase = 0;
5790 #ifdef CONFIG_BOOTX_TEXT
5793 RELOC(g_max_loc_X) = (bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) / 8;
5794 RELOC(g_max_loc_Y) = (bi->dispDeviceRect[3] - bi->dispDeviceRect[1]) / 16;
5795 - RELOC(disp_bi) = PTRUNRELOC(bi);
5799 /* Test if boot-info is compatible. Done only in config CONFIG_BOOTX_TEXT since
5800 there is nothing much we can do with an incompatible version, except display
5801 a message and eventually hang the processor...
5802 @@ -388,10 +327,24 @@
5803 if (!BOOT_INFO_IS_COMPATIBLE(bi))
5804 prom_print(RELOC(" !!! WARNING - Incompatible version of BootX !!!\n\n\n"));
5806 - prom_welcome(bi, phys);
5807 + prom_print(RELOC("Welcome to Linux, kernel " UTS_RELEASE "\n"));
5808 + prom_print(RELOC("\nstarted at : 0x"));
5809 + drawhex(reloc_offset() + KERNELBASE);
5810 + prom_print(RELOC("\nlinked at : 0x"));
5811 + drawhex(KERNELBASE);
5812 + prom_print(RELOC("\nframe buffer at : 0x"));
5813 + drawhex((unsigned long)bi->dispDeviceBase);
5814 + prom_print(RELOC(" (phys), 0x"));
5815 + drawhex((unsigned long)bi->logicalDisplayBase);
5816 + prom_print(RELOC(" (log)"));
5817 + prom_print(RELOC("\nMSR : 0x"));
5818 + __asm__ __volatile__ ("mfmsr %0" : "=r" ((flags)) : : "memory");
5820 + prom_print(RELOC("\n\n"));
5822 + /* Out of the #if/#endif since it flushes the clearscreen too */
5824 -#endif /* CONFIG_BOOTX_TEXT */
5827 /* New BootX enters kernel with MMU off, i/os are not allowed
5828 here. This hack will have been done by the boostrap anyway.
5833 #ifdef CONFIG_BOOTX_TEXT
5834 - prepare_disp_BAT();
5835 prom_print(RELOC("booting...\n"));
5838 @@ -470,15 +422,12 @@
5840 sz = (int)call_prom(RELOC("getprop"), 4, 1, prom_op, RELOC("model"), model, 64);
5842 - if ( strncmp(model,RELOC("IBM"),3) ) {
5844 - for (c = model; *c; c++)
5845 - if (*c >= '0' && *c <= '9') {
5846 - RELOC(prom_version) = *c - '0';
5852 + for (c = model; *c; c++)
5853 + if (*c >= '0' && *c <= '9') {
5854 + RELOC(prom_version) = *c - '0';
5859 if (RELOC(prom_version) >= 3)
5860 @@ -498,6 +447,15 @@
5861 RELOC(bootdevice) = PTRUNRELOC(d);
5862 mem = ALIGN(mem + strlen(d) + 1);
5865 + mem = check_display(mem);
5867 + prom_print(RELOC("copying OF device tree..."));
5868 + mem = copy_device_tree(mem, mem + (1<<20));
5869 + prom_print(RELOC("done\n"));
5872 + RELOC(klimit) = (char *) (mem - offset);
5874 prom_rtas = call_prom(RELOC("finddevice"), 1, 1, RELOC("/rtas"));
5875 if (prom_rtas != (void *) -1) {
5876 @@ -509,14 +467,18 @@
5877 RELOC(rtas_data) = 0;
5880 - * Ask OF for some space for RTAS.
5881 + * We do _not_ want the rtas_data inside the klimit
5882 + * boundry since it'll be squashed when we do the
5883 + * relocate of the kernel on chrp right after prom_init()
5884 + * in head.S. So, we just pick a spot in memory.
5887 - RELOC(rtas_data) = (unsigned int)
5888 - call_prom(RELOC("claim"), 3, 1, 0,
5889 - RELOC(rtas_size), 0x1000);
5890 - prom_print(RELOC("rtas at "));
5891 - prom_print_hex(RELOC(rtas_data));
5892 - prom_print(RELOC("\n"));
5894 + mem = (mem + 4095) & -4096;
5895 + RELOC(rtas_data) = mem + KERNELBASE;
5896 + mem += RELOC(rtas_size);
5898 + RELOC(rtas_data) = (6<<20) + KERNELBASE;
5900 prom_rtas = call_prom(RELOC("open"), 1, 1, RELOC("/rtas"));
5904 prom_args.args[0] = RELOC("instantiate-rtas");
5905 prom_args.args[1] = prom_rtas;
5906 - prom_args.args[2] = (void *) RELOC(rtas_data);
5907 + prom_args.args[2] = ((void *)(RELOC(rtas_data)-KERNELBASE));
5908 RELOC(prom)(&prom_args);
5909 if (prom_args.args[nargs] != 0)
5911 @@ -542,15 +504,6 @@
5912 prom_print(RELOC(" done\n"));
5915 - mem = check_display(mem);
5917 - prom_print(RELOC("copying OF device tree..."));
5918 - /* N.B. do this *after* any claims */
5919 - mem = copy_device_tree(mem, mem + (1<<20));
5920 - prom_print(RELOC("done\n"));
5922 - RELOC(klimit) = (char *) (mem - offset);
5924 /* If we are already running at 0xc0000000, we assume we were loaded by
5925 * an OF bootloader which did set a BAT for us. This breaks OF translate
5926 * so we force phys to be 0
5927 @@ -582,11 +535,6 @@
5931 -#ifdef CONFIG_BOOTX_TEXT
5932 - if (RELOC(prom_disp_node) != 0)
5933 - setup_disp_fake_bi(RELOC(prom_disp_node));
5938 * With CHRP SMP we need to use the OF to start the other
5939 @@ -607,11 +555,7 @@
5940 * is in its holding pattern code.
5944 - * This code crashes on some pmacs since the memory at 8M is not
5945 - * claim'ed and so can be unmapped. -- BenH
5949 extern void __secondary_hold(void);
5955 - for (node = 0; chrp && prom_next_node(&node);)
5956 + for (node = 0; prom_next_node(&node);)
5959 call_prom(RELOC("getprop"), 4, 1, node, RELOC("device_type"),
5960 @@ -666,132 +610,19 @@
5962 prom_print(RELOC("...failed\n"));
5964 +#endif /* CONFIG_SMP */
5967 - /* If PowerMac, then use quiesce call */
5969 + /* If OpenFirmware version >= 3, then use quiesce call */
5970 + if (RELOC(prom_version) >= 3) {
5971 prom_print(RELOC("Calling quiesce ...\n"));
5972 call_prom(RELOC("quiesce"), 0, 0);
5973 offset = reloc_offset();
5974 phys = offset + KERNELBASE;
5977 -#ifdef CONFIG_BOOTX_TEXT
5978 - if (!chrp && RELOC(disp_bi)) {
5979 - RELOC(prom_stdout) = 0;
5981 - prepare_disp_BAT();
5982 - prom_welcome(PTRRELOC(RELOC(disp_bi)), phys);
5986 - prom_print(RELOC("booting...\n"));
5990 -#ifdef CONFIG_BOOTX_TEXT
5992 -prom_welcome(boot_infos_t* bi, unsigned long phys)
5994 - unsigned long offset = reloc_offset();
5995 - unsigned long flags;
5996 - unsigned long pvr;
5998 - prom_print(RELOC("Welcome to Linux, kernel " UTS_RELEASE "\n"));
5999 - prom_print(RELOC("\nstarted at : 0x"));
6001 - prom_print(RELOC("\nlinked at : 0x"));
6002 - drawhex(KERNELBASE);
6003 - prom_print(RELOC("\nframe buffer at : 0x"));
6004 - drawhex((unsigned long)bi->dispDeviceBase);
6005 - prom_print(RELOC(" (phys), 0x"));
6006 - drawhex((unsigned long)bi->logicalDisplayBase);
6007 - prom_print(RELOC(" (log)"));
6008 - prom_print(RELOC("\nMSR : 0x"));
6009 - __asm__ __volatile__ ("mfmsr %0" : "=r" (flags));
6011 - __asm__ __volatile__ ("mfspr %0, 287" : "=r" (pvr));
6014 - prom_print(RELOC("\nHID0 : 0x"));
6015 - __asm__ __volatile__ ("mfspr %0, 1008" : "=r" (flags));
6018 - if (pvr == 8 || pvr == 12) {
6019 - prom_print(RELOC("\nICTC : 0x"));
6020 - __asm__ __volatile__ ("mfspr %0, 1019" : "=r" (flags));
6023 - prom_print(RELOC("\n\n"));
6026 -void showvalue(char *str, unsigned long val)
6033 -/* Calc BAT values for mapping the display and store them
6034 - * in disp_BATH and disp_BATL. Those values are then used
6035 - * from head.S to map the display during identify_machine()
6038 - * For now, the display is mapped in place (1:1). This should
6039 - * be changed if the display physical address overlaps
6040 - * KERNELBASE, which is fortunately not the case on any machine
6041 - * I know of. This mapping is temporary and will disappear as
6042 - * soon as the setup done by MMU_Init() is applied
6044 - * For now, we align the BAT and then map 8Mb on 601 and 16Mb
6045 - * on other PPCs. This may cause trouble if the framebuffer
6046 - * is really badly aligned, but I didn't encounter this case
6051 -prepare_disp_BAT(void)
6053 - unsigned long offset = reloc_offset();
6054 - boot_infos_t* bi = PTRRELOC(RELOC(disp_bi));
6055 - unsigned long addr = (unsigned long)bi->dispDeviceBase;
6057 - if ((_get_PVR() >> 16) != 1) {
6058 - /* 603, 604, G3, G4, ... */
6059 - addr &= 0xFF000000UL;
6060 - RELOC(disp_BATU) = addr | (BL_16M<<2) | 2;
6061 - RELOC(disp_BATL) = addr | (_PAGE_NO_CACHE | _PAGE_GUARDED | BPP_RW);
6064 - addr &= 0xFF800000UL;
6065 - RELOC(disp_BATU) = addr | (_PAGE_NO_CACHE | PP_RWXX) | 4;
6066 - RELOC(disp_BATL) = addr | BL_8M | 0x40;
6068 - bi->logicalDisplayBase = bi->dispDeviceBase;
6075 -prom_set_color(ihandle ih, int i, int r, int g, int b)
6077 - struct prom_args prom_args;
6078 - unsigned long offset = reloc_offset();
6080 - prom_args.service = RELOC("call-method");
6081 - prom_args.nargs = 6;
6082 - prom_args.nret = 1;
6083 - prom_args.args[0] = RELOC("color!");
6084 - prom_args.args[1] = ih;
6085 - prom_args.args[2] = (void *) i;
6086 - prom_args.args[3] = (void *) b;
6087 - prom_args.args[4] = (void *) g;
6088 - prom_args.args[5] = (void *) r;
6089 - RELOC(prom)(&prom_args);
6090 - return (int) prom_args.args[6];
6094 * If we have a display that we don't know how to drive,
6095 * we will want to try to execute OF's open method for it
6096 @@ -804,32 +635,11 @@
6097 static unsigned long
6098 check_display(unsigned long mem)
6104 unsigned long offset = reloc_offset();
6105 - char type[16], *path, name[32];
6106 - static unsigned char default_colors[] = {
6125 - RELOC(prom_disp_node) = 0;
6126 + char type[16], *path;
6128 for (node = 0; prom_next_node(&node); ) {
6130 @@ -837,12 +647,6 @@
6131 type, sizeof(type));
6132 if (strcmp(type, RELOC("display")) != 0)
6135 - call_prom(RELOC("getprop"), 4, 1, node, RELOC("name"),
6136 - name, sizeof(name));
6137 - if (!strcmp(name, RELOC("offscreen-display")))
6140 /* It seems OF doesn't null-terminate the path :-( */
6141 path = (char *) mem;
6142 memset(path, 0, 256);
6143 @@ -858,24 +662,6 @@
6145 prom_print(RELOC("... ok\n"));
6147 - if (RELOC(prom_disp_node) == 0)
6148 - RELOC(prom_disp_node) = node;
6150 - /* Setup a useable color table when the appropriate
6151 - * method is available. Should update this to set-colors */
6152 - for (i = 0; i < 32; i++)
6153 - if (prom_set_color(ih, i, RELOC(default_colors)[i*3],
6154 - RELOC(default_colors)[i*3+1],
6155 - RELOC(default_colors)[i*3+2]) != 0)
6158 - for (i = 0; i < LINUX_LOGO_COLORS; i++)
6159 - if (prom_set_color(ih, i + 32,
6160 - RELOC(linux_logo_red)[i],
6161 - RELOC(linux_logo_green)[i],
6162 - RELOC(linux_logo_blue)[i]) != 0)
6166 * If this display is the device that OF is using for stdout,
6167 * move it to the front of the list.
6168 @@ -892,85 +678,9 @@
6169 if (RELOC(prom_num_displays) >= FB_MAX)
6172 -#endif /* CONFIG_FB */
6176 -/* This function will enable the early boot text when doing OF booting. This
6177 - * way, xmon output should work too
6179 -#ifdef CONFIG_BOOTX_TEXT
6182 -setup_disp_fake_bi(ihandle dp)
6185 - int width = 640, height = 480, depth = 8, pitch;
6188 - unsigned long offset = reloc_offset();
6190 - prom_print(RELOC("Initing fake screen\n"));
6193 - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("depth"), &len, sizeof(len));
6195 - prom_print(RELOC("Warning: assuming display depth = 8\n"));
6199 - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("width"), &len, sizeof(len));
6202 - prom_print(RELOC("Failed to get width\n"));
6206 - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("height"), &len, sizeof(len));
6208 - if (height == 0) {
6209 - prom_print(RELOC("Failed to get height\n"));
6213 - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("linebytes"), &len, sizeof(len));
6216 - prom_print(RELOC("Failed to get pitch\n"));
6221 - address = len = 0;
6223 - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("address"), &len, sizeof(len));
6225 - if (address == 0) {
6226 - prom_print(RELOC("Failed to get address\n"));
6230 - /* kludge for valkyrie */
6231 - if (strcmp(dp->name, "valkyrie") == 0)
6232 - address += 0x1000;
6235 - RELOC(disp_bi) = &fake_bi;
6236 - bi = PTRRELOC((&fake_bi));
6237 - RELOC(g_loc_X) = 0;
6238 - RELOC(g_loc_Y) = 0;
6239 - RELOC(g_max_loc_X) = width / 8;
6240 - RELOC(g_max_loc_Y) = height / 16;
6241 - bi->logicalDisplayBase = (unsigned char *)address;
6242 - bi->dispDeviceBase = (unsigned char *)address;
6243 - bi->dispDeviceRowBytes = pitch;
6244 - bi->dispDeviceDepth = depth;
6245 - bi->dispDeviceRect[0] = bi->dispDeviceRect[1] = 0;
6246 - bi->dispDeviceRect[2] = width;
6247 - bi->dispDeviceRect[3] = height;
6253 prom_next_node(phandle *nodep)
6254 @@ -1106,18 +816,6 @@
6256 unsigned long mem = (unsigned long) klimit;
6258 - /* All newworld machines and CHRP now use the interrupt tree */
6259 - struct device_node *np = allnodes;
6260 - while(np && (_machine == _MACH_Pmac)) {
6261 - if (get_property(np, "interrupt-parent", 0)) {
6262 - pmac_newworld = 1;
6267 - if ((_machine == _MACH_chrp) || (boot_infos == 0 && pmac_newworld))
6268 - use_of_interrupt_tree = 1;
6270 mem = finish_node(allnodes, mem, NULL);
6271 printk(KERN_INFO "device tree used %lu bytes\n",
6272 mem - (unsigned long) allnodes);
6273 @@ -1158,9 +856,6 @@
6274 if (ifunc != NULL) {
6275 mem_start = ifunc(np, mem_start);
6277 - if (use_of_interrupt_tree) {
6278 - mem_start = finish_node_interrupts(np, mem_start);
6281 /* the f50 sets the name to 'display' and 'compatible' to what we
6282 * expect for the name -- Cort
6283 @@ -1207,151 +902,6 @@
6287 -/* This routine walks the interrupt tree for a given device node and gather
6288 - * all necessary informations according to the draft interrupt mapping
6289 - * for CHRP. The current version was only tested on Apple "Core99" machines
6290 - * and may not handle cascaded controllers correctly.
6293 -static unsigned long
6294 -finish_node_interrupts(struct device_node *np, unsigned long mem_start)
6296 - /* Finish this node */
6297 - unsigned int *isizep, *asizep, *interrupts, *map, *map_mask, *reg;
6299 - struct device_node *node, *parent_node;
6300 - int l, isize, ipsize, asize, map_size, regpsize;
6302 - /* Currently, we don't look at all nodes with no "interrupts" property */
6303 - interrupts = (unsigned int *)get_property(np, "interrupts", &l);
6304 - if (interrupts == NULL)
6308 - reg = (unsigned int *)get_property(np, "reg", &l);
6311 - /* We assume default interrupt cell size is 1 (bugus ?) */
6316 - /* We adjust the cell size if the current parent contains an #interrupt-cells
6318 - isizep = (unsigned int *)get_property(node, "#interrupt-cells", &l);
6322 - /* We don't do interrupt cascade (ISA) for now, we stop on the first
6323 - * controller found
6325 - if (get_property(node, "interrupt-controller", &l)) {
6327 - np->intrs = (struct interrupt_info *) mem_start;
6328 - np->n_intrs = ipsize / isize;
6329 - mem_start += np->n_intrs * sizeof(struct interrupt_info);
6330 - for (i = 0; i < np->n_intrs; ++i) {
6331 - np->intrs[i].line = *interrupts++;
6332 - np->intrs[i].sense = 0;
6334 - np->intrs[i].sense = *interrupts++;
6335 - for (j=2; j<isize; j++)
6339 - * On the CHRP LongTrail, ISA interrupts are cascaded through
6340 - * the OpenPIC. For compatibility reasons, ISA interrupts are
6341 - * numbered 0-15 and OpenPIC interrupts start at 16.
6342 - * Hence we have to fixup the interrupt numbers for sources
6343 - * that are attached to the OpenPIC and thus have an
6344 - * interrupt-controller named `open-pic'.
6346 - * FIXME: The name of the interrupt-controller node for the
6347 - * `ide' node has no name, although its parent is
6348 - * correctly specified in interrupt-map, so we check
6349 - * for a NULL name as well.
6351 - if (_machine == _MACH_chrp &&
6352 - ((node->name && !strcmp(node->name, "open-pic")) ||
6354 - for (i = 0; i < np->n_intrs; ++i)
6355 - np->intrs[i].line = np->intrs[i].line + NUM_8259_INTERRUPTS;
6359 - /* We lookup for an interrupt-map. This code can only handle one interrupt
6360 - * per device in the map. We also don't handle #address-cells in the parent
6361 - * I skip the pci node itself here, may not be necessary but I don't like it's
6365 - map = (unsigned int *)get_property(node, "interrupt-map", &l);
6369 - int i, found, temp_isize;
6371 - map_mask = (unsigned int *)get_property(node, "interrupt-map-mask", &l);
6372 - asizep = (unsigned int *)get_property(node, "#address-cells", &l);
6373 - if (asizep && l == sizeof(unsigned int))
6378 - while(map_size>0 && !found) {
6380 - for (i=0; i<asize; i++) {
6381 - unsigned int mask = map_mask ? map_mask[i] : 0xffffffff;
6382 - if (!reg || (i>=regpsize) || ((mask & *map) != (mask & reg[i])))
6387 - for (i=0; i<isize; i++) {
6388 - unsigned int mask = map_mask ? map_mask[i+asize] : 0xffffffff;
6389 - if ((mask & *map) != (mask & interrupts[i]))
6394 - parent = *((phandle *)(map));
6395 - map+=1; map_size-=1;
6396 - parent_node = find_phandle(parent);
6397 - temp_isize = isize;
6398 - if (parent_node) {
6399 - isizep = (unsigned int *)get_property(parent_node, "#interrupt-cells", &l);
6401 - temp_isize = *isizep;
6404 - map += temp_isize;
6405 - map_size-=temp_isize;
6409 - node = parent_node;
6412 - interrupts = (unsigned int *)map;
6413 - ipsize = temp_isize*1;
6417 - /* We look for an explicit interrupt-parent.
6419 - parent = (phandle *)get_property(node, "interrupt-parent", &l);
6420 - if (parent && (l == sizeof(phandle)) &&
6421 - (parent_node = find_phandle(*parent))) {
6422 - node = parent_node;
6425 - /* Default, get real parent */
6426 - node = node->parent;
6433 * When BootX makes a copy of the device tree from the MacOS
6434 * Name Registry, it is in the format we use but all of the pointers
6435 @@ -1410,9 +960,6 @@
6436 mem_start += i * sizeof(struct address_range);
6439 - if (use_of_interrupt_tree)
6443 * If the pci host bridge has an interrupt-map property,
6444 * look for our node in it.
6445 @@ -1422,28 +969,14 @@
6446 get_property(np->parent, "interrupt-map", &ml)) != 0
6447 && (ip = (int *) get_property(np, "interrupts", &l)) != 0) {
6448 unsigned int devfn = pci_addrs[0].addr.a_hi & 0xff00;
6449 - unsigned int cell_size;
6450 - struct device_node* np2;
6451 - /* This is hackish, but is only used for BootX booting */
6452 - cell_size = sizeof(struct pci_intr_map);
6455 - if (device_is_compatible(np2, "uni-north")) {
6459 - np2 = np2->parent;
6462 np->intrs = (struct interrupt_info *) mem_start;
6463 - for (i = 0; (ml -= cell_size) >= 0; ++i) {
6464 - if (imp->addr.a_hi == devfn) {
6465 - np->intrs[np->n_intrs].line = imp->intr;
6466 - np->intrs[np->n_intrs].sense = 0; /* FIXME */
6467 + for (i = 0; (ml -= sizeof(struct pci_intr_map)) >= 0; ++i) {
6468 + if (imp[i].addr.a_hi == devfn) {
6469 + np->intrs[np->n_intrs].line = imp[i].intr;
6470 + np->intrs[np->n_intrs].sense = 0;
6473 - imp = (struct pci_intr_map *)(((unsigned int)imp)
6476 if (np->n_intrs == 0)
6478 @@ -1500,9 +1033,6 @@
6479 mem_start += i * sizeof(struct address_range);
6482 - if (use_of_interrupt_tree)
6485 ip = (int *) get_property(np, "AAPL,interrupts", &l);
6487 ip = (int *) get_property(np, "interrupts", &l);
6488 @@ -1526,14 +1056,13 @@
6489 struct reg_property *rp;
6490 struct address_range *adr;
6491 unsigned long base_address;
6492 - int i, l, keylargo, *ip;
6494 struct device_node *db;
6497 for (db = np->parent; db != NULL; db = db->parent) {
6498 if (!strcmp(db->type, "mac-io") && db->n_addrs != 0) {
6499 base_address = db->addrs[0].address;
6500 - keylargo = device_is_compatible(db, "Keylargo");
6504 @@ -1553,9 +1082,6 @@
6505 mem_start += i * sizeof(struct address_range);
6508 - if (use_of_interrupt_tree)
6511 ip = (int *) get_property(np, "interrupts", &l);
6513 ip = (int *) get_property(np, "AAPL,interrupts", &l);
6514 @@ -1564,21 +1090,15 @@
6515 if (_machine == _MACH_Pmac) {
6517 np->n_intrs = l / sizeof(int);
6518 - /* Hack for BootX on Core99 */
6520 - np->n_intrs = np->n_intrs/2;
6521 for (i = 0; i < np->n_intrs; ++i) {
6522 np->intrs[i].line = *ip++;
6524 - np->intrs[i].sense = *ip++;
6526 - np->intrs[i].sense = 0;
6527 + np->intrs[i].sense = 0;
6531 np->n_intrs = l / (2 * sizeof(int));
6532 for (i = 0; i < np->n_intrs; ++i) {
6533 - np->intrs[i].line = (*ip++) + NUM_8259_INTERRUPTS;
6534 + np->intrs[i].line = openpic_to_irq(*ip++);
6535 np->intrs[i].sense = *ip++;
6538 @@ -1612,9 +1132,6 @@
6539 mem_start += i * sizeof(struct address_range);
6542 - if (use_of_interrupt_tree)
6545 ip = (int *) get_property(np, "interrupts", &l);
6547 np->intrs = (struct interrupt_info *) mem_start;
6548 @@ -1652,9 +1169,6 @@
6549 mem_start += i * sizeof(struct address_range);
6552 - if (use_of_interrupt_tree)
6555 ip = (int *) get_property(np, "AAPL,interrupts", &l);
6557 ip = (int *) get_property(np, "interrupts", &l);
6558 @@ -1711,57 +1225,6 @@
6562 -/* Finds a device node given its PCI bus number, device number
6563 - * and function number
6566 -struct device_node *
6567 -find_pci_device_OFnode(unsigned char bus, unsigned char dev_fn)
6569 - struct device_node* np;
6570 - unsigned int *reg;
6573 - for (np = allnodes; np != 0; np = np->allnext) {
6575 - struct device_node* parent = np->parent;
6577 - char *pname = (char *)get_property(parent, "name", &l);
6578 - if (pname && strcmp(pname, "mac-io") == 0) {
6582 - parent = parent->parent;
6586 - reg = (unsigned int *) get_property(np, "reg", &l);
6587 - if (reg == 0 || l < sizeof(struct reg_property))
6589 - if (((reg[0] >> 8) & 0xff) == dev_fn && ((reg[0] >> 16) & 0xff) == bus)
6596 - * Returns all nodes linked together
6599 -struct device_node *
6600 -find_all_nodes(void)
6602 - struct device_node *head, **prevp, *np;
6605 - for (np = allnodes; np != 0; np = np->allnext) {
6607 - prevp = &np->next;
6613 /* Checks if the given "compat" string matches one of the strings in
6614 * the device's "compatible" property
6616 @@ -1851,7 +1314,7 @@
6617 struct property *pp;
6619 for (pp = np->properties; pp != 0; pp = pp->next)
6620 - if (pp->name && strcmp(pp->name, name) == 0) {
6621 + if (strcmp(pp->name, name) == 0) {
6625 @@ -1963,63 +1426,18 @@
6629 -/* Indicates whether the root node has a given value in its
6630 - * compatible property.
6634 -machine_is_compatible(const char *compat)
6636 - struct device_node *root;
6638 - root = find_path_device("/");
6641 - return device_is_compatible(root, compat);
6645 -#ifdef CONFIG_BOOTX_TEXT
6647 -/* Here's a small text engine to use during early boot or for debugging purposes
6651 - * - build some kind of vgacon with it to enable early printk
6652 - * - move to a separate file
6653 - * - add a few video driver hooks to keep in sync with display
6660 map_bootx_text(void)
6662 - unsigned long base, offset, size;
6664 + if (boot_infos == 0)
6666 - base = ((unsigned long) disp_bi->dispDeviceBase) & 0xFFFFF000UL;
6667 - offset = ((unsigned long) disp_bi->dispDeviceBase) - base;
6668 - size = disp_bi->dispDeviceRowBytes * disp_bi->dispDeviceRect[3] + offset
6669 - + disp_bi->dispDeviceRect[0];
6670 - disp_bi->logicalDisplayBase = ioremap(base, size) + offset;
6675 -install_boot_console(void)
6677 - register_console(&boot_cons);
6678 - boot_cons_registered = 1;
6682 -remove_boot_console(void)
6684 - if (boot_cons_registered)
6685 - unregister_console(&boot_cons);
6686 - boot_cons_registered = 0;
6687 + boot_infos->logicalDisplayBase =
6688 + ioremap((unsigned long) boot_infos->dispDeviceBase,
6689 + boot_infos->dispDeviceRowBytes * boot_infos->dispDeviceRect[3]);
6691 +#endif /* CONFIG_XMON */
6693 /* Calc the base address of a given point (x,y) */
6695 @@ -2041,7 +1459,7 @@
6698 unsigned long offset = reloc_offset();
6699 - boot_infos_t* bi = PTRRELOC(RELOC(disp_bi));
6700 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
6701 unsigned long *base = (unsigned long *)calc_base(bi, 0, 0);
6702 unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
6703 (bi->dispDeviceDepth >> 3)) >> 2;
6704 @@ -2066,7 +1484,7 @@
6707 unsigned long offset = reloc_offset();
6708 - boot_infos_t* bi = PTRRELOC(RELOC(disp_bi));
6709 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
6710 unsigned long *base = (unsigned long *)calc_base(bi, 0, 0);
6711 unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
6712 (bi->dispDeviceDepth >> 3)) >> 2;
6713 @@ -2083,22 +1501,68 @@
6717 +/* Indicates whether the root node has a given value in its
6718 + * compatible property.
6722 +machine_is_compatible(const char *compat)
6724 + struct device_node *root;
6726 + root = find_path_device("/");
6729 + return device_is_compatible(root, compat);
6732 +/* Finds a device node given its PCI bus number, device number
6733 + * and function number
6736 +struct device_node *
6737 +find_pci_device_OFnode(unsigned char bus, unsigned char dev_fn)
6739 + struct device_node* np;
6740 + unsigned int *reg;
6743 + for (np = allnodes; np != 0; np = np->allnext) {
6745 + struct device_node* parent = np->parent;
6747 + char *pname = (char *)get_property(parent, "name", &l);
6748 + if (pname && strcmp(pname, "mac-io") == 0) {
6752 + parent = parent->parent;
6756 + reg = (unsigned int *) get_property(np, "reg", &l);
6757 + if (reg == 0 || l < sizeof(struct reg_property))
6759 + if (((reg[0] >> 8) & 0xff) == dev_fn && ((reg[0] >> 16) & 0xff) == bus)
6765 +#ifdef CONFIG_BOOTX_TEXT
6771 unsigned long offset = reloc_offset();
6772 - boot_infos_t* bi = PTRRELOC(RELOC(disp_bi));
6773 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
6774 unsigned long *src = (unsigned long *)calc_base(bi,0,16);
6775 unsigned long *dst = (unsigned long *)calc_base(bi,0,0);
6776 unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
6777 (bi->dispDeviceDepth >> 3)) >> 2;
6780 -#ifdef CONFIG_POWERMAC
6785 for (i=0; i<(bi->dispDeviceRect[3] - bi->dispDeviceRect[1] - 16); i++)
6787 unsigned long *src_ptr = src;
6788 @@ -2115,10 +1579,6 @@
6790 dst += (bi->dispDeviceRowBytes >> 2);
6793 -#ifdef CONFIG_POWERMAC
6799 @@ -2163,18 +1623,8 @@
6803 -#ifdef CONFIG_BOOTX_TEXT
6805 -static void boot_console_write(struct console *co, const char *s,
6816 drawhex(unsigned long v)
6818 static char hex_table[] = "0123456789abcdef";
6819 @@ -2196,20 +1646,19 @@
6820 draw_byte(unsigned char c, long locX, long locY)
6822 unsigned long offset = reloc_offset();
6823 - boot_infos_t* bi = PTRRELOC(RELOC(disp_bi));
6824 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
6825 unsigned char *base = calc_base(bi, locX << 3, locY << 4);
6826 unsigned char *font = &RELOC(vga_font)[((unsigned long)c) * 16];
6827 - int rb = bi->dispDeviceRowBytes;
6829 switch(bi->dispDeviceDepth) {
6831 - draw_byte_32(font, (unsigned long *)base, rb);
6832 + draw_byte_32(font, (unsigned long *)base);
6835 - draw_byte_16(font, (unsigned long *)base, rb);
6836 + draw_byte_16(font, (unsigned long *)base);
6839 - draw_byte_8(font, (unsigned long *)base, rb);
6840 + draw_byte_8(font, (unsigned long *)base);
6844 @@ -2247,8 +1696,10 @@
6848 -draw_byte_32(unsigned char *font, unsigned long *base, int rb)
6849 +draw_byte_32(unsigned char *font, unsigned long *base)
6851 + unsigned long offset = reloc_offset();
6852 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
6854 int fg = 0xFFFFFFFFUL;
6855 int bg = 0x00000000UL;
6856 @@ -2265,18 +1716,19 @@
6857 base[5] = (-((bits >> 2) & 1) & fg) ^ bg;
6858 base[6] = (-((bits >> 1) & 1) & fg) ^ bg;
6859 base[7] = (-(bits & 1) & fg) ^ bg;
6860 - base = (unsigned long *) ((char *)base + rb);
6861 + base = (unsigned long *) ((char *)base + bi->dispDeviceRowBytes);
6867 -draw_byte_16(unsigned char *font, unsigned long *base, int rb)
6868 +draw_byte_16(unsigned char *font, unsigned long *base)
6870 + unsigned long offset = reloc_offset();
6871 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
6873 int fg = 0xFFFFFFFFUL;
6874 int bg = 0x00000000UL;
6875 - unsigned long offset = reloc_offset();
6876 unsigned long *eb = RELOC(expand_bits_16);
6878 for (l = 0; l < 16; ++l)
6879 @@ -2286,18 +1738,19 @@
6880 base[1] = (eb[(bits >> 4) & 3] & fg) ^ bg;
6881 base[2] = (eb[(bits >> 2) & 3] & fg) ^ bg;
6882 base[3] = (eb[bits & 3] & fg) ^ bg;
6883 - base = (unsigned long *) ((char *)base + rb);
6884 + base = (unsigned long *) ((char *)base + bi->dispDeviceRowBytes);
6890 -draw_byte_8(unsigned char *font, unsigned long *base, int rb)
6891 +draw_byte_8(unsigned char *font, unsigned long *base)
6893 + unsigned long offset = reloc_offset();
6894 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
6896 int fg = 0x0F0F0F0FUL;
6897 int bg = 0x00000000UL;
6898 - unsigned long offset = reloc_offset();
6899 unsigned long *eb = RELOC(expand_bits_8);
6901 for (l = 0; l < 16; ++l)
6902 @@ -2305,7 +1758,7 @@
6904 base[0] = (eb[bits >> 4] & fg) ^ bg;
6905 base[1] = (eb[bits & 0xf] & fg) ^ bg;
6906 - base = (unsigned long *) ((char *)base + rb);
6907 + base = (unsigned long *) ((char *)base + bi->dispDeviceRowBytes);
6911 diff -urN linux.orig/arch/ppc/kernel/ptrace.c linux/arch/ppc/kernel/ptrace.c
6912 --- linux.orig/arch/ppc/kernel/ptrace.c Fri Nov 2 17:39:05 2001
6913 +++ linux/arch/ppc/kernel/ptrace.c Thu Jul 11 15:43:29 2002
6915 #include <asm/uaccess.h>
6916 #include <asm/page.h>
6917 #include <asm/pgtable.h>
6918 +#include <asm/pf-compat.h>
6919 #include <asm/system.h>
6922 @@ -341,10 +342,10 @@
6924 if (request == PTRACE_TRACEME) {
6925 /* are we already being traced? */
6926 - if (current->ptrace & PT_PTRACED)
6927 + if (current->flags & PF_PTRACED)
6929 /* set the ptrace bit in the process flags. */
6930 - current->ptrace |= PT_PTRACED;
6931 + current->flags |= PF_PTRACED;
6936 (current->gid != child->gid)) && !capable(CAP_SYS_PTRACE))
6938 /* the same process cannot be attached many times */
6939 - if (child->ptrace & PT_PTRACED)
6940 + if (child->flags & PF_PTRACED)
6942 - child->ptrace |= PT_PTRACED;
6943 + child->flags |= PF_PTRACED;
6945 write_lock_irqsave(&tasklist_lock, flags);
6946 if (child->p_pptr != current) {
6951 - if (!(child->ptrace & PT_PTRACED))
6952 + if (!(child->flags & PF_PTRACED))
6954 if (child->state != TASK_STOPPED) {
6955 if (request != PTRACE_KILL)
6957 if ((unsigned long) data > _NSIG)
6959 if (request == PTRACE_SYSCALL)
6960 - child->ptrace |= PT_TRACESYS;
6961 + child->flags |= PF_TRACESYS;
6963 - child->ptrace &= ~PT_TRACESYS;
6964 + child->flags &= ~PF_TRACESYS;
6965 child->exit_code = data;
6966 /* make sure the single step bit is not set. */
6967 clear_single_step(child);
6970 if ((unsigned long) data > _NSIG)
6972 - child->ptrace &= ~PT_TRACESYS;
6973 + child->flags &= ~PF_TRACESYS;
6974 set_single_step(child);
6975 child->exit_code = data;
6976 /* give it a chance to run. */
6979 if ((unsigned long) data > _NSIG)
6981 - child->ptrace &= ~(PT_PTRACED|PT_TRACESYS);
6982 + child->flags &= ~(PF_PTRACED|PF_TRACESYS);
6983 child->exit_code = data;
6984 write_lock_irqsave(&tasklist_lock, flags);
6985 REMOVE_LINKS(child);
6988 asmlinkage void syscall_trace(void)
6990 - if ((current->ptrace & (PT_PTRACED|PT_TRACESYS))
6991 - != (PT_PTRACED|PT_TRACESYS))
6992 + if ((current->flags & (PF_PTRACED|PF_TRACESYS))
6993 + != (PF_PTRACED|PF_TRACESYS))
6995 current->exit_code = SIGTRAP;
6996 current->state = TASK_STOPPED;
6997 diff -urN linux.orig/arch/ppc/kernel/setup.c linux/arch/ppc/kernel/setup.c
6998 --- linux.orig/arch/ppc/kernel/setup.c Sun Mar 25 18:31:49 2001
6999 +++ linux/arch/ppc/kernel/setup.c Thu Jul 11 15:47:12 2002
7002 #include <asm/bootx.h>
7003 #include <asm/machdep.h>
7004 -#include <asm/uaccess.h>
7006 extern void pmac_init(unsigned long r3,
7013 -extern void xmon_map_scc(void);
7016 extern boot_infos_t *boot_infos;
7017 extern char cmd_line[512];
7018 char saved_command_line[256];
7021 struct ide_machdep_calls ppc_ide_md;
7023 +#ifdef CONFIG_MAGIC_SYSRQ
7024 +unsigned long SYSRQ_KEY;
7025 +#endif /* CONFIG_MAGIC_SYSRQ */
7027 unsigned long ISA_DMA_THRESHOLD;
7028 unsigned long DMA_MODE_READ, DMA_MODE_WRITE;
7032 struct machdep_calls ppc_md;
7034 -#ifdef CONFIG_MAGIC_SYSRQ
7035 -unsigned long SYSRQ_KEY;
7036 -#endif /* CONFIG_MAGIC_SYSRQ */
7037 -#ifdef CONFIG_VGA_CONSOLE
7038 -unsigned long vgacon_remap_base;
7041 /* copy of the residual data */
7045 len += sprintf(len+buffer, "604ev5 (MachV)\n");
7048 - len += sprintf(len+buffer, "7400 (G4)\n");
7051 len += sprintf(len+buffer, "821\n");
7053 @@ -322,6 +312,14 @@
7054 bogosum += CD(loops_per_jiffy);
7059 + len += sprintf(buffer+len, "\n");
7060 + len += sprintf(buffer+len,"total bogomips\t: %lu.%02lu\n",
7061 + (bogosum+2500)/500000,
7062 + (bogosum+2500)/5000 % 100);
7063 +#endif /* __SMP__ */
7066 * Ooh's and aah's info about zero'd pages in idle task
7068 @@ -486,21 +484,15 @@
7072 -#ifdef CONFIG_POWERMAC
7074 pmac_init(r3, r4, r5, r6, r7);
7077 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_PREP)
7079 prep_init(r3, r4, r5, r6, r7);
7082 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_CHRP)
7084 chrp_init(r3, r4, r5, r6, r7);
7089 apus_init(r3, r4, r5, r6, r7);
7090 @@ -554,13 +546,12 @@
7091 /* Checks "l2cr=xxxx" command-line option */
7092 void ppc_setup_l2cr(char *str, int *ints)
7094 - if ( ((_get_PVR() >> 16) == 8) || ((_get_PVR() >> 16) == 12) )
7095 + if ( (_get_PVR() >> 16) == 8)
7097 unsigned long val = simple_strtoul(str, NULL, 0);
7098 printk(KERN_INFO "l2cr set to %lx\n", val);
7106 @@ -581,16 +572,14 @@
7107 extern unsigned long find_available_memory(void);
7108 extern unsigned long *end_of_DRAM;
7114 + extern void xmon_map_scc(void);
7118 - p = strstr(cmd_line, "xmon");
7119 - if (p != NULL && (p == cmd_line || p[-1] == ' '))
7123 + p = strstr(cmd_line, "xmon");
7124 + if (p != NULL && (p == cmd_line || p[-1] == ' '))
7126 #endif /* CONFIG_XMON */
7128 /* reboot on panic */
7129 @@ -610,15 +599,7 @@
7130 *memory_end_p = (unsigned long) end_of_DRAM;
7132 ppc_md.setup_arch(memory_start_p, memory_end_p);
7134 - sort_exception_table();
7137 -#ifndef CONFIG_POWERMAC
7138 -void note_bootable_part(kdev_t dev, int part, int goodness)
7143 void ppc_generic_ide_fix_driveid(struct hd_driveid *id)
7145 diff -urN linux.orig/arch/ppc/kernel/signal.c linux/arch/ppc/kernel/signal.c
7146 --- linux.orig/arch/ppc/kernel/signal.c Fri Nov 2 17:39:05 2001
7147 +++ linux/arch/ppc/kernel/signal.c Thu Jul 11 15:43:29 2002
7149 * modify it under the terms of the GNU General Public License
7150 * as published by the Free Software Foundation; either version
7151 * 2 of the License, or (at your option) any later version.
7155 - * Define a real-time signal frame with siginfo and ucontext
7156 - * structures (setup_rt_frame()).
7157 - * Stuck up a real-time signal frame when setting the signal
7158 - * frame with SA_SIGINFO flags.
7159 - * Add sys_rt_sigreturn() to undo the signal stack.
7161 - * Giovanna Ambrosini (ambrosini@lightning.ch)
7164 #include <linux/sched.h>
7166 #include <asm/ucontext.h>
7167 #include <asm/uaccess.h>
7168 #include <asm/pgtable.h>
7169 +#include <asm/pf-compat.h>
7173 @@ -131,6 +122,13 @@
7177 +asmlinkage int sys_rt_sigreturn(unsigned long __unused)
7179 + printk("sys_rt_sigreturn(): %s/%d not yet implemented.\n",
7180 + current->comm,current->pid);
7185 sys_sigaltstack(const stack_t *uss, stack_t *uoss)
7187 @@ -174,11 +172,13 @@
7188 * When we have signals to deliver, we set up on the
7189 * user stack, going down from the original stack pointer:
7191 - * one or more sigcontext structs with
7192 + * one or more sigcontext structs
7193 * a gap of __SIGNAL_FRAMESIZE bytes
7195 * Each of these things must be a multiple of 16 bytes in size.
7197 + * XXX ultimately we will have to stack up a siginfo and ucontext
7198 + * for each rt signal.
7201 elf_gregset_t gp_regs;
7202 @@ -189,15 +189,6 @@
7208 - unsigned long _unused[2];
7209 - struct siginfo *pinfo;
7211 - struct siginfo info;
7212 - struct ucontext uc;
7216 * Do a signal return; undo the signal stack.
7218 @@ -230,10 +221,6 @@
7219 sr = (struct sigregs *) sigctx.regs;
7220 if (regs->msr & MSR_FP )
7221 giveup_fpu(current);
7222 -#ifdef CONFIG_ALTIVEC
7223 - if (regs->msr & MSR_VEC)
7224 - giveup_altivec(current);
7225 -#endif /* CONFIG_ALTIVEC */
7226 if (copy_from_user(saved_regs, &sr->gp_regs,
7227 sizeof(sr->gp_regs)))
7229 @@ -269,91 +256,6 @@
7235 - * When we have rt signals to deliver, we set up on the
7236 - * user stack, going down from the original stack pointer:
7237 - * a sigregs struct
7238 - * one rt_sigframe struct (siginfo + ucontext)
7239 - * a gap of __SIGNAL_FRAMESIZE bytes
7241 - * Each of these things must be a multiple of 16 bytes in size.
7244 -asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
7246 - struct rt_sigframe *rt_sf;
7247 - struct sigcontext_struct sigctx;
7248 - struct sigregs *sr;
7250 - elf_gregset_t saved_regs; /* an array of ELF_NGREG unsigned longs */
7253 - unsigned long prevsp;
7255 - rt_sf = (struct rt_sigframe *)(regs->gpr[1] + __SIGNAL_FRAMESIZE);
7256 - if (copy_from_user(&sigctx, &rt_sf->uc.uc_mcontext, sizeof(sigctx))
7257 - || copy_from_user(&set, &rt_sf->uc.uc_sigmask, sizeof(set))
7258 - || copy_from_user(&st, &rt_sf->uc.uc_stack, sizeof(st)))
7260 - sigdelsetmask(&set, ~_BLOCKABLE);
7261 - spin_lock_irq(¤t->sigmask_lock);
7262 - current->blocked = set;
7263 - recalc_sigpending(current);
7264 - spin_unlock_irq(¤t->sigmask_lock);
7266 - rt_sf++; /* Look at next rt_sigframe */
7267 - if (rt_sf == (struct rt_sigframe *)(sigctx.regs)) {
7268 - /* Last stacked signal - restore registers -
7269 - * sigctx is initialized to point to the
7270 - * preamble frame (where registers are stored)
7271 - * see handle_signal()
7273 - sr = (struct sigregs *) sigctx.regs;
7274 - if (regs->msr & MSR_FP )
7275 - giveup_fpu(current);
7276 - if (copy_from_user(saved_regs, &sr->gp_regs,
7277 - sizeof(sr->gp_regs)))
7279 - saved_regs[PT_MSR] = (regs->msr & ~MSR_USERCHANGE)
7280 - | (saved_regs[PT_MSR] & MSR_USERCHANGE);
7281 - memcpy(regs, saved_regs, GP_REGS_SIZE);
7282 - if (copy_from_user(current->tss.fpr, &sr->fp_regs,
7283 - sizeof(sr->fp_regs)))
7285 - /* This function sets back the stack flags into
7286 - the current task structure. */
7287 - sys_sigaltstack(&st, NULL);
7289 - ret = regs->result;
7291 - /* More signals to go */
7292 - /* Set up registers for next signal handler */
7293 - regs->gpr[1] = (unsigned long)rt_sf - __SIGNAL_FRAMESIZE;
7294 - if (copy_from_user(&sigctx, &rt_sf->uc.uc_mcontext, sizeof(sigctx)))
7296 - sr = (struct sigregs *) sigctx.regs;
7297 - regs->gpr[3] = ret = sigctx.signal;
7298 - /* Get the siginfo */
7299 - get_user(regs->gpr[4], (unsigned long *)&rt_sf->pinfo);
7300 - /* Get the ucontext */
7301 - get_user(regs->gpr[5], (unsigned long *)&rt_sf->puc);
7302 - regs->gpr[6] = (unsigned long) rt_sf;
7304 - regs->link = (unsigned long) &sr->tramp;
7305 - regs->nip = sigctx.handler;
7306 - if (get_user(prevsp, &sr->gp_regs[PT_R1])
7307 - || put_user(prevsp, (unsigned long *) regs->gpr[1]))
7319 * Set up a signal frame.
7321 @@ -367,10 +269,6 @@
7323 if (regs->msr & MSR_FP)
7324 giveup_fpu(current);
7325 -#ifdef CONFIG_ALTIVEC
7326 - if (regs->msr & MSR_VEC)
7327 - giveup_altivec(current);
7328 -#endif /* CONFIG_ALTIVEC */
7329 if (__copy_to_user(&frame->gp_regs, regs, GP_REGS_SIZE)
7330 || __copy_to_user(&frame->fp_regs, current->tss.fpr,
7331 ELF_NFPREG * sizeof(double))
7332 @@ -400,57 +298,6 @@
7338 -setup_rt_frame(struct pt_regs *regs, struct sigregs *frame,
7339 - signed long newsp)
7341 - struct rt_sigframe *rt_sf = (struct rt_sigframe *) newsp;
7343 - /* Set up preamble frame */
7344 - if (verify_area(VERIFY_WRITE, frame, sizeof(*frame)))
7346 - if (regs->msr & MSR_FP)
7347 - giveup_fpu(current);
7348 - if (__copy_to_user(&frame->gp_regs, regs, GP_REGS_SIZE)
7349 - || __copy_to_user(&frame->fp_regs, current->tss.fpr,
7350 - ELF_NFPREG * sizeof(double))
7351 - /* Set up to return from user space.
7352 - It calls the sc exception at offset 0x9999
7353 - for sys_rt_sigreturn().
7355 - || __put_user(0x38006666UL, &frame->tramp[0]) /* li r0,0x6666 */
7356 - || __put_user(0x44000002UL, &frame->tramp[1])) /* sc */
7358 - flush_icache_range((unsigned long) &frame->tramp[0],
7359 - (unsigned long) &frame->tramp[2]);
7361 - /* Retrieve rt_sigframe from stack and
7362 - set up registers for signal handler
7364 - newsp -= __SIGNAL_FRAMESIZE;
7365 - if (put_user(regs->gpr[1], (unsigned long *)newsp)
7366 - || get_user(regs->nip, &rt_sf->uc.uc_mcontext.handler)
7367 - || get_user(regs->gpr[3], &rt_sf->uc.uc_mcontext.signal)
7368 - || get_user(regs->gpr[4], (unsigned long *)&rt_sf->pinfo)
7369 - || get_user(regs->gpr[5], (unsigned long *)&rt_sf->puc))
7372 - regs->gpr[1] = newsp;
7373 - regs->gpr[6] = (unsigned long) rt_sf;
7374 - regs->link = (unsigned long) frame->tramp;
7380 - printk("badframe in setup_rt_frame, regs=%p frame=%p newsp=%lx\n",
7381 - regs, frame, newsp);
7388 * OK, we're invoking a handler
7391 unsigned long *newspp, unsigned long frame)
7393 struct sigcontext_struct *sc;
7394 - struct rt_sigframe *rt_sf;
7396 if (regs->trap == 0x0C00 /* System Call! */
7397 && ((int)regs->result == -ERESTARTNOHAND ||
7398 @@ -468,47 +314,20 @@
7399 !(ka->sa.sa_flags & SA_RESTART))))
7400 regs->result = -EINTR;
7402 - /* Set up Signal Frame */
7403 - if (ka->sa.sa_flags & SA_SIGINFO) {
7404 - /* Put a Real Time Context onto stack */
7405 - *newspp -= sizeof(*rt_sf);
7406 - rt_sf = (struct rt_sigframe *) *newspp;
7407 - if (verify_area(VERIFY_WRITE, rt_sf, sizeof(*rt_sf)))
7410 - if (__put_user((unsigned long) ka->sa.sa_handler, &rt_sf->uc.uc_mcontext.handler)
7411 - || __put_user(&rt_sf->info, &rt_sf->pinfo)
7412 - || __put_user(&rt_sf->uc, &rt_sf->puc)
7413 - /* Put the siginfo */
7414 - || __copy_to_user(&rt_sf->info, info, sizeof(*info))
7415 - /* Create the ucontext */
7416 - || __put_user(0, &rt_sf->uc.uc_flags)
7417 - || __put_user(0, &rt_sf->uc.uc_link)
7418 - || __put_user(current->sas_ss_sp, &rt_sf->uc.uc_stack.ss_sp)
7419 - || __put_user(sas_ss_flags(regs->gpr[1]),
7420 - &rt_sf->uc.uc_stack.ss_flags)
7421 - || __put_user(current->sas_ss_size, &rt_sf->uc.uc_stack.ss_size)
7422 - || __copy_to_user(&rt_sf->uc.uc_sigmask, oldset, sizeof(*oldset))
7423 - /* mcontext.regs points to preamble register frame */
7424 - || __put_user((struct pt_regs *)frame, &rt_sf->uc.uc_mcontext.regs)
7425 - || __put_user(sig, &rt_sf->uc.uc_mcontext.signal))
7428 - /* Put another sigcontext on the stack */
7429 - *newspp -= sizeof(*sc);
7430 - sc = (struct sigcontext_struct *) *newspp;
7431 - if (verify_area(VERIFY_WRITE, sc, sizeof(*sc)))
7433 + /* Put another sigcontext on the stack */
7434 + *newspp -= sizeof(*sc);
7435 + sc = (struct sigcontext_struct *) *newspp;
7436 + if (verify_area(VERIFY_WRITE, sc, sizeof(*sc)))
7439 - if (__put_user((unsigned long) ka->sa.sa_handler, &sc->handler)
7440 - || __put_user(oldset->sig[0], &sc->oldmask)
7441 + if (__put_user((unsigned long) ka->sa.sa_handler, &sc->handler)
7442 + || __put_user(oldset->sig[0], &sc->oldmask)
7444 - || __put_user(oldset->sig[1], &sc->_unused[3])
7445 + || __put_user(oldset->sig[1], &sc->_unused[3])
7447 - || __put_user((struct pt_regs *)frame, &sc->regs)
7448 - || __put_user(sig, &sc->signal))
7451 + || __put_user((struct pt_regs *)frame, &sc->regs)
7452 + || __put_user(sig, &sc->signal))
7455 if (ka->sa.sa_flags & SA_ONESHOT)
7456 ka->sa.sa_handler = SIG_DFL;
7461 - if ((current->ptrace & PT_PTRACED) && signr != SIGKILL) {
7462 + if ((current->flags & PF_PTRACED) && signr != SIGKILL) {
7463 /* Let the debugger run. */
7464 current->exit_code = signr;
7465 current->state = TASK_STOPPED;
7466 @@ -664,10 +483,7 @@
7468 return 0; /* no signals delivered */
7470 - if (ka->sa.sa_flags & SA_SIGINFO)
7471 - setup_rt_frame(regs, (struct sigregs *) frame, newsp);
7473 - setup_frame(regs, (struct sigregs *) frame, newsp);
7474 + setup_frame(regs, (struct sigregs *) frame, newsp);
7478 diff -urN linux.orig/arch/ppc/kernel/sleep.S linux/arch/ppc/kernel/sleep.S
7479 --- linux.orig/arch/ppc/kernel/sleep.S Sun Mar 25 18:37:30 2001
7480 +++ linux/arch/ppc/kernel/sleep.S Thu Jul 11 15:43:29 2002
7483 * This file contains sleep low-level functions for PowerBook G3.
7484 - * Copyright (C) 1999 Benjamin Herrenschmidt (benh@kernel.crashing.org)
7485 + * Copyright (C) 1999 Benjamin Herrenschmidt (bh40@calva.net)
7486 * and Paul Mackerras (paulus@cs.anu.edu.au).
7488 * This program is free software; you can redistribute it and/or
7492 /* Set up stuff at address 0 */
7493 - lis r5,grackle_wake_up@ha
7494 - addi r5,r5,grackle_wake_up@l
7496 + addi r5,r5,wake_up@l
7500 @@ -124,28 +124,22 @@
7504 - /* Setup stuffs at 0x80-0x84 for Core99 */
7505 - lis r3,core99_wake_up@ha
7506 - addi r3,r3,core99_wake_up@l
7512 - * Flush the L1 data cache by reading the first 128kB of RAM
7513 + * Flush the L1 data cache by reading the first 64kB of RAM
7514 * and then flushing the same area with the dcbf instruction.
7515 * The L2 cache has already been disabled.
7517 - li r4,0x1000 /* 128kB / 32B */
7518 + li r4,0x0800 /* 64kB / 32B */
7523 - addi r4,r4,0x0020 /* Go to start of next cache line */
7524 + addi r4,r4,0x0020 /* Go to start of next cache line */
7528 - li r4,0x1000 /* 128kB / 32B */
7529 + li r4,0x0800 /* 64k */
7533 @@ -154,14 +148,6 @@
7537 -/* Turn off L1 (necessary ?) */
7539 - ori r3,r3, HID0_ICE|HID0_DCE
7540 - xori r3,r3, HID0_ICE|HID0_DCE
7546 * Set the HID0 and MSR for sleep.
7548 @@ -177,50 +163,20 @@
7557 * Here is the resume code.
7558 - * Core99 machines resume here
7559 - * r4 has the physical address of SL_PC(sp).
7565 - /* use rlwinm ... */
7566 - oris r3,r3,HID0_SLEEP@h
7567 - xoris r3,r3,HID0_SLEEP@h
7572 - /* sanitize MSR */
7574 - ori r3,r3,MSR_EE|MSR_IP
7575 - xori r3,r3,MSR_EE|MSR_IP
7581 - * Here is the resume code for older machines.
7582 * r1 has the physical address of SL_PC(sp).
7586 - /* Enable and then Flash inval the instruction cache */
7588 + /* Flash inval the instruction cache */
7590 - ori r3,r3, HID0_ICE|HID0_ICFI|HID0_DCE|HID0_DCI
7594 - xori r3,r3, HID0_ICFI|HID0_DCI
7595 + ori r3,r3, HID0_ICFI
7599 - /* Restore the remaining bits of the HID0 register. */
7601 + /* Restore the HID0 register. This turns on the L1 caches. */
7605 @@ -283,13 +239,6 @@
7606 lwz r4,SL_IBAT3+4(r1)
7609 - /* Flush all TLBs */
7611 -1: addic. r4, r4, -0x1000
7616 /* restore the MSR and turn on the MMU */
7633 diff -urN linux.orig/arch/ppc/kernel/smp.c linux/arch/ppc/kernel/smp.c
7634 --- linux.orig/arch/ppc/kernel/smp.c Sun Mar 25 18:31:49 2001
7635 +++ linux/arch/ppc/kernel/smp.c Thu Jul 11 16:28:25 2002
7637 * deal of code from the sparc and intel versions.
7639 * Support for PReP (Motorola MTX/MVME) SMP by Troy Benjegerdes
7640 - * (troy@blacklablinux.com, hozer@drgw.net)
7641 - * Support for PReP (Motorola MTX/MVME) and Macintosh G4 SMP
7642 - * by Troy Benjegerdes (hozer@drgw.net)
7643 + * (troy@microux.com, hozer@drgw.net)
7646 #include <linux/kernel.h>
7648 #include <asm/prom.h>
7649 #include <asm/gemini.h>
7650 #include <asm/residual.h>
7651 -#include <asm/time.h>
7652 -#include <asm/feature.h>
7655 #include "open_pic.h"
7657 int first_cpu_booted = 0;
7659 struct cpuinfo_PPC cpu_data[NR_CPUS];
7660 struct klock_info_struct klock_info = { KLOCK_CLEAR, 0 };
7661 volatile unsigned char active_kernel_processor = NO_PROC_ID; /* Processor holding kernel spinlock */
7664 +volatile unsigned long ipi_count;
7665 spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED;
7666 unsigned int prof_multiplier[NR_CPUS];
7667 unsigned int prof_counter[NR_CPUS];
7669 extern unsigned long *MotSave_SmpIar;
7670 extern unsigned char *MotSave_CpusState[2];
7672 -/* l2 cache stuff for dual G4 macs */
7673 -extern void core99_init_l2(void);
7675 /* register for interrupting the secondary processor on the powersurge */
7676 #define PSURGE_INTR ((volatile unsigned *)0xf80000c0)
7680 void smp_message_recv(int msg)
7682 - atomic_inc(&ipi_recv);
7691 -#ifdef CONFIG_POWERMAC
7693 * As it is now, if we're sending two message at the same time
7694 * we have race conditions on Pmac. The PowerSurge doesn't easily
7695 @@ -155,10 +148,10 @@
7699 -int psurge_smp_message[NR_CPUS];
7700 -void psurge_smp_message_recv(void)
7701 +int pmac_smp_message[NR_CPUS];
7702 +void pmac_smp_message_recv(void)
7704 - int msg = psurge_smp_message[smp_processor_id()];
7705 + int msg = pmac_smp_message[smp_processor_id()];
7707 /* clear interrupt */
7708 out_be32(PSURGE_INTR, ~0);
7710 smp_message_recv(msg);
7713 - psurge_smp_message[smp_processor_id()] = -1;
7714 + pmac_smp_message[smp_processor_id()] = -1;
7716 -#endif /* powermac */
7720 * 750's don't broadcast tlb invalidates so
7721 @@ -203,65 +196,49 @@
7722 smp_message_pass(MSG_ALL_BUT_SELF, MSG_STOP_CPU, 0, 0);
7725 -#ifdef CONFIG_POWERMAC
7726 -static void psurge_message_pass(int target, int msg, unsigned long data, int wait)
7727 +void smp_message_pass(int target, int msg, unsigned long data, int wait)
7732 - * IPI's on the Pmac are a hack but without reasonable
7733 - * IPI hardware SMP on Pmac is a hack.
7735 - * We assume here that the msg is not -1. If it is,
7736 - * the recipient won't know the message was destined
7739 - for ( i = 0; i <= smp_num_cpus ; i++ )
7740 - psurge_smp_message[i] = -1;
7744 - psurge_smp_message[smp_processor_id()] = msg;
7745 - /* fall through */
7746 - case MSG_ALL_BUT_SELF:
7747 - for ( i = 0 ; i < smp_num_cpus ; i++ )
7748 - if ( i != smp_processor_id () )
7749 - psurge_smp_message[i] = msg;
7752 - psurge_smp_message[target] = msg;
7755 - /* interrupt secondary processor */
7756 - out_be32(PSURGE_INTR, ~0);
7757 - out_be32(PSURGE_INTR, 0);
7759 - * Assume for now that the secondary doesn't send
7761 - * Could be fixed with 2.4 code from Paulus -- BenH
7763 - /* interrupt primary */
7764 - /**(volatile unsigned long *)(0xf3019000);*/
7766 -#endif /* powermac */
7768 -void smp_message_pass(int target, int msg, unsigned long data, int wait)
7770 - atomic_inc(&ipi_sent);
7772 if ( !(_machine & (_MACH_Pmac|_MACH_chrp|_MACH_prep|_MACH_gemini)) )
7776 -#ifdef CONFIG_POWERMAC
7778 - /* Hack, 2.4 does it cleanly */
7779 - if (OpenPIC == NULL) {
7780 - psurge_message_pass(target, msg, data, wait);
7782 + * IPI's on the Pmac are a hack but without reasonable
7783 + * IPI hardware SMP on Pmac is a hack.
7785 + * We assume here that the msg is not -1. If it is,
7786 + * the recipient won't know the message was destined
7789 + for ( i = 0; i <= smp_num_cpus ; i++ )
7790 + pmac_smp_message[i] = -1;
7794 + pmac_smp_message[smp_processor_id()] = msg;
7795 + /* fall through */
7796 + case MSG_ALL_BUT_SELF:
7797 + for ( i = 0 ; i < smp_num_cpus ; i++ )
7798 + if ( i != smp_processor_id () )
7799 + pmac_smp_message[i] = msg;
7802 - /* else fall through and do something sane --Troy */
7805 + pmac_smp_message[target] = msg;
7808 + /* interrupt secondary processor */
7809 + out_be32(PSURGE_INTR, ~0);
7810 + out_be32(PSURGE_INTR, 0);
7812 + * Assume for now that the secondary doesn't send
7815 + /* interrupt primary */
7816 + /**(volatile unsigned long *)(0xf3019000);*/
7821 @@ -285,52 +262,6 @@
7825 -#ifdef CONFIG_POWERMAC
7826 -static void pmac_core99_kick_cpu(int nr)
7828 - extern void __secondary_start_psurge(void);
7830 - unsigned long save_int;
7831 - unsigned long flags;
7832 - volatile unsigned long *vector
7833 - = ((volatile unsigned long *)(KERNELBASE+0x500));
7838 - __save_flags(flags);
7841 - /* Save EE vector */
7842 - save_int = *vector;
7844 - /* Setup fake EE vector that does
7845 - * b __secondary_start_psurge - KERNELBASE
7847 - *vector = 0x48000002 +
7848 - ((unsigned long)__secondary_start_psurge - KERNELBASE);
7850 - /* flush data cache and inval instruction cache */
7851 - flush_icache_range((unsigned long) vector, (unsigned long) vector + 4);
7853 - /* Put some life in our friend */
7854 - feature_core99_kick_cpu1();
7856 - /* FIXME: We wait a bit for the CPU to take the exception, I should
7857 - * instead wait for the entry code to set something for me. Well,
7858 - * ideally, all that crap will be done in prom.c and the CPU left
7859 - * in a RAM-based wait loop like CHRP.
7863 - /* Restore our exception vector */
7864 - *vector = save_int;
7865 - flush_icache_range((unsigned long) vector, (unsigned long) vector + 4);
7867 - __restore_flags(flags);
7869 -#endif /* powermac */
7871 void __init smp_boot_cpus(void)
7873 extern struct task_struct *current_set[NR_CPUS];
7874 @@ -367,21 +298,15 @@
7878 -#ifdef CONFIG_POWERMAC
7880 - /* assum e powersurge board - 2 processors -- Cort */
7881 - /* or a dual G4 -- Troy */
7882 + /* assume powersurge board - 2 processors -- Cort */
7886 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_CHRP)
7888 cpu_nr = ((openpic_read(&OpenPIC->Global.Feature_Reporting0)
7889 & OPENPIC_FEATURE_LAST_PROCESSOR_MASK) >>
7890 OPENPIC_FEATURE_LAST_PROCESSOR_SHIFT)+1;
7893 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_PREP)
7895 /* assume 2 for now == fix later -- Johnnie */
7897 @@ -389,13 +314,10 @@
7902 -#ifdef CONFIG_GEMINI
7904 cpu_nr = (readb(GEMINI_CPUSTAT) & GEMINI_CPU_COUNT_MASK)>>2;
7905 cpu_nr = (cpu_nr == 0) ? 4 : cpu_nr;
7909 printk("SMP not supported on this machine.\n");
7911 @@ -426,41 +348,30 @@
7915 -#ifdef CONFIG_POWERMAC
7917 - if (OpenPIC == NULL) {
7918 - /* setup entry point of secondary processor */
7919 - *(volatile unsigned long *)(0xf2800000) =
7920 - (unsigned long)__secondary_start_psurge-KERNELBASE;
7922 - /* interrupt secondary to begin executing code */
7923 - out_be32(PSURGE_INTR, ~0);
7924 - out_be32(PSURGE_INTR, 0);
7926 - pmac_core99_kick_cpu(i);
7927 + /* setup entry point of secondary processor */
7928 + *(volatile unsigned long *)(0xf2800000) =
7929 + (unsigned long)__secondary_start_psurge-KERNELBASE;
7931 + /* interrupt secondary to begin executing code */
7932 + out_be32(PSURGE_INTR, ~0);
7933 + out_be32(PSURGE_INTR, 0);
7936 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_CHRP)
7938 *(unsigned long *)KERNELBASE = i;
7939 asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory");
7942 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_PREP)
7944 *MotSave_SmpIar = (unsigned long)__secondary_start_psurge - KERNELBASE;
7945 *MotSave_CpusState[1] = CPU_GOOD;
7946 printk("CPU1 reset, waiting\n");
7949 -#ifdef CONFIG_GEMINI
7951 openpic_init_processor( 1<<i );
7952 openpic_init_processor( 0 );
7959 * wait to see if the cpu made a callin (is actually up).
7960 * use this value that I found through experimentation.
7966 + if ( _machine & (_MACH_gemini|_MACH_chrp|_MACH_prep) )
7967 do_openpic_setup_cpu();
7968 - else if ( _machine == _MACH_Pmac )
7969 + if ( _machine == _MACH_Pmac )
7971 /* reset the entry point so if we get another intr we won't
7972 * try to startup again */
7973 @@ -529,17 +440,10 @@
7974 * place to stick it for now.
7978 + if ( _machine & (_MACH_gemini|_MACH_chrp|_MACH_prep) )
7979 do_openpic_setup_cpu();
7980 -#ifdef CONFIG_POWERMAC
7981 - if ( _machine == _MACH_Pmac )
7985 -#ifdef CONFIG_GEMINI
7986 if ( _machine == _MACH_gemini )
7989 while(!smp_commenced)
7992 diff -urN linux.orig/arch/ppc/kernel/syscalls.c linux/arch/ppc/kernel/syscalls.c
7993 --- linux.orig/arch/ppc/kernel/syscalls.c Sun Mar 25 18:31:49 2001
7994 +++ linux/arch/ppc/kernel/syscalls.c Thu Jul 11 15:43:29 2002
7996 struct file * file = NULL;
7999 - down(¤t->mm->mmap_sem);
8001 if (!(flags & MAP_ANONYMOUS)) {
8002 if (fd >= NR_OPEN || !(file = current->files->fd[fd]))
8004 ret = do_mmap(file, addr, len, prot, flags, offset);
8007 - up(¤t->mm->mmap_sem);
8011 @@ -248,14 +246,9 @@
8013 asmlinkage int sys_uname(struct old_utsname * name)
8020 - err = copy_to_user(name, &system_utsname, sizeof (*name));
8022 - return err ? -EFAULT : 0;
8023 + if (name && !copy_to_user(name, &system_utsname, sizeof (*name)))
8028 asmlinkage int sys_olduname(struct oldold_utsname * name)
8030 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname)))
8034 error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN);
8035 error -= __put_user(0,name->sysname+__OLD_UTS_LEN);
8036 error -= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN);
8037 @@ -279,18 +271,6 @@
8038 error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
8039 error = __put_user(0,name->machine+__OLD_UTS_LEN);
8040 error = error ? -EFAULT : 0;
8048 - * Those are normally defined in arch/ppc/kernel/pci.c. But when CONFIG_PCI is
8049 - * not defined, this file is not linked at all, so here are the "empty" versions
8051 -asmlinkage int sys_pciconfig_read() { return -ENOSYS; }
8052 -asmlinkage int sys_pciconfig_write() { return -ENOSYS; }
8053 -asmlinkage long sys_pciconfig_iobase() { return -ENOSYS; }
8056 diff -urN linux.orig/arch/ppc/kernel/time.c linux/arch/ppc/kernel/time.c
8057 --- linux.orig/arch/ppc/kernel/time.c Sun Mar 25 18:31:49 2001
8058 +++ linux/arch/ppc/kernel/time.c Thu Jul 11 15:43:29 2002
8061 #include <asm/machdep.h>
8063 -#include <asm/time.h>
8066 void smp_local_timer_interrupt(struct pt_regs *);
8071 unsigned long cpu = smp_processor_id();
8077 @@ -106,13 +106,6 @@
8078 if ( !smp_processor_id() )
8082 - /* -- BenH -- I'm removing this for now since it can cause various
8083 - * troubles with local-time RTCs. Now that we have a
8084 - * /dev/rtc that uses ppc_md.set_rtc_time() on mac, it
8085 - * should be possible to program the RTC from userland
8089 * update the rtc when needed
8092 /* do it again in 60 s */
8093 last_rtc_update = xtime.tv_sec;
8099 @@ -192,10 +184,10 @@
8101 __initfunc(void time_init(void))
8103 - long time_offset = 0;
8105 if (ppc_md.time_init != NULL)
8106 - time_offset = ppc_md.time_init();
8108 + ppc_md.time_init();
8111 if ((_get_PVR() >> 16) == 1) {
8112 /* 601 processor: dec counts down by 128 every 128ns */
8113 @@ -208,12 +200,6 @@
8115 xtime.tv_sec = ppc_md.get_rtc_time();
8117 - if (time_offset) {
8118 - struct timezone tz;
8119 - tz.tz_minuteswest = time_offset/60;
8120 - tz.tz_dsttime = 0; /* Not handled correctly by the kernel anyway */
8121 - do_sys_settimeofday(NULL, &tz);
8124 set_dec(decrementer_count);
8125 /* allow updates right away */
8126 diff -urN linux.orig/arch/ppc/kernel/time.h linux/arch/ppc/kernel/time.h
8127 --- linux.orig/arch/ppc/kernel/time.h Thu Jan 1 01:00:00 1970
8128 +++ linux/arch/ppc/kernel/time.h Thu Jul 11 15:43:29 2002
8132 + * Common time prototypes and such for all ppc machines.
8134 + * Written by Cort Dougan (cort@cs.nmt.edu) to merge
8135 + * Paul Mackerras' version and mine for PReP and Pmac.
8138 +#include <linux/mc146818rtc.h>
8141 +extern unsigned decrementer_count;
8142 +extern unsigned count_period_num;
8143 +extern unsigned count_period_den;
8144 +extern unsigned long mktime(unsigned int, unsigned int, unsigned int,
8145 + unsigned int, unsigned int, unsigned int);
8146 +extern void to_tm(int tim, struct rtc_time * tm);
8147 +extern time_t last_rtc_update;
8149 +int via_calibrate_decr(void);
8151 +/* Accessor functions for the decrementer register. */
8152 +static __inline__ unsigned int get_dec(void)
8156 + asm volatile("mfspr %0,22" : "=r" (ret) :);
8160 +static __inline__ void set_dec(unsigned int val)
8162 + asm volatile("mtspr 22,%0" : : "r" (val));
8164 diff -urN linux.orig/arch/ppc/kernel/traps.c linux/arch/ppc/kernel/traps.c
8165 --- linux.orig/arch/ppc/kernel/traps.c Sun Mar 25 18:31:48 2001
8166 +++ linux/arch/ppc/kernel/traps.c Thu Jul 11 15:43:29 2002
8167 @@ -100,27 +100,26 @@
8171 - printk("Machine check in kernel mode. (regs at %p)\n", regs);
8172 - printk("Caused by (from srr1): ");
8173 - switch( regs->msr & 0x001F0000) {
8175 - printk("L2 data cache parity error\n");
8176 + printk("Machine check in kernel mode.\n");
8177 + printk("Caused by (from msr): ");
8178 + printk("regs %p ",regs);
8179 + switch( regs->msr & 0x0000F000)
8182 + printk("Machine check signal - probably due to mm fault\n"
8183 + "with mmu off\n");
8186 - printk("Machine check signal\n");
8187 - printk("(probably due to access of bad physical address\n");
8191 printk("Transfer error ack signal\n");
8195 printk("Data parity signal\n");
8199 printk("Address parity signal\n");
8202 - printk("Unknown values in srr1\n");
8203 + printk("Unknown values in msr\n");
8206 #if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
8207 @@ -156,52 +155,9 @@
8208 _exception(SIGTRAP, regs);
8211 -/* Illegal instruction emulation support. Originally written to
8212 - * provide the PVR to user applications using the mfspr rd, PVR.
8213 - * Return non-zero if we can't emulate, or EFAULT if the associated
8214 - * memory access caused an access fault. Return zero on success.
8216 - * There are a couple of ways to do this, either "decode" the instruction
8217 - * or directly match lots of bits. In this case, matching lots of
8218 - * bits is faster and easier.
8221 -#define INST_MFSPR_PVR 0x7c1f42a6
8222 -#define INST_MFSPR_PVR_MASK 0xfc1fffff
8225 -emulate_instruction(struct pt_regs *regs)
8232 - if (!user_mode(regs))
8236 - if (get_user(instword, (uint *)(regs->nip)))
8239 - /* Emulate the mfspr rD, PVR.
8242 - if ((instword & INST_MFSPR_PVR_MASK) == INST_MFSPR_PVR) {
8243 - rd = (instword >> 21) & 0x1f;
8244 - regs->gpr[rd] = _get_PVR();
8253 ProgramCheckException(struct pt_regs *regs)
8257 if (regs->msr & 0x100000) {
8258 /* IEEE FP exception */
8259 _exception(SIGFPE, regs);
8260 @@ -213,13 +169,7 @@
8262 _exception(SIGTRAP, regs);
8264 - /* Try to emulate it if we should. */
8265 - if ((errcode = emulate_instruction(regs))) {
8266 - if (errcode == EFAULT)
8267 - _exception(SIGBUS, regs);
8269 - _exception(SIGILL, regs);
8271 + _exception(SIGILL, regs);
8275 diff -urN linux.orig/arch/ppc/lib/string.S linux/arch/ppc/lib/string.S
8276 --- linux.orig/arch/ppc/lib/string.S Sun Mar 25 18:31:49 2001
8277 +++ linux/arch/ppc/lib/string.S Thu Jul 11 15:43:29 2002
8279 #include <asm/processor.h>
8280 #include <asm/errno.h>
8282 -CACHELINE_BYTES = 32
8283 -LG_CACHELINE_BYTES = 5
8284 -CACHELINE_MASK = 0x1f
8285 -CACHELINE_WORDS = 8
8294 -#if 0 /* Clever, but breaks fb stuff -- paulus */
8296 - * Use dcbz on the complete cache lines in the destination if
8297 - * we are setting to zero. This requires that the destination
8298 - * area is cacheable. -- paulus
8302 - clrlwi r7,r6,32-LG_CACHELINE_BYTES
8304 - srwi r9,r8,LG_CACHELINE_BYTES
8305 - addic. r9,r9,-1 /* total number of complete cachelines */
8307 - xori r0,r7,CACHELINE_MASK & ~3
8316 - addi r6,r6,CACHELINE_BYTES
8318 - clrlwi r5,r8,32-LG_CACHELINE_BYTES
8323 + rlwinm r0,r5,32-2,2,31
8327 @@ -140,94 +107,11 @@
8330 bgt backwards_memcpy
8332 + /* fall through */
8336 -#if 0 /* Clever, but will probably break fb stuff -- paulus */
8338 - * This version uses dcbz on the complete cache lines in the
8339 - * destination area to reduce memory traffic. This requires that
8340 - * the destination area is cacheable.
8341 - * We only use this version if the source and dest don't overlap.
8344 - add r7,r3,r5 /* test if the src & dst overlap */
8348 - crand 0,0,4 /* cr0.lt &= cr1.lt */
8349 - blt forwards_memcpy /* if regions overlap */
8354 - andi. r0,r0,CACHELINE_MASK /* # bytes to start of cache line */
8357 - cmplw 0,r5,r0 /* is this more than total to do? */
8358 - blt 63f /* if not much to do */
8359 - andi. r8,r0,3 /* get it word-aligned first */
8363 -70: lbz r9,4(r4) /* do some bytes */
8371 -72: lwzu r9,4(r4) /* do some words */
8375 -58: srwi. r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */
8376 - clrlwi r5,r5,32-LG_CACHELINE_BYTES
8417 - .global forwards_memcpy
8420 + rlwinm. r7,r5,32-3,3,31 /* r0 = r5 >> 3 */
8423 beq 2f /* if less than 8 bytes to do */
8424 @@ -334,167 +218,106 @@
8426 .globl __copy_tofrom_user
8432 - andi. r0,r0,CACHELINE_MASK /* # bytes to start of cache line */
8435 - cmplw 0,r5,r0 /* is this more than total to do? */
8436 - blt 63f /* if not much to do */
8437 - andi. r8,r0,3 /* get it word-aligned first */
8440 -70: lbz r9,4(r4) /* do some bytes */
8449 -72: lwzu r9,4(r4) /* do some words */
8453 -58: srwi. r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */
8454 - clrlwi r5,r5,32-LG_CACHELINE_BYTES
8462 -13: lwzu r10,16(r4)
8466 -17: stwu r10,16(r6)
8470 -23: lwzu r10,16(r4)
8474 -27: stwu r10,16(r6)
8490 + li r3,0 /* success return value */
8491 + beq 2f /* if less than 8 bytes to do */
8492 + andi. r0,r6,3 /* get dest word aligned */
8506 +3: cmpwi 0,r5,0 /* do 1 byte at a time for the remainder */
8515 +5: subfic r0,r0,4 /* copy bytes until we have the */
8516 + mtctr r0 /* destination 4-byte aligned */
8526 -/* read fault, initial single-byte copy */
8529 -/* write fault, initial single-byte copy */
8534 -/* read fault, initial word copy */
8537 -/* write fault, initial word copy */
8541 -/* read fault in 2nd half of cacheline loop */
8542 -106: addi r5,r5,-16
8543 -/* read fault in 1st half of cacheline loop */
8546 -/* write fault in 2nd half of cacheline loop */
8547 -107: addi r5,r5,-16
8548 -/* fault on dcbz (effectively a write fault) */
8549 -/* or write fault in 1st half of cacheline loop */
8551 -92: li r3,LG_CACHELINE_BYTES
8553 -/* read fault in final word loop */
8556 -/* write fault in final word loop */
8561 -/* read fault in final byte loop */
8564 -/* write fault in final byte loop */
8569 - * At this stage the number of bytes not copied is
8570 - * r5 + (ctr << r3), and r4 is 0 for read or 1 for write.
8579 +/* we come here on a fault in the 8-byte-at-a-time loop */
8580 +88: subi r4,r4,8 /* compensate for the lwzu */
8582 + rlwimi r5,r0,3,0,28 /* use the byte-at-a-time loop to */
8583 + b 3b /* copy up to the byte at fault */
8584 +/* here on a write fault in the single-word copy */
8587 +/* here on a read fault in the initial single-byte copy */
8592 -/* for read fault, clear out the destination: r3 bytes starting at 4(r6) */
8604 +/* here on a read fault in the final single-byte copy */
8607 +/* clear out the rest of the destination: r3 bytes starting at 4(r6) */
8631 +/* here on a write fault in the initial single-byte copy */
8635 +/* here on a write fault in the final single-byte copy */
8639 .section __ex_table,"a"
8688 + /*rlwinm r0,r4,32-2,2,31*/
8692 diff -urN linux.orig/arch/ppc/mm/extable.c linux/arch/ppc/mm/extable.c
8693 --- linux.orig/arch/ppc/mm/extable.c Sun Mar 25 18:31:48 2001
8694 +++ linux/arch/ppc/mm/extable.c Thu Jul 11 15:43:29 2002
8696 #include <linux/module.h>
8697 #include <asm/uaccess.h>
8699 -extern struct exception_table_entry __start___ex_table[];
8700 -extern struct exception_table_entry __stop___ex_table[];
8703 - * The exception table needs to be sorted because we use the macros
8704 - * which put things into the exception table in a variety of segments
8705 - * such as the prep, pmac, chrp, etc. segments as well as the init
8706 - * segment and the main kernel text segment.
8709 -sort_ex_table(struct exception_table_entry *start,
8710 - struct exception_table_entry *finish)
8712 - struct exception_table_entry el, *p, *q;
8714 - /* insertion sort */
8715 - for (p = start + 1; p < finish; ++p) {
8716 - /* start .. p-1 is sorted */
8717 - if (p[0].insn < p[-1].insn) {
8718 - /* move element p down to its right place */
8722 - /* el comes before q[-1], move q[-1] up one */
8725 - } while (q > start && el.insn < q[-1].insn);
8732 -sort_exception_table(void)
8734 - sort_ex_table(__start___ex_table, __stop___ex_table);
8736 +extern const struct exception_table_entry __start___ex_table[];
8737 +extern const struct exception_table_entry __stop___ex_table[];
8739 static inline unsigned long
8740 search_one_table(const struct exception_table_entry *first,
8745 -#ifndef CONFIG_MODULES
8746 +#if 1 /*ndef CONFIG_MODULES*/
8747 /* There is only the kernel to search. */
8748 ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr);
8749 if (ret) return ret;
8750 diff -urN linux.orig/arch/ppc/mm/fault.c linux/arch/ppc/mm/fault.c
8751 --- linux.orig/arch/ppc/mm/fault.c Sun Mar 25 18:31:48 2001
8752 +++ linux/arch/ppc/mm/fault.c Thu Jul 11 15:43:29 2002
8754 (error_code&0x80000000)?"I/O ":"",
8755 (regs->trap == 0x400)?"instr":"data"
8758 - if (regs->trap == 0x400)
8759 - error_code &= 0x48200000;
8762 #if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
8763 if (debugger_fault_handler && regs->trap == 0x300) {
8764 debugger_fault_handler(regs);
8765 diff -urN linux.orig/arch/ppc/mm/init.c linux/arch/ppc/mm/init.c
8766 --- linux.orig/arch/ppc/mm/init.c Sun Mar 25 18:31:48 2001
8767 +++ linux/arch/ppc/mm/init.c Thu Jul 11 15:43:30 2002
8768 @@ -416,12 +416,7 @@
8770 void iounmap(void *addr)
8772 - /* For support of dynamic hot swap on the cPCI bus this routine
8773 - is now necessary. This has been well tested on a Motorola
8774 - MPC750 (Mesquite) processor board. Johnnie Peters
8776 - if (addr > high_memory && (unsigned long) addr < ioremap_bot)
8777 - return vfree((void *) (PAGE_MASK & (unsigned long) addr));
8781 unsigned long iopa(unsigned long addr)
8782 @@ -933,21 +928,15 @@
8783 /* On the powerpc, no user access
8784 forces R/W kernel access */
8786 - map_page(v, p, f);
8792 #else /* CONFIG_8xx */
8793 - for (i = 0; i < phys_mem.n_regions; ++i) {
8794 - v = (ulong)__va(phys_mem.regions[i].address);
8795 - p = phys_mem.regions[i].address;
8796 - for (s = 0; s < phys_mem.regions[i].size; s += PAGE_SIZE) {
8797 + for (i = 0; i < phys_mem.n_regions; ++i) {
8798 + v = (ulong)__va(phys_mem.regions[i].address);
8799 + p = phys_mem.regions[i].address;
8800 + for (s = 0; s < phys_mem.regions[i].size; s += PAGE_SIZE) {
8801 /* On the MPC8xx, we want the page shared so we
8802 * don't get ASID compares on kernel space.
8804 - f = _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_SHARED;
8805 + f = _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_SHARED;
8807 /* I don't really need the rest of this code, but
8808 * I grabbed it because I think the line:
8809 @@ -957,14 +946,14 @@
8810 * the MPC8xx, the PAGE_DIRTY takes care of that
8811 * for us (along with the RW software state).
8813 - if ((char *) v < _stext || (char *) v >= etext)
8814 - f |= _PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE;
8815 + if ((char *) v < _stext || (char *) v >= etext)
8816 + f |= _PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE;
8817 +#endif /* CONFIG_8xx */
8823 -#endif /* CONFIG_8xx */
8827 /* This can get called from ioremap, so don't make it an initfunc, OK? */
8828 @@ -1044,9 +1033,6 @@
8832 -#ifdef CONFIG_BOOTX_TEXT
8833 -extern boot_infos_t *disp_bi;
8835 __initfunc(void MMU_init(void))
8838 @@ -1066,6 +1052,7 @@
8839 #endif /* CONFIG_GEMINI */
8841 end_of_DRAM = prep_find_end_of_memory();
8842 +*(unsigned long *)(KERNELBASE) = 0xdeadbeef;
8844 _SDR1 = __pa(Hash) | (Hash_mask >> 10);
8845 ioremap_base = 0xf8000000;
8846 @@ -1095,13 +1082,7 @@
8847 struct device_node *macio = find_devices("mac-io");
8848 if (macio && macio->n_addrs)
8849 base = macio->addrs[0].address;
8850 - /* Hrm... we have it at 0x80000000 on some machines
8851 - * and this is covered by the userland segment
8852 - * registers. Isn't that bad ? Well, the BAT takes
8853 - * precedence, but I don't like it. --BenH
8855 - if (base >= 0xf0000000)
8856 - setbat(0, base, base, 0x100000, IO_PAGE);
8857 + setbat(0, base, base, 0x100000, IO_PAGE);
8858 ioremap_base = 0xf0000000;
8861 @@ -1140,10 +1121,6 @@
8862 ioremap(0x80000000, 0x4000);
8863 ioremap(0x81000000, 0x4000);
8864 #endif /* CONFIG_8xx */
8865 -#ifdef CONFIG_BOOTX_TEXT
8866 - if (_machine == _MACH_Pmac)
8872 @@ -1275,8 +1252,8 @@
8873 #endif /* CONFIG_BLK_DEV_INITRD */
8876 - addr < (rtas_data + KERNELBASE) ||
8877 - addr >= (rtas_data + KERNELBASE + rtas_size))
8878 + addr < (rtas_data & PAGE_MASK) ||
8879 + addr >= (rtas_data+rtas_size))
8880 #endif /* CONFIG_8xx */
8883 @@ -1337,7 +1314,6 @@
8886 #endif /* CONFIG_MBX */
8890 * On systems with Open Firmware, collect information about
8891 @@ -1404,7 +1380,6 @@
8892 if (boot_infos == 0) {
8893 /* record which bits the prom is using */
8894 get_mem_prop("available", &phys_avail);
8895 - remove_mem_piece(&phys_avail, __max_memory, ~__max_memory, 0);
8896 prom_mem = phys_mem;
8897 for (i = 0; i < phys_avail.n_regions; ++i)
8898 remove_mem_piece(&prom_mem,
8899 diff -urN linux.orig/arch/ppc/pmac_defconfig linux/arch/ppc/pmac_defconfig
8900 --- linux.orig/arch/ppc/pmac_defconfig Sun Mar 25 18:31:50 2001
8901 +++ linux/arch/ppc/pmac_defconfig Thu Jul 11 15:43:30 2002
8903 CONFIG_NET_ETHERNET=y
8907 # CONFIG_NET_VENDOR_3COM is not set
8908 # CONFIG_LANCE is not set
8909 # CONFIG_NET_VENDOR_SMC is not set
8911 CONFIG_FB_PLATINUM=y
8912 CONFIG_FB_VALKYRIE=y
8917 # CONFIG_FB_S3TRIO is not set
8918 diff -urN linux.orig/arch/ppc/xmon/start.c linux/arch/ppc/xmon/start.c
8919 --- linux.orig/arch/ppc/xmon/start.c Sun Mar 25 18:31:50 2001
8920 +++ linux/arch/ppc/xmon/start.c Thu Jul 11 15:43:30 2002
8922 #include <asm/prom.h>
8923 #include <asm/bootx.h>
8924 #include <asm/pmu.h>
8925 -#include <asm/feature.h>
8927 static volatile unsigned char *sccc, *sccd;
8928 unsigned long TXRDY, RXRDY;
8929 extern void xmon_printf(const char *fmt, ...);
8930 +extern void map_bootx_text(void);
8931 extern void drawchar(char);
8932 extern void drawstring(const char *str);
8933 -static int xmon_expect(const char *str, unsigned int timeout);
8935 static int console = 0;
8936 static int use_screen = 0;
8937 -static int via_modem = 0;
8938 -static int xmon_use_sccb = 0;
8939 -static struct device_node *macio_node;
8941 -#define TB_SPEED 25000000
8943 -static inline unsigned int readtb(void)
8947 - asm volatile("mftb %0" : "=r" (ret) :);
8951 void buf_access(void)
8954 if ( _machine == _MACH_Pmac )
8956 struct device_node *np;
8957 + extern boot_infos_t *boot_infos;
8959 -#ifdef CONFIG_BOOTX_TEXT
8960 - extern boot_infos_t *disp_bi;
8962 - /* needs to be hacked if xmon_printk is to be used
8963 - from within find_via_pmu() */
8964 - if (!via_modem && disp_bi && find_via_pmu()) {
8965 +#ifdef CONFIG_BOOTX_TEXT
8966 + if (boot_infos != 0 && find_via_pmu()) {
8967 printk(KERN_INFO "xmon uses screen and keyboard\n");
8979 np = find_devices("mac-io");
8980 if (np && np->n_addrs) {
8982 - addr = np->addrs[0].address + 0x13020;
8983 + addr = np->addrs[0].address + 0x13000;
8984 + /* use the B channel on the iMac, A channel on others */
8985 + if (addr >= 0xf0000000)
8986 + addr += 0x20; /* use A channel */
8988 - base = (volatile unsigned char *)
8989 - ioremap(addr & PAGE_MASK, PAGE_SIZE);
8990 + base = (volatile unsigned char *) ioremap(addr & PAGE_MASK, PAGE_SIZE);
8991 sccc = base + (addr & ~PAGE_MASK);
8992 - sccd = sccc + 0x10;
8994 + sccd = sccc + (0xc1013030 - 0xc1013020);
8996 + sccd = sccc + (0xf3013030 - 0xf3013020);
9002 xmon_write(void *handle, void *ptr, int nb)
9008 #ifdef CONFIG_BOOTX_TEXT
9010 @@ -111,23 +101,19 @@
9012 if (!scc_initialized)
9015 for (i = 0; i < nb; ++i) {
9016 while ((*sccc & TXRDY) == 0)
9017 if (adb_hardware == ADB_VIAPMU)
9020 - if (c == '\n' && !ct) {
9031 + if ( console && (*p != '\r'))
9038 + xmon_write(handle, "\r", 1);
9042 @@ -213,30 +199,23 @@
9043 if (adb_hardware == ADB_VIAPMU)
9048 + if ( 0/*console*/ )
9049 + *p++ = ppc_md.kbd_getkeycode();
9058 -xmon_read_poll(void)
9060 - if ((*sccc & RXRDY) == 0) {
9061 - if (adb_hardware == ADB_VIAPMU)
9069 static unsigned char scc_inittab[] = {
9070 13, 0, /* set baud rate divisor */
9072 14, 1, /* baud rate gen enable, src=rtxc */
9073 11, 0x50, /* clocks = br gen */
9074 - 5, 0xea, /* tx 8 bits, assert DTR & RTS */
9075 - 4, 0x46, /* x16 clock, 1 stop */
9076 + 5, 0x6a, /* tx 8 bits, assert RTS */
9077 + 4, 0x44, /* x16 clock, 1 stop */
9078 3, 0xc1, /* rx enable, 8 bits */
9081 @@ -256,21 +235,6 @@
9085 - if (macio_node != 0) {
9088 - feature_set(macio_node, FEATURE_Serial_enable);
9090 - feature_set(macio_node, FEATURE_Modem_power);
9092 - while (readtb() - t0 < 3*TB_SPEED)
9096 - if (xmon_use_sccb) {
9100 for (i = 20000; i != 0; --i) {
9103 @@ -282,18 +246,6 @@
9106 scc_initialized = 1;
9109 - xmon_write(0, "ATE1V1\r", 7);
9110 - if (xmon_expect("OK", 5)) {
9111 - xmon_write(0, "ATA\r", 4);
9112 - if (xmon_expect("CONNECT", 40))
9115 - xmon_write(0, "+++", 3);
9116 - xmon_expect("OK", 3);
9122 @@ -366,35 +318,6 @@
9123 static char *lineptr;
9124 static int lineleft;
9126 -int xmon_expect(const char *str, unsigned int timeout)
9131 - timeout *= TB_SPEED;
9136 - c = xmon_read_poll();
9138 - if (readtb() - t0 > timeout) {
9139 - printk("timeout\n");
9147 - if (c != '\r' && lineptr < &line[sizeof(line) - 1])
9151 - } while (strstr(line, str) == NULL);
9158 @@ -467,15 +390,3 @@
9174 diff -urN linux.orig/arch/ppc/xmon/xmon.c linux/arch/ppc/xmon/xmon.c
9175 --- linux.orig/arch/ppc/xmon/xmon.c Sun Mar 25 18:31:50 2001
9176 +++ linux/arch/ppc/xmon/xmon.c Thu Jul 11 15:43:30 2002
9178 extern int setjmp(u_int *);
9179 extern void longjmp(u_int *, int);
9181 -extern void xmon_enter(void);
9182 -extern void xmon_leave(void);
9184 #define GETWORD(v) (((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3])
9186 static char *help_string = "\
9189 set_msr(msr & ~0x8000); /* disable interrupts */
9200 set_msr(msr); /* restore interrupt enable */
9203 diff -urN linux.orig/include/asm-ppc/irq-compat.h linux/include/asm-ppc/irq-compat.h
9204 --- linux.orig/include/asm-ppc/irq-compat.h Thu Jan 1 01:00:00 1970
9205 +++ linux/include/asm-ppc/irq-compat.h Thu Jul 11 15:43:30 2002
9207 +#include <asm/irq.h>
9209 +//#define NUM_8259_INTERRUPTS 16
9210 +//#define NUM_OPENPIC_INTERRUPTS 20
9211 +//#define is_8259_irq(n) ((n) < NUM_8259_INTERRUPTS)
9212 +#define openpic_to_irq(n) ((n)+NUM_8259_INTERRUPTS)
9213 +//#define irq_to_openpic(n) ((n)-NUM_8259_INTERRUPTS)
9214 +//#define IRQ_8259_CASCADE NUM_8259_INTERRUPTS
9215 diff -urN linux.orig/include/asm-ppc/ohare-compat.h linux/include/asm-ppc/ohare-compat.h
9216 --- linux.orig/include/asm-ppc/ohare-compat.h Thu Jan 1 01:00:00 1970
9217 +++ linux/include/asm-ppc/ohare-compat.h Thu Jul 11 15:43:30 2002
9219 +#define OH_BAY_RESET 2 /* a guess */
9220 +#define OH_IDE_ENABLE 0x20
9221 +#define OH_IDE_POWER 0x40 /* a guess */
9222 +#define OH_BAY_ENABLE 0x80
9223 +#define OH_IDE_RESET 0x100 /* 0-based, a guess */
9224 +#define OH_VIA_ENABLE 0x10000
9225 +#define OH_IDECD_POWER 0x800000
9226 diff -urN linux.orig/include/asm-ppc/page.h linux/include/asm-ppc/page.h
9227 --- linux.orig/include/asm-ppc/page.h Sun Mar 25 18:37:39 2001
9228 +++ linux/include/asm-ppc/page.h Thu Jul 11 15:43:30 2002
9230 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
9232 extern void clear_page(unsigned long page);
9233 -extern void copy_page(unsigned long to, unsigned long from);
9234 +#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
9236 /* map phys->virtual and virtual->phys for RAM pages */
9238 diff -urN linux.orig/include/asm-ppc/pf-compat.h linux/include/asm-ppc/pf-compat.h
9239 --- linux.orig/include/asm-ppc/pf-compat.h Thu Jan 1 01:00:00 1970
9240 +++ linux/include/asm-ppc/pf-compat.h Thu Jul 11 15:43:30 2002
9242 +#define PF_TRACESYS 0x00000020 /* tracing system calls */
9243 +#define PF_PTRACED 0x00000010 /* set if ptrace (0) has been called */