1 diff -urN linux.orig/Makefile linux/Makefile
2 --- linux.orig/Makefile Tue Jun 11 19:39:18 2002
3 +++ linux/Makefile Fri Jul 12 18:41:07 2002
11 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
13 diff -urN linux.orig/arch/ppc/boot/Makefile linux/arch/ppc/boot/Makefile
14 --- linux.orig/arch/ppc/boot/Makefile Sun Mar 25 18:31:49 2001
15 +++ linux/arch/ppc/boot/Makefile Fri Jul 12 19:00:55 2002
17 zvmlinux.initrd: zvmlinux
18 $(LD) $(ZLINKFLAGS) -o zvmlinux.initrd.tmp $(OBJECTS)
19 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
20 - --add-section=initrd=../coffboot/ramdisk.image.gz \
21 + --add-section=initrd=ramdisk.image.gz \
22 --add-section=image=../coffboot/vmlinux.gz \
23 zvmlinux.initrd.tmp zvmlinux.initrd
24 $(CC) $(CFLAGS) -DINITRD_OFFSET=`sh offset $(OBJDUMP) zvmlinux.initrd initrd` \
27 $(LD) $(ZLINKFLAGS) -o zvmlinux.initrd.tmp $(OBJECTS)
28 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
29 - --add-section=initrd=../coffboot/ramdisk.image.gz \
30 + --add-section=initrd=ramdisk.image.gz \
31 --add-section=image=../coffboot/vmlinux.gz \
32 zvmlinux.initrd.tmp $@
33 rm zvmlinux.initrd.tmp
34 diff -urN linux.orig/arch/ppc/coffboot/Makefile linux/arch/ppc/coffboot/Makefile
35 --- linux.orig/arch/ppc/coffboot/Makefile Sun Mar 25 18:31:49 2001
36 +++ linux/arch/ppc/coffboot/Makefile Thu Jul 11 15:43:29 2002
38 LD = $(CROSS_COMPILE)ld
39 CFLAGS = $(CPPFLAGS) -O -fno-builtin -I$(HPATH)
40 OBJCOPY = $(CROSS_COMPILE)objcopy
41 -OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
42 -COFF_LD_ARGS = -e _start -T ld.script -Ttext 500000 -Tdata 510000 -Bstatic
43 -CHRP_LD_ARGS = -Ttext 0x01000000
44 +OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment \
45 + --add-section=image=vmlinux.gz
46 +LD_ARGS = -e _start -T ld.script -Ttext 500000 -Tdata 510000 -Bstatic
49 -COFFOBJS = coffcrt0.o start.o coffmain.o misc.o string.o zlib.o image.o
50 -CHRPOBJS = crt0.o start.o chrpmain.o misc.o string.o zlib.o image.o
51 +OBJS = crt0.o start.o main.o misc.o string.o zlib.o
52 LIBS = $(TOPDIR)/lib/lib.a
54 ifeq ($(CONFIG_PPC64),y)
56 hack-coff: hack-coff.c
57 $(HOSTCC) $(HOSTCFLAGS) -o hack-coff hack-coff.c
59 -znetboot: vmlinux.coff zImage vmlinux.elf
60 - cp vmlinux.coff $(TFTPIMAGE)
61 - cp vmlinux.elf $(TFTPIMAGE).elf
63 -znetboot.initrd: vmlinux.coff.initrd vmlinux.elf.initrd
64 - cp vmlinux.coff.initrd $(TFTPIMAGE)
65 - cp vmlinux.elf.initrd $(TFTPIMAGE).elf
68 # mount -t hfs /dev/fd0 /mnt
69 # cp vmlinux.coff /mnt
72 -coffboot: $(COFFOBJS) no_initrd.o ld.script
73 - $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) no_initrd.o $(LIBS)
75 -coffboot.initrd: $(COFFOBJS) initrd.o ld.script
76 - $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) initrd.o $(LIBS)
77 +znetboot: vmlinux.coff
78 + cp vmlinux.coff $(TFTPIMAGE)
80 -piggyback: piggyback.c
81 - $(HOSTCC) $(HOSTCFLAGS) -DKERNELBASE=$(KERNELBASE) -o piggyback piggyback.c
82 +znetboot.initrd: vmlinux.coff.initrd
83 + cp vmlinux.coff.initrd $(TFTPIMAGE)
86 - $(HOSTCC) $(HOSTCFLAGS) -o mknote mknote.c
87 +coffboot: $(OBJS) ld.script
88 + $(LD) -o coffboot $(LD_ARGS) $(OBJS) $(LIBS)
90 -image.o: piggyback vmlinux.gz
91 - ./piggyback image < vmlinux.gz | $(AS) -o image.o
94 -initrd.o: ramdisk.image.gz piggyback
95 - ./piggyback initrd < ramdisk.image.gz | $(AS) -o initrd.o
96 +zImage.initrd: vmlinux.coff.initrd
98 -vmlinux.coff: coffboot hack-coff
99 +vmlinux.coff: coffboot hack-coff vmlinux.gz
100 $(OBJCOPY) $(OBJCOPY_ARGS) coffboot $@
102 ln -sf vmlinux.coff zImage
104 -vmlinux.coff.initrd: coffboot.initrd hack-coff
105 - $(OBJCOPY) $(OBJCOPY_ARGS) coffboot.initrd $@
106 +vmlinux.coff.initrd: coffboot hack-coff vmlinux.gz ramdisk.image.gz
107 + $(OBJCOPY) $(OBJCOPY_ARGS) --add-section=initrd=ramdisk.image.gz \
111 -vmlinux.elf: $(CHRPOBJS) no_initrd.o mknote
112 - $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) no_initrd.o $(LIBS)
114 - $(OBJCOPY) $@ $@ --add-section=.note=note -R .comment
116 -vmlinux.elf.initrd: $(CHRPOBJS) initrd.o mknote
117 - $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) initrd.o $(LIBS)
119 - $(OBJCOPY) $@ $@ --add-section=.note=note -R .comment
122 - $(LD) -o $@ $(COFF_LD_ARGS) dummy.o $(LIBS)
124 -miboot.image: micoffboot hack-coff vmlinux.gz
125 - $(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=vmlinux.gz micoffboot $@
128 -miboot.image.initrd: micoffboot hack-coff vmlinux.gz ramdisk.image.gz
129 - $(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=vmlinux.gz \
130 - --add-section=initrd=ramdisk.image.gz micoffboot $@
133 -zImage: vmlinux.coff vmlinux.elf miboot.image
135 -zImage.initrd: vmlinux.coff.initrd vmlinux.elf.initrd miboot.image.initrd
140 znetboot.initrd: vmlinux.gz
142 -miboot.image: vmlinux.gz
144 -miboot.image.initrd: vmlinux.gz
152 rm -f hack-coff coffboot zImage vmlinux.coff vmlinux.gz
153 - rm -f mknote piggyback vmlinux.elf note
154 - rm -f micoffboot miboot.image
157 diff -urN linux.orig/arch/ppc/coffboot/chrpmain.c linux/arch/ppc/coffboot/chrpmain.c
158 --- linux.orig/arch/ppc/coffboot/chrpmain.c Sun Mar 25 18:31:49 2001
159 +++ linux/arch/ppc/coffboot/chrpmain.c Thu Jan 1 01:00:00 1970
162 - * Copyright (C) Paul Mackerras 1997.
164 - * This program is free software; you can redistribute it and/or
165 - * modify it under the terms of the GNU General Public License
166 - * as published by the Free Software Foundation; either version
167 - * 2 of the License, or (at your option) any later version.
169 -#include "nonstdio.h"
172 -extern void *finddevice(const char *);
173 -extern int getprop(void *, const char *, void *, int);
174 -void gunzip(void *, int, unsigned char *, int *);
175 -void stop_imac_ethernet(void);
176 -void stop_imac_usb(void);
178 -#define get_16be(x) (*(unsigned short *)(x))
179 -#define get_32be(x) (*(unsigned *)(x))
181 -#define RAM_END (16 << 20)
183 -#define PROG_START 0x00010000
184 -#define PROG_SIZE 0x003f0000
186 -#define SCRATCH_SIZE (128 << 10)
189 -char *begin_avail, *end_avail;
191 -unsigned int heap_use;
192 -unsigned int heap_max;
195 -extern char image_data[];
196 -extern int image_len;
197 -extern char initrd_data[];
198 -extern int initrd_len;
201 -boot(int a1, int a2, void *prom)
207 - unsigned initrd_start, initrd_size;
208 - extern char _start;
210 - printf("chrpboot starting: loaded at 0x%x\n", &_start);
212 - initrd_size = initrd_len;
213 - initrd_start = (RAM_END - initrd_size) & ~0xFFF;
216 - claim(initrd_start, RAM_END - initrd_start, 0);
217 - printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n",
218 - initrd_start, initrd_data, initrd_size);
219 - memcpy((char *)initrd_start, initrd_data, initrd_size);
223 - /* claim 3MB starting at PROG_START */
224 - claim(PROG_START, PROG_SIZE, 0);
225 - dst = (void *) PROG_START;
226 - if (im[0] == 0x1f && im[1] == 0x8b) {
227 - /* claim some memory for scratch space */
228 - avail_ram = (char *) claim(0, SCRATCH_SIZE, 0x10);
229 - begin_avail = avail_high = avail_ram;
230 - end_avail = avail_ram + SCRATCH_SIZE;
231 - printf("heap at 0x%x\n", avail_ram);
232 - printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len);
233 - gunzip(dst, PROG_SIZE, im, &len);
234 - printf("done %u bytes\n", len);
235 - printf("%u bytes of heap consumed, max in use %u\n",
236 - avail_high - begin_avail, heap_max);
238 - memmove(dst, im, len);
241 - flush_cache(dst, len);
243 - stop_imac_ethernet();
247 - sa = (unsigned long)PROG_START;
248 - printf("start address = 0x%x\n", sa);
250 - (*(void (*)())sa)(a1, a2, prom);
252 - printf("returned?\n");
258 -#define eieio() asm volatile("eieio");
260 -void stop_imac_ethernet(void)
262 - void *macio, *enet;
263 - unsigned int macio_addr[5], enet_reg[6];
265 - volatile unsigned int *dbdma;
267 - macio = finddevice("/pci/mac-io");
268 - enet = finddevice("/pci/mac-io/ethernet");
269 - if (macio == NULL || enet == NULL)
271 - len = getprop(macio, "assigned-addresses", macio_addr, sizeof(macio_addr));
272 - if (len != sizeof(macio_addr))
274 - len = getprop(enet, "reg", enet_reg, sizeof(enet_reg));
275 - if (len != sizeof(enet_reg))
277 - printf("macio base %x, dma at %x & %x\n",
278 - macio_addr[2], enet_reg[2], enet_reg[4]);
280 - /* hope this is mapped... */
281 - dbdma = (volatile unsigned int *) (macio_addr[2] + enet_reg[2]);
282 - *dbdma = 0x80; /* clear the RUN bit */
284 - dbdma = (volatile unsigned int *) (macio_addr[2] + enet_reg[4]);
285 - *dbdma = 0x80; /* clear the RUN bit */
289 -void stop_imac_usb(void)
292 - unsigned int usb_addr[5];
294 - volatile unsigned int *usb_ctrl;
296 - usb = finddevice("/pci/usb");
299 - len = getprop(usb, "assigned-addresses", usb_addr, sizeof(usb_addr));
300 - if (len != sizeof(usb_addr))
302 - printf("usb base %x\n", usb_addr[2]);
304 - usb_ctrl = (volatile unsigned int *) (usb_addr[2] + 8);
305 - *usb_ctrl = 0x01000000; /* cpu_to_le32(1) */
312 - struct memchunk *next;
315 -static struct memchunk *freechunks;
317 -void *zalloc(void *x, unsigned items, unsigned size)
320 - struct memchunk **mpp, *mp;
323 - size = (size + 7) & -8;
325 - if (heap_use > heap_max)
326 - heap_max = heap_use;
327 - for (mpp = &freechunks; (mp = *mpp) != 0; mpp = &mp->next) {
328 - if (mp->size == size) {
335 - if (avail_ram > avail_high)
336 - avail_high = avail_ram;
337 - if (avail_ram > end_avail) {
338 - printf("oops... out of memory\n");
344 -void zfree(void *x, void *addr, unsigned nb)
346 - struct memchunk *mp = addr;
348 - nb = (nb + 7) & -8;
350 - if (avail_ram == addr + nb) {
355 - mp->next = freechunks;
360 -#define EXTRA_FIELD 4
362 -#define COMMENT 0x10
363 -#define RESERVED 0xe0
367 -void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
375 - if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
376 - printf("bad gzipped data\n");
379 - if ((flags & EXTRA_FIELD) != 0)
380 - i = 12 + src[10] + (src[11] << 8);
381 - if ((flags & ORIG_NAME) != 0)
382 - while (src[i++] != 0)
384 - if ((flags & COMMENT) != 0)
385 - while (src[i++] != 0)
387 - if ((flags & HEAD_CRC) != 0)
390 - printf("gunzip: ran out of data in header\n");
396 - r = inflateInit2(&s, -MAX_WBITS);
398 - printf("inflateInit2 returned %d\n", r);
401 - s.next_in = src + i;
402 - s.avail_in = *lenp - i;
404 - s.avail_out = dstlen;
405 - r = inflate(&s, Z_FINISH);
406 - if (r != Z_OK && r != Z_STREAM_END) {
407 - printf("inflate returned %d msg: %s\n", r, s.msg);
410 - *lenp = s.next_out - (unsigned char *) dst;
413 diff -urN linux.orig/arch/ppc/coffboot/coffcrt0.S linux/arch/ppc/coffboot/coffcrt0.S
414 --- linux.orig/arch/ppc/coffboot/coffcrt0.S Sun Mar 25 18:31:49 2001
415 +++ linux/arch/ppc/coffboot/coffcrt0.S Thu Jan 1 01:00:00 1970
418 - * Copyright (C) Paul Mackerras 1997.
420 - * This program is free software; you can redistribute it and/or
421 - * modify it under the terms of the GNU General Public License
422 - * as published by the Free Software Foundation; either version
423 - * 2 of the License, or (at your option) any later version.
441 diff -urN linux.orig/arch/ppc/coffboot/coffmain.c linux/arch/ppc/coffboot/coffmain.c
442 --- linux.orig/arch/ppc/coffboot/coffmain.c Sun Mar 25 18:31:49 2001
443 +++ linux/arch/ppc/coffboot/coffmain.c Thu Jan 1 01:00:00 1970
446 - * Copyright (C) Paul Mackerras 1997.
448 - * This program is free software; you can redistribute it and/or
449 - * modify it under the terms of the GNU General Public License
450 - * as published by the Free Software Foundation; either version
451 - * 2 of the License, or (at your option) any later version.
453 -#include "nonstdio.h"
456 -extern void *finddevice(const char *);
457 -extern int getprop(void *, const char *, void *, int);
458 -extern char *claim(unsigned, unsigned, unsigned);
459 -void gunzip(void *, int, unsigned char *, int *);
461 -#define get_16be(x) (*(unsigned short *)(x))
462 -#define get_32be(x) (*(unsigned *)(x))
464 -#define RAM_START 0xc0000000
465 -#define PROG_START RAM_START
466 -#define RAM_END (RAM_START + 0x800000) /* only 8M mapped with BATs */
471 -extern char _start[], _end[];
472 -extern char image_data[];
473 -extern int image_len;
474 -extern char initrd_data[];
475 -extern int initrd_len;
478 -boot(int a1, int a2, void *prom)
484 - unsigned initrd_start, initrd_size;
486 - printf("coffboot starting: loaded at 0x%x\n", _start);
487 - setup_bats(RAM_START);
489 - initrd_size = initrd_len;
490 - initrd_start = (RAM_END - initrd_size) & ~0xFFF;
493 - claim(initrd_start - RAM_START, RAM_END - initrd_start, 0);
494 - printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n",
495 - initrd_start, initrd_data, initrd_size);
496 - memcpy((char *)initrd_start, initrd_data, initrd_size);
500 - /* claim 3MB starting at 0 */
501 - claim(0, 3 << 20, 0);
502 - dst = (void *) RAM_START;
503 - if (im[0] == 0x1f && im[1] == 0x8b) {
504 - /* claim 512kB for scratch space */
505 - avail_ram = claim(0, 512 << 10, 0x10) + RAM_START;
506 - end_avail = avail_ram + (512 << 10);
507 - printf("avail_ram = %x\n", avail_ram);
508 - printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len);
509 - gunzip(dst, 3 << 20, im, &len);
510 - printf("done %u bytes\n", len);
512 - memmove(dst, im, len);
515 - flush_cache(dst, len);
517 - sa = (unsigned long)PROG_START;
518 - printf("start address = 0x%x\n", sa);
523 - (*(void (*)())sa)(a1, a2, prom);
525 - printf("returned?\n");
530 -void *zalloc(void *x, unsigned items, unsigned size)
532 - void *p = avail_ram;
535 - size = (size + 7) & -8;
537 - if (avail_ram > end_avail) {
538 - printf("oops... out of memory\n");
544 -void zfree(void *x, void *addr, unsigned nb)
549 -#define EXTRA_FIELD 4
551 -#define COMMENT 0x10
552 -#define RESERVED 0xe0
556 -void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
564 - if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
565 - printf("bad gzipped data\n");
568 - if ((flags & EXTRA_FIELD) != 0)
569 - i = 12 + src[10] + (src[11] << 8);
570 - if ((flags & ORIG_NAME) != 0)
571 - while (src[i++] != 0)
573 - if ((flags & COMMENT) != 0)
574 - while (src[i++] != 0)
576 - if ((flags & HEAD_CRC) != 0)
579 - printf("gunzip: ran out of data in header\n");
585 - r = inflateInit2(&s, -MAX_WBITS);
587 - printf("inflateInit2 returned %d\n", r);
590 - s.next_in = src + i;
591 - s.avail_in = *lenp - i;
593 - s.avail_out = dstlen;
594 - r = inflate(&s, Z_FINISH);
595 - if (r != Z_OK && r != Z_STREAM_END) {
596 - printf("inflate returned %d msg: %s\n", r, s.msg);
599 - *lenp = s.next_out - (unsigned char *) dst;
602 diff -urN linux.orig/arch/ppc/coffboot/crt0.S linux/arch/ppc/coffboot/crt0.S
603 --- linux.orig/arch/ppc/coffboot/crt0.S Sun Mar 25 18:31:49 2001
604 +++ linux/arch/ppc/coffboot/crt0.S Thu Jul 11 15:43:29 2002
616 diff -urN linux.orig/arch/ppc/coffboot/dummy.c linux/arch/ppc/coffboot/dummy.c
617 --- linux.orig/arch/ppc/coffboot/dummy.c Sun Mar 25 18:31:49 2001
618 +++ linux/arch/ppc/coffboot/dummy.c Thu Jan 1 01:00:00 1970
624 diff -urN linux.orig/arch/ppc/coffboot/misc.S linux/arch/ppc/coffboot/misc.S
625 --- linux.orig/arch/ppc/coffboot/misc.S Sun Mar 25 18:31:49 2001
626 +++ linux/arch/ppc/coffboot/misc.S Thu Jul 11 15:43:29 2002
632 - rlwinm 5,5,16,16,31 /* r3 = 1 for 601, 4 for 604 */
637 + rlwinm 3,3,16,16,31 /* r3 = 1 for 601, 4 for 604 */
640 - mtibatl 3,0 /* invalidate BAT first */
641 - ori 3,3,4 /* set up BAT registers for 601 */
646 -4: mtdbatu 3,0 /* invalidate BATs first */
648 - ori 3,3,0xff /* set up BAT registers for 604 */
655 + ori 4,4,4 /* set up BAT registers for 601 */
661 +4: ori 4,4,0xfe /* set up BAT registers for 604 */
670 diff -urN linux.orig/arch/ppc/coffboot/mknote.c linux/arch/ppc/coffboot/mknote.c
671 --- linux.orig/arch/ppc/coffboot/mknote.c Sun Mar 25 18:31:49 2001
672 +++ linux/arch/ppc/coffboot/mknote.c Thu Jan 1 01:00:00 1970
675 - * Copyright (C) Cort Dougan 1999.
677 - * This program is free software; you can redistribute it and/or
678 - * modify it under the terms of the GNU General Public License
679 - * as published by the Free Software Foundation; either version
680 - * 2 of the License, or (at your option) any later version.
682 - * Generate a note section as per the CHRP specification.
688 -#define PL(x) printf("%c%c%c%c", ((x)>>24)&0xff, ((x)>>16)&0xff, ((x)>>8)&0xff, (x)&0xff );
694 - PL(strlen("PowerPC")+1);
700 - printf("PowerPC"); printf("%c", 0);
717 diff -urN linux.orig/arch/ppc/coffboot/no_initrd.c linux/arch/ppc/coffboot/no_initrd.c
718 --- linux.orig/arch/ppc/coffboot/no_initrd.c Sun Mar 25 18:31:49 2001
719 +++ linux/arch/ppc/coffboot/no_initrd.c Thu Jan 1 01:00:00 1970
721 -char initrd_data[1];
723 diff -urN linux.orig/arch/ppc/coffboot/piggyback.c linux/arch/ppc/coffboot/piggyback.c
724 --- linux.orig/arch/ppc/coffboot/piggyback.c Sun Mar 25 18:31:49 2001
725 +++ linux/arch/ppc/coffboot/piggyback.c Thu Jan 1 01:00:00 1970
729 -extern long ce_exec_config[];
731 -main(int argc, char *argv[])
733 - int i, cnt, pos, len;
734 - unsigned int cksum, val;
736 - unsigned char buf[8192];
739 - fprintf(stderr, "usage: %s name <in-file >out-file\n",
743 - fprintf(stdout, "#\n");
744 - fprintf(stdout, "# Miscellaneous data structures:\n");
745 - fprintf(stdout, "# WARNING - this file is automatically generated!\n");
746 - fprintf(stdout, "#\n");
747 - fprintf(stdout, "\n");
748 - fprintf(stdout, "\t.data\n");
749 - fprintf(stdout, "\t.globl %s_data\n", argv[1]);
750 - fprintf(stdout, "%s_data:\n", argv[1]);
753 - while ((len = read(0, buf, sizeof(buf))) > 0)
756 - lp = (unsigned char *)buf;
757 - len = (len + 3) & ~3; /* Round up to longwords */
758 - for (i = 0; i < len; i += 4)
762 - fprintf(stdout, "\t.long\t");
764 - fprintf(stdout, "0x%02X%02X%02X%02X", lp[0], lp[1], lp[2], lp[3]);
765 - val = *(unsigned long *)lp;
771 - fprintf(stdout, " # %x \n", pos+i-12);
775 - fprintf(stdout, ",");
780 - fprintf(stdout, "0\n");
784 - fprintf(stdout, "\t.globl %s_len\n", argv[1]);
785 - fprintf(stdout, "%s_len:\t.long\t0x%x\n", argv[1], pos);
788 - fprintf(stderr, "cksum = %x\n", cksum);
792 diff -urN linux.orig/arch/ppc/coffboot/start.c linux/arch/ppc/coffboot/start.c
793 --- linux.orig/arch/ppc/coffboot/start.c Sun Mar 25 18:31:49 2001
794 +++ linux/arch/ppc/coffboot/start.c Thu Jul 11 15:43:29 2002
796 if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
799 - boot(a1, a2, promptr);
800 + coffboot(a1, a2, promptr);
808 -int writestring(void *f, char *ptr, int nb)
813 - for (i = 0; i < nb; ++i) {
814 - if (ptr[i] == '\n') {
816 - write(f, ptr + w, i - w);
823 - write(f, ptr + w, nb - w);
828 read(void *handle, void *ptr, int nb)
835 -claim(unsigned int virt, unsigned int size, unsigned int align)
843 - unsigned int align;
847 - args.service = "claim";
852 - args.align = align;
858 getprop(void *phandle, const char *name, void *buf, int buflen)
864 - return writestring(f, &ch, 1) == 1? c: -1;
867 + return write(f, &ch, 1) == 1? c: -1;
875 - return writestring(f, str, n) == n? 0: -1;
876 + return write(f, str, n) == n? 0: -1;
884 - printk("read(stdin) returned -1\n");
885 + printk("read(stdin) returned -1\r\n");
891 n = vsprintf(sprint_buf, fmt, args);
893 - writestring(stdout, sprint_buf, n);
894 + write(stdout, sprint_buf, n);
900 n = vsprintf(sprint_buf, fmt, args);
902 - writestring(stdout, sprint_buf, n);
903 + write(stdout, sprint_buf, n);
906 diff -urN linux.orig/arch/ppc/common_defconfig linux/arch/ppc/common_defconfig
907 --- linux.orig/arch/ppc/common_defconfig Sun Mar 25 18:31:50 2001
908 +++ linux/arch/ppc/common_defconfig Fri Jul 12 18:54:54 2002
910 # CONFIG_GEMINI is not set
911 # CONFIG_MBX is not set
912 # CONFIG_SMP is not set
917 diff -urN linux.orig/arch/ppc/config.in linux/arch/ppc/config.in
918 --- linux.orig/arch/ppc/config.in Fri Nov 2 17:39:05 2001
919 +++ linux/arch/ppc/config.in Thu Jul 11 15:43:29 2002
922 bool 'Symmetric multi-processing support' CONFIG_SMP
924 -if [ "$CONFIG_6xx" = "y" ]; then
925 - bool 'Altivec (G4) support' CONFIG_ALTIVEC
928 if [ "$CONFIG_ALL_PPC" != "y" ]; then
929 define_bool CONFIG_MACH_SPECIFIC y
931 diff -urN linux.orig/arch/ppc/kernel/Makefile linux/arch/ppc/kernel/Makefile
932 --- linux.orig/arch/ppc/kernel/Makefile Sun Mar 25 18:31:48 2001
933 +++ linux/arch/ppc/kernel/Makefile Fri Jul 12 19:09:44 2002
936 # Note 2! The CFLAGS definitions are now in the main makefile...
938 -# Once a gas that groks -mvec is generally available, we'll use it...
940 -#ifdef CONFIG_ALTIVEC
941 -# $(CC) $(CFLAGS) -D__ASSEMBLY__ -Wa,-mvec -c $< -o $*.o
943 $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $*.o
947 OX_OBJS := ppc_ksyms.o setup.o
950 ifeq ($(CONFIG_MBX),y)
951 O_OBJS += mbx_setup.o mbx_pci.o softemu8xx.o i8259.o ppc8xx_pic.o
954 ifeq ($(CONFIG_APUS),y)
955 O_OBJS += apus_setup.o prom.o openpic.o
957 +ifneq ($(CONFIG_MBX),y)
958 +O_OBJS += prep_time.o pmac_time.o chrp_time.o \
959 + pmac_setup.o pmac_support.o \
960 + prep_pci.o pmac_pci.o chrp_pci.o \
961 + residual.o prom.o openpic.o feature.o \
962 + prep_nvram.o open_pic.o i8259.o pmac_pic.o indirect_pci.o \
963 + gemini_pci.o gemini_prom.o gemini_setup.o
964 +OX_OBJS += chrp_setup.o prep_setup.o
968 -PMAC_OBJS = pmac_time.o pmac_setup.o pmac_support.o pmac_pci.o pmac_pic.o \
969 - feature.o openpic.o open_pic.o prom.o
970 -CHRP_OBJS = $(PMAC_OBJS) chrp_time.o chrp_pci.o i8259.o indirect_pci.o
971 -CHRPX_OBJS = chrp_setup.o
972 -PREP_OBJS = prep_time.o prep_pci.o residual.o prep_nvram.o i8259.o \
973 - indirect_pci.o openpic.o open_pic.o prom.o
974 -PREPX_OBJS = prep_setup.o
976 -ifeq ($(CONFIG_ALL_PPC),y)
977 -O_OBJS += $(sort $(PMAC_OBJS) $(PREP_OBJS) $(CHRP_OBJS))
978 -OX_OBJS += $(PMACX_OBJS) $(PREPX_OBJS) $(CHRPX_OBJS)
980 -ifeq ($(CONFIG_PMAC),y)
981 -O_OBJS += $(PMAC_OBJS)
982 -OX_OBJS += $(PMACX_OBJS)
984 -ifeq ($(CONFIG_PREP),y)
985 -O_OBJS += $(PREP_OBJS)
986 -OX_OBJS += $(PREPX_OBJS)
988 -ifeq ($(CONFIG_CHRP),y)
989 -O_OBJS += $(CHRP_OBJS)
990 -OX_OBJS += $(CHRPX_OBJS)
993 -GEMINI_OBJS = $(PREP_OBJS) gemini_pci.o gemini_prom.o gemini_setup.o
994 -ifeq ($(CONFIG_GEMINI),y)
995 -O_OBJS += $(GEMINI_OBJS)
996 -OX_OBJS += $(PREPX_OBJS)
1000 diff -urN linux.orig/arch/ppc/kernel/apus_setup.c linux/arch/ppc/kernel/apus_setup.c
1001 --- linux.orig/arch/ppc/kernel/apus_setup.c Sun Mar 25 18:31:49 2001
1002 +++ linux/arch/ppc/kernel/apus_setup.c Fri Jul 12 17:02:19 2002
1004 #include <asm/machdep.h>
1005 #include <asm/ide.h>
1007 -#include <asm/time.h>
1009 #include "local_irq.h"
1011 unsigned long apus_get_rtc_time(void);
1012 diff -urN linux.orig/arch/ppc/kernel/chrp_pci.c linux/arch/ppc/kernel/chrp_pci.c
1013 --- linux.orig/arch/ppc/kernel/chrp_pci.c Sun Mar 25 18:31:48 2001
1014 +++ linux/arch/ppc/kernel/chrp_pci.c Thu Jul 11 15:43:29 2002
1017 #include <asm/pgtable.h>
1018 #include <asm/irq.h>
1019 +#include <asm/irq-compat.h>
1020 #include <asm/hydra.h>
1021 #include <asm/prom.h>
1022 #include <asm/gg2.h>
1024 #include <asm/machdep.h>
1027 -#include "open_pic.h"
1030 #define pci_config_addr(bus, dev, offset) \
1032 for( dev=pci_devices ; dev; dev=dev->next )
1035 - dev->irq = dev->irq + open_pic.irq_offset;
1036 + dev->irq = openpic_to_irq( dev->irq );
1037 /* these need to be absolute addrs for OF and Matrox FB -- Cort */
1038 if ( dev->vendor == PCI_VENDOR_ID_MATROX )
1040 diff -urN linux.orig/arch/ppc/kernel/chrp_setup.c linux/arch/ppc/kernel/chrp_setup.c
1041 --- linux.orig/arch/ppc/kernel/chrp_setup.c Sun Mar 25 18:31:49 2001
1042 +++ linux/arch/ppc/kernel/chrp_setup.c Thu Jul 11 16:22:09 2002
1044 #include <linux/pci.h>
1045 #include <linux/openpic.h>
1046 #include <linux/version.h>
1047 -#include <linux/delay.h>
1049 #include <asm/mmu.h>
1050 #include <asm/processor.h>
1052 #include <asm/dma.h>
1053 #include <asm/machdep.h>
1054 #include <asm/irq.h>
1055 +#include <asm/irq-compat.h>
1056 #include <asm/adb.h>
1057 #include <asm/hydra.h>
1058 #include <asm/keyboard.h>
1060 -#include <asm/time.h>
1062 #include "local_irq.h"
1064 #include "open_pic.h"
1066 int chrp_set_rtc_time(unsigned long nowtime);
1067 unsigned long rtas_event_scan_rate = 0, rtas_event_scan_ct = 0;
1068 void chrp_calibrate_decr(void);
1069 -long chrp_time_init(void);
1070 +void chrp_time_init(void);
1072 void chrp_setup_pci_ptrs(void);
1074 @@ -359,6 +359,81 @@
1079 +chrp_do_IRQ(struct pt_regs *regs,
1084 + unsigned long bits = 0;
1085 + int openpic_eoi_done = 0;
1089 + unsigned int loops = 1000000;
1090 + while (test_bit(0, &global_irq_lock)) {
1091 + if (smp_processor_id() == global_irq_holder) {
1092 + printk("uh oh, interrupt while we hold global irq lock!\n");
1098 + if (loops-- == 0) {
1099 + printk("do_IRQ waiting for irq lock (holder=%d)\n", global_irq_holder);
1106 +#endif /* __SMP__ */
1108 + irq = openpic_irq(smp_processor_id());
1109 + if (irq == IRQ_8259_CASCADE)
1112 + * This magic address generates a PCI IACK cycle.
1114 + * This should go in the above mask/ack code soon. -- Cort
1116 + if ( chrp_int_ack_special )
1117 + irq = *chrp_int_ack_special;
1119 + irq = i8259_irq(0);
1121 + * Acknowledge as soon as possible to allow i8259
1122 + * interrupt nesting */
1123 + openpic_eoi(smp_processor_id());
1124 + openpic_eoi_done = 1;
1126 + if (irq == OPENPIC_VEC_SPURIOUS)
1129 + * Spurious interrupts should never be
1132 + ppc_spurious_interrupts++;
1133 + openpic_eoi_done = 1;
1136 + bits = 1UL << irq;
1140 + printk(KERN_DEBUG "Bogus interrupt %d from PC = %lx\n",
1142 + ppc_spurious_interrupts++;
1146 + ppc_irq_dispatch_handler( regs, irq );
1149 + if (!openpic_eoi_done)
1150 + openpic_eoi(smp_processor_id());
1154 chrp_init_IRQ(void))
1157 (*(unsigned long *)get_property(np,
1158 "8259-interrupt-acknowledge", NULL));
1160 - open_pic.irq_offset = NUM_8259_INTERRUPTS;
1161 + open_pic.irq_offset = 16;
1162 for ( i = 16 ; i < NR_IRQS ; i++ )
1163 irq_desc[i].ctl = &open_pic;
1166 irq_desc[i].ctl = &i8259_pic;
1169 - request_irq(HYDRA_INT_ADB_NMI+open_pic.irq_offset,
1170 + request_irq(openpic_to_irq(HYDRA_INT_ADB_NMI),
1171 xmon_irq, 0, "NMI", 0);
1172 #endif /* CONFIG_XMON */
1175 ppc_md.get_cpuinfo = chrp_get_cpuinfo;
1176 ppc_md.irq_cannonicalize = chrp_irq_cannonicalize;
1177 ppc_md.init_IRQ = chrp_init_IRQ;
1178 - ppc_md.do_IRQ = open_pic_do_IRQ;
1179 + ppc_md.do_IRQ = chrp_do_IRQ;
1181 ppc_md.init = chrp_init2;
1185 call_rtas( "display-character", 1, 1, NULL, *s++ );
1188 -void chrp_indicator(int x)
1190 - call_rtas("set-indicator", 3, 1, NULL, 6, 0, x);
1192 diff -urN linux.orig/arch/ppc/kernel/chrp_time.c linux/arch/ppc/kernel/chrp_time.c
1193 --- linux.orig/arch/ppc/kernel/chrp_time.c Sun Mar 25 18:31:49 2001
1194 +++ linux/arch/ppc/kernel/chrp_time.c Thu Jul 11 15:43:29 2002
1196 #include <asm/processor.h>
1197 #include <asm/nvram.h>
1198 #include <asm/prom.h>
1199 -#include <asm/time.h>
1202 static int nvram_as1 = NVRAM_AS1;
1203 static int nvram_as0 = NVRAM_AS0;
1204 static int nvram_data = NVRAM_DATA;
1206 -__initfunc(long chrp_time_init(void))
1207 +__initfunc(void chrp_time_init(void))
1209 struct device_node *rtcs;
1212 rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
1213 if (rtcs == NULL || rtcs->addrs == NULL)
1216 base = rtcs->addrs[0].address;
1219 nvram_data = base + 1;
1223 int chrp_cmos_clock_read(int addr)
1224 diff -urN linux.orig/arch/ppc/kernel/gemini_setup.c linux/arch/ppc/kernel/gemini_setup.c
1225 --- linux.orig/arch/ppc/kernel/gemini_setup.c Sun Mar 25 18:31:49 2001
1226 +++ linux/arch/ppc/kernel/gemini_setup.c Thu Jul 11 15:45:25 2002
1228 #include <linux/blk.h>
1229 #include <linux/console.h>
1230 #include <linux/openpic.h>
1231 -#include <linux/delay.h>
1233 #include <asm/system.h>
1234 #include <asm/pgtable.h>
1237 #include <asm/m48t35.h>
1238 #include <asm/gemini.h>
1239 -#include <asm/processor.h>
1241 -#include <asm/time.h>
1243 #include "local_irq.h"
1244 #include "open_pic.h"
1247 ioremap( GEMINI_MPIC_ADDR, sizeof( struct OpenPIC ));
1251 +extern unsigned long loops_per_jiffy;
1252 extern int root_mountflags;
1253 extern char cmd_line[];
1255 @@ -258,6 +258,14 @@
1260 +#define L2CR_PIPE_LATEWR (0x01800000) /* late-write SRAM */
1261 +#define L2CR_L2CTL (0x00100000) /* RAM control */
1262 +#define L2CR_INST_DISABLE (0x00400000) /* disable for insn's */
1263 +#define L2CR_L2I (0x00200000) /* global invalidate */
1264 +#define L2CR_L2E (0x80000000) /* enable */
1265 +#define L2CR_L2WT (0x00080000) /* write-through */
1267 void __init gemini_init_l2(void)
1273 cache |= L2CR_PIPE_LATEWR|L2CR_L2CTL|L2CR_INST_DISABLE;
1274 - _set_L2CR(cache|L2CR_L2E);
1276 + _set_L2CR(cache|L2CR_L2I|L2CR_L2E);
1281 #define gemini_rtc_write(val,x) (writeb((val),(GEMINI_RTC+(x))))
1283 /* ensure that the RTC is up and running */
1284 -long __init gemini_time_init(void)
1285 +void __init gemini_time_init(void)
1290 gemini_rtc_write((reg & ~(M48T35_RTC_STOPPED)), M48T35_RTC_CONTROL);
1291 gemini_rtc_write((reg | M48T35_RTC_SET), M48T35_RTC_CONTROL);
1297 diff -urN linux.orig/arch/ppc/kernel/head.S linux/arch/ppc/kernel/head.S
1298 --- linux.orig/arch/ppc/kernel/head.S Fri Nov 2 17:39:05 2001
1299 +++ linux/arch/ppc/kernel/head.S Thu Jul 11 15:43:29 2002
1301 * Copyright (C) 1996 Paul Mackerras.
1302 * MPC8xx modifications Copyright (C) 1997 Dan Malek (dmalek@jlc.net).
1303 * Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
1304 - * AltiVec additions by Kumar Gala (kumar.gala@motorola.com).
1306 * This file contains the low-level support and setup for the
1307 * PowerPC platform, including trap and interrupt dispatch.
1309 * modify it under the terms of the GNU General Public License
1310 * as published by the Free Software Foundation; either version
1311 * 2 of the License, or (at your option) any later version.
1314 - * Add sys_rt_sigreturn in DoSyscall Handler.
1315 - * Giovanna Ambrosini (ambrosini@lightning.ch).
1320 #define REST_16FPRS(n, base) REST_8FPRS(n, base); REST_8FPRS(n+8, base)
1321 #define REST_32FPRS(n, base) REST_16FPRS(n, base); REST_16FPRS(n+16, base)
1324 - * Once a version of gas that understands the AltiVec instructions
1325 - * is freely available, we can do this the normal way... - paulus
1327 -#define LVX(r,a,b) .long (31<<26)+((r)<<21)+((a)<<16)+((b)<<11)+(103<<1)
1328 -#define STVX(r,a,b) .long (31<<26)+((r)<<21)+((a)<<16)+((b)<<11)+(231<<1)
1329 -#define MFVSCR(r) .long (4<<26)+((r)<<11)+(770<<1)
1330 -#define MTVSCR(r) .long (4<<26)+((r)<<11)+(802<<1)
1332 -#define SAVE_VR(n,b,base) li b,TSS_VR0+(16*(n)); STVX(n,b,base)
1333 -#define SAVE_2VR(n,b,base) SAVE_VR(n,b,base); SAVE_VR(n+1,b,base)
1334 -#define SAVE_4VR(n,b,base) SAVE_2VR(n,b,base); SAVE_2VR(n+2,b,base)
1335 -#define SAVE_8VR(n,b,base) SAVE_4VR(n,b,base); SAVE_4VR(n+4,b,base)
1336 -#define SAVE_16VR(n,b,base) SAVE_8VR(n,b,base); SAVE_8VR(n+8,b,base)
1337 -#define SAVE_32VR(n,b,base) SAVE_16VR(n,b,base); SAVE_16VR(n+16,b,base)
1338 -#define REST_VR(n,b,base) li b,TSS_VR0+(16*(n)); LVX(n,b,base)
1339 -#define REST_2VR(n,b,base) REST_VR(n,b,base); REST_VR(n+1,b,base)
1340 -#define REST_4VR(n,b,base) REST_2VR(n,b,base); REST_2VR(n+2,b,base)
1341 -#define REST_8VR(n,b,base) REST_4VR(n,b,base); REST_4VR(n+4,b,base)
1342 -#define REST_16VR(n,b,base) REST_8VR(n,b,base); REST_8VR(n+8,b,base)
1343 -#define REST_32VR(n,b,base) REST_16VR(n,b,base); REST_16VR(n+16,b,base)
1348 @@ -262,15 +235,66 @@
1350 /* Switch MMU off, clear BATs and flush TLB */
1355 - bl setup_init_bats
1356 -#ifndef CONFIG_APUS
1357 -#ifdef CONFIG_BOOTX_TEXT
1361 +/* Use the first pair of BAT registers to map the 1st 16MB
1362 + * of RAM to KERNELBASE. From this point on we can't safely
1363 + * call OF any more.
1365 + lis r11,KERNELBASE@h
1367 + rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
1370 + ori r11,r11,4 /* set up BAT registers for 601 */
1371 + li r8,0x7f /* valid, block length = 8MB */
1372 + oris r9,r11,0x800000@h /* set up BAT reg for 2nd 8M */
1373 + oris r10,r8,0x800000@h /* set up BAT reg for 2nd 8M */
1374 + mtspr IBAT0U,r11 /* N.B. 601 has valid bit in */
1375 + mtspr IBAT0L,r8 /* lower BAT register */
1381 + ori r11,r11,BL_8M<<2|0x2 /* set up an 8MB mapping */
1382 + ori r11,r11,0xfe /* set up an 8MB mapping */
1383 + lis r8,CYBERBASEp@h
1385 + addis r8,r8,KERNELBASE@h
1388 + ori r11,r11,BL_256M<<2|0x2 /* set up BAT registers for 604 */
1389 + li r8,2 /* R/W access */
1391 + * If the MMU is off clear the bats. See clear_bat() -- Cort
1393 +#ifndef CONFIG_GEMINI
1395 + * allow secondary cpus to get at all of ram in early bootup
1396 + * since their init_task may be up there -- Cort
1398 + oris r18,r8,0x10000000@h
1399 + oris r21,r11,(KERNELBASE+0x10000000)@h
1400 + mtspr DBAT1L,r18 /* N.B. 6xx (not 601) have valid */
1401 + mtspr DBAT1U,r21 /* bit in upper BAT register */
1405 + oris r18,r8,0x20000000@h
1406 + oris r21,r11,(KERNELBASE+0x20000000)@h
1407 + mtspr DBAT2L,r18 /* N.B. 6xx (not 601) have valid */
1408 + mtspr DBAT2U,r21 /* bit in upper BAT register */
1411 +#endif /* ndef CONFIG_GEMINI */
1413 + mtspr DBAT0L,r8 /* N.B. 6xx (not 601) have valid */
1414 + mtspr DBAT0U,r11 /* bit in upper BAT register */
1419 /* Unfortunately the APUS specific instructions bloat the
1420 * code so it cannot fit in the 0x100 bytes available. We have
1421 @@ -396,15 +420,6 @@
1422 #endif /* CONFIG_8xx */
1425 -/* Hack for sleep on Core99 machines
1427 -#ifdef CONFIG_POWERMAC
1432 -#endif /* CONFIG_POWERMAC */
1435 * GCC sometimes accesses words at negative offsets from the stack
1436 * pointer, although the SysV ABI says it shouldn't. To cope with
1438 #endif /* CONFIG_GEMINI */
1440 STD_EXCEPTION(0x100, Reset, UnknownException)
1445 STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
1446 @@ -636,26 +651,7 @@
1447 STD_EXCEPTION(0xd00, SingleStep, SingleStepException)
1449 STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
1451 -#ifndef CONFIG_ALTIVEC
1452 STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
1455 - * The Altivec unavailable trap is at 0x0f20. Foo.
1456 - * We effectively remap it to 0x3000.
1461 - addi r3,r1,STACK_FRAME_OVERHEAD
1463 - bl transfer_to_handler
1464 - .long UnknownException
1468 - b AltiVecUnavailable
1469 -#endif /* CONFIG_ALTIVEC */
1473 @@ -1173,24 +1169,9 @@
1474 STD_EXCEPTION(0x2f00, Trap_2f, UnknownException)
1477 -#ifdef CONFIG_ALTIVEC
1478 -AltiVecUnavailable:
1480 - bne load_up_altivec /* if from user, just load it up */
1482 - bl transfer_to_handler /* if from kernel, take a trap */
1483 - .long KernelAltiVec
1486 -/* here are the bits of trap 0xf00 which got displaced */
1490 -#endif /* CONFIG_ALTIVEC */
1492 -#else /* CONFIG_8xx */
1495 -#endif /* CONFIG_8xx */
1499 * This code finishes saving the registers to the exception frame
1500 @@ -1345,7 +1326,11 @@
1501 /* Construct the high word of the PPC-style PTE */
1502 mfsrin r5,r3 /* get segment reg for segment */
1503 rlwinm r5,r5,7,1,24 /* put VSID in 0x7fffff80 bits */
1505 +#ifndef __SMP__ /* do this later for SMP */
1506 oris r5,r5,0x8000 /* set V (valid) bit */
1509 rlwimi r5,r3,10,26,31 /* put in API (abbrev page index) */
1510 /* Get the address of the primary PTE group in the hash table */
1511 .globl hash_page_patch_A
1512 @@ -1457,7 +1442,6 @@
1516 - clrlwi r5,r5,1 /* clear valid bit (0x80000000) */
1517 stw r5,0(r3) /* clear V (valid) bit in PTE */
1520 @@ -1509,7 +1493,6 @@
1528 @@ -1649,145 +1632,24 @@
1529 #endif /* __SMP__ */
1532 -#ifdef CONFIG_ALTIVEC
1533 -/* Note that the AltiVec support is closely modeled after the FP
1534 - * support. Changes to one are likely to be applicable to the
1538 - * Disable AltiVec for the task which had AltiVec previously,
1539 - * and save its AltiVec registers in its thread_struct.
1540 - * Enables AltiVec for use in the kernel on return.
1541 - * On SMP we know the AltiVec units are free, since we give it up every
1542 - * switch. -- Kumar
1545 - oris r5,r5,MSR_VEC@h
1547 - mtmsr r5 /* enable use of AltiVec now */
1550 - * For SMP, we don't do lazy AltiVec switching because it just gets too
1551 - * horrendously complex, especially when a task switches from one CPU
1552 - * to another. Instead we call giveup_altivec in switch_to.
1555 -#ifndef CONFIG_APUS
1556 - lis r6,-KERNELBASE@h
1558 - lis r6,CYBERBASEp@h
1561 - addis r3,r6,last_task_used_altivec@ha
1562 - lwz r4,last_task_used_altivec@l(r3)
1566 - addi r4,r4,TSS /* want TSS of last_task_used_altivec */
1567 - SAVE_32VR(0,r20,r4)
1571 - lwz r5,PT_REGS(r4)
1573 - lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5)
1575 - andc r4,r4,r20 /* disable altivec for previous task */
1576 - stw r4,_MSR-STACK_FRAME_OVERHEAD(r5)
1578 -#endif /* __SMP__ */
1579 - /* enable use of AltiVec after return */
1580 - oris r23,r23,MSR_VEC@h
1581 - mfspr r5,SPRG3 /* current task's TSS (phys) */
1585 - REST_32VR(0,r20,r5)
1589 - stw r4,last_task_used_altivec@l(r3)
1590 -#endif /* __SMP__ */
1591 - /* restore registers and return */
1597 - REST_4GPRS(3, r21)
1598 - /* we haven't used ctr or xer */
1602 - REST_2GPRS(22, r21)
1603 - lwz r21,GPR21(r21)
1608 - * AltiVec unavailable trap from kernel - print a message, but let
1609 - * the task use AltiVec in the kernel until it returns to user mode.
1613 - oris r3,r3,MSR_VEC@h
1614 - stw r3,_MSR(r1) /* enable use of AltiVec after return */
1617 - mr r4,r2 /* current */
1621 -87: .string "AltiVec used in kernel (task=%p, pc=%x) \n"
1625 - * giveup_altivec(tsk)
1626 - * Disable AltiVec for the task given as the argument,
1627 - * and save the AltiVec registers in its thread_struct.
1628 - * Enables AltiVec for use in the kernel on return.
1631 - .globl giveup_altivec
1634 - oris r5,r5,MSR_VEC@h
1636 - mtmsr r5 /* enable use of AltiVec now */
1639 - beqlr- /* if no previous owner, done */
1640 - addi r3,r3,TSS /* want TSS of task */
1641 - lwz r5,PT_REGS(r3)
1643 - SAVE_32VR(0, r4, r3)
1648 - lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5)
1650 - andc r4,r4,r3 /* disable AltiVec for previous task */
1651 - stw r4,_MSR-STACK_FRAME_OVERHEAD(r5)
1655 - lis r4,last_task_used_altivec@ha
1656 - stw r5,last_task_used_altivec@l(r4)
1657 -#endif /* __SMP__ */
1658 +#else /* CONFIG_8xx */
1662 -#endif /* CONFIG_ALTIVEC */
1663 +#endif /* CONFIG_8xx */
1666 - addi r4, r3, mmu_off_return - _start
1667 + addi r4, r3, __secondary_start - _start
1669 andi. r0,r3,MSR_DR|MSR_IR /* MMU enabled? */
1673 + ori r3,r3,MSR_DR|MSR_IR
1674 + xori r3,r3,MSR_DR|MSR_IR
1683 * This code is jumped to from the startup code to copy
1684 @@ -1798,6 +1660,10 @@
1685 addi r9,r9,0x6f58 /* translate source addr */
1686 cmpw r31,r9 /* (we have to on chrp) */
1688 +#if 0 // still needed ? breaks on me if I don't disable this
1689 + rlwinm r4,r4,0,8,31 /* translate source address */
1690 + add r4,r4,r3 /* to region mapped with BATs */
1692 7: addis r9,r26,klimit@ha /* fetch klimit */
1693 lwz r25,klimit@l(r9)
1694 addis r25,r25,-KERNELBASE@h
1695 @@ -1845,12 +1711,6 @@
1699 -#else /* CONFIG_8xx */
1703 -#endif /* CONFIG_8xx */
1707 ori r1,r0,MSR_DR|MSR_IR
1708 @@ -1913,7 +1773,7 @@
1710 rlwinm r9,r9,16,16,31
1712 - beq 6f /* not needed for 601 */
1713 + beq 4f /* not needed for 601 */
1715 andi. r0,r11,HID0_DCE
1716 ori r11,r11,HID0_ICE|HID0_DCE
1717 @@ -1930,24 +1790,14 @@
1718 cmpi 0,r9,4 /* check for 604 */
1719 cmpi 1,r9,9 /* or 604e */
1720 cmpi 2,r9,10 /* or mach5 */
1721 - cmpi 3,r9,8 /* check for 750 (G3) */
1722 - cmpi 4,r9,12 /* or 7400 (G4) */
1726 ori r11,r11,HID0_SIED|HID0_BHTE /* for 604[e], enable */
1728 ori r11,r11,HID0_BTCD
1733 - ori r11,r11,HID0_SGE|HID0_BHTE|HID0_BTIC|HID0_ABE /* for g3/g4, enable */
1734 - rlwinm r11,r11,0,23,21 /* clear HID0_SPD */
1737 5: mtspr HID0,r11 /* superscalar exec & br history tbl */
1740 #endif /* CONFIG_8xx */
1742 /* if we're the second cpu stack and r2 are different
1743 @@ -2028,10 +1878,10 @@
1744 li r3,MSR_KERNEL & ~(MSR_IR|MSR_DR)
1749 /* Load up the kernel context */
1751 + SYNC /* Force all PTE updates to finish */
1752 tlbia /* Clear all TLB entries */
1753 sync /* wait for tlbia/tlbie to finish */
1755 @@ -2088,7 +1938,6 @@
1756 #endif /* __SMP__ */
1760 rfi /* enable MMU and jump to start_kernel */
1763 @@ -2126,11 +1975,9 @@
1765 #endif /* SHOW_SYSCALLS */
1766 cmpi 0,r0,0x7777 /* Special case for 'sys_sigreturn' */
1767 - cmpi 1,r0,0x6666 /* Special case for 'sys_rt_sigreturn' */
1770 - lwz r10,TASK_PTRACE(r2)
1771 - andi. r10,r10,PT_TRACESYS
1772 + lwz r10,TASK_FLAGS(r2)
1773 + andi. r10,r10,PF_TRACESYS
1775 cmpli 0,r0,NR_syscalls
1777 @@ -2175,12 +2022,6 @@
1779 10: addi r3,r1,STACK_FRAME_OVERHEAD
1781 - cmpi 0,r3,0 /* Check for restarted system call */
1784 -/* sys_rt_sigreturn */
1785 -16: addi r3,r1,STACK_FRAME_OVERHEAD
1786 - bl sys_rt_sigreturn
1787 cmpi 0,r3,0 /* Check for restarted system call */
1790 @@ -2273,9 +2114,6 @@
1791 mflr r20 /* Return to switch caller */
1793 li r0,MSR_FP /* Disable floating-point */
1794 -#ifdef CONFIG_ALTIVEC
1795 - oris r0,r0,MSR_VEC@h
1796 -#endif /* CONFIG_ALTIVEC */
1800 @@ -2589,38 +2427,6 @@
1804 - * Copy a whole page. We use the dcbz instruction on the destination
1805 - * to reduce memory traffic (it eliminates the unnecessary reads of
1806 - * the destination into cache). This requires that the destination
1810 - li r0,4096/CACHE_LINE_SIZE
1836 * Flush entries from the hash table with VSIDs in the range
1839 @@ -2798,6 +2604,7 @@
1842 lwz r4,rtas_data@l(r4)
1843 + addis r4,r4,-KERNELBASE@h
1844 lis r6,1f@ha /* physical return address for rtas */
1846 addis r6,r6,-KERNELBASE@h
1847 @@ -2817,7 +2624,6 @@
1853 1: addis r9,r1,-KERNELBASE@h
1854 lwz r8,20(r9) /* get return address */
1855 @@ -2826,7 +2632,6 @@
1860 rfi /* return to caller */
1861 #endif /* CONFIG_8xx */
1863 @@ -2851,6 +2656,30 @@
1866 #endif /* CONFIG_8xx */
1869 + * We put a few things here that have to be page-aligned.
1870 + * This stuff goes at the beginning of the data segment,
1871 + * which is page-aligned.
1876 + .globl empty_zero_page
1880 + .globl swapper_pg_dir
1885 + * This space gets a copy of optional info passed to us by the bootstrap
1886 + * Used to pass parameters into the kernel like root=/dev/sda1, etc.
1893 * An undocumented "feature" of 604e requires that the v bit
1894 @@ -2895,117 +2724,4 @@
1899 -/* Use the first pair of BAT registers to map the 1st 16MB
1900 - * of RAM to KERNELBASE. From this point on we can't safely
1901 - * call OF any more.
1904 - lis r11,KERNELBASE@h
1906 - rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
1909 - ori r11,r11,4 /* set up BAT registers for 601 */
1910 - li r8,0x7f /* valid, block length = 8MB */
1911 - oris r9,r11,0x800000@h /* set up BAT reg for 2nd 8M */
1912 - oris r10,r8,0x800000@h /* set up BAT reg for 2nd 8M */
1913 - mtspr IBAT0U,r11 /* N.B. 601 has valid bit in */
1914 - mtspr IBAT0L,r8 /* lower BAT register */
1920 - ori r11,r11,BL_8M<<2|0x2 /* set up an 8MB mapping */
1921 - ori r11,r11,0xfe /* set up an 8MB mapping */
1922 - lis r8,CYBERBASEp@h
1924 - addis r8,r8,KERNELBASE@h
1927 - ori r11,r11,BL_256M<<2|0x2 /* set up BAT registers for 604 */
1928 - li r8,2 /* R/W access */
1930 - * If the MMU is off clear the bats. See clear_bat() -- Cort
1932 -#ifndef CONFIG_GEMINI
1934 - * allow secondary cpus to get at all of ram in early bootup
1935 - * since their init_task may be up there -- Cort
1937 - oris r18,r8,0x10000000@h
1938 - oris r21,r11,(KERNELBASE+0x10000000)@h
1939 - mtspr DBAT1L,r18 /* N.B. 6xx (not 601) have valid */
1940 - mtspr DBAT1U,r21 /* bit in upper BAT register */
1944 - oris r18,r8,0x20000000@h
1945 - oris r21,r11,(KERNELBASE+0x20000000)@h
1946 - mtspr DBAT2L,r18 /* N.B. 6xx (not 601) have valid */
1947 - mtspr DBAT2U,r21 /* bit in upper BAT register */
1950 -#endif /* ndef CONFIG_GEMINI */
1952 - mtspr DBAT0L,r8 /* N.B. 6xx (not 601) have valid */
1953 - mtspr DBAT0U,r11 /* bit in upper BAT register */
1959 -#ifdef CONFIG_BOOTX_TEXT
1962 - * setup the display bat prepared for us in prom.c
1967 - lis r8, disp_BATL@h
1968 - ori r8, r8, disp_BATL@l
1971 - lis r11, disp_BATU@h
1972 - ori r11, r11, disp_BATU@l
1978 - rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
1988 - * We put a few things here that have to be page-aligned.
1989 - * This stuff goes at the beginning of the data segment,
1990 - * which is page-aligned.
1995 - .globl empty_zero_page
1999 - .globl swapper_pg_dir
2004 - * This space gets a copy of optional info passed to us by the bootstrap
2005 - * Used to pass parameters into the kernel like root=/dev/sda1, etc.
2012 diff -urN linux.orig/arch/ppc/kernel/irq.c linux/arch/ppc/kernel/irq.c
2013 --- linux.orig/arch/ppc/kernel/irq.c Sun Mar 25 18:31:48 2001
2014 +++ linux/arch/ppc/kernel/irq.c Thu Jul 11 15:43:29 2002
2017 #include "local_irq.h"
2019 -extern atomic_t ipi_recv;
2020 -extern atomic_t ipi_sent;
2021 -void enable_irq(unsigned int irq_nr);
2022 +extern volatile unsigned long ipi_count;
2023 void enable_irq(unsigned int irq_nr);
2024 void disable_irq(unsigned int irq_nr);
2026 @@ -139,21 +137,20 @@
2030 - p = &irq_desc[irq].action;
2031 - while ((action = *p) != NULL && action->dev_id != dev_id)
2032 - p = &action->next;
2033 - if (action == NULL)
2036 - /* Found it - now free it */
2037 - save_flags(flags);
2039 - *p = action->next;
2040 - if (irq_desc[irq].action == NULL)
2042 - restore_flags(flags);
2043 - irq_kfree(action);
2045 + for (p = &irq_desc[irq].action; (action = *p) != NULL; p = &action->next)
2047 + if (action->dev_id == dev_id)
2049 + /* Found it - now free it */
2050 + save_flags(flags);
2052 + *p = action->next;
2053 + restore_flags(flags);
2054 + irq_kfree(action);
2061 action = (struct irqaction *)
2062 @@ -244,10 +241,8 @@
2065 /* should this be per processor send/receive? */
2066 - /* should this be per processor send/receive? */
2067 - len += sprintf(buf+len, "IPI: (recv/sent) %10lu/%lu\n",
2068 - atomic_read(&ipi_recv), atomic_read(&ipi_sent));
2069 -#endif /* __SMP__ */
2070 + len += sprintf(buf+len, "IPI: %10lu\n", ipi_count);
2072 len += sprintf(buf+len, "BAD: %10u\n", ppc_spurious_interrupts);
2075 @@ -322,14 +317,10 @@
2076 atomic_t global_bh_count;
2077 atomic_t global_bh_lock;
2079 -extern unsigned long *_get_SP(void);
2081 static void show(char * str)
2085 unsigned long *stack;
2087 int cpu = smp_processor_id();
2089 printk("\n%s, CPU %d:\n", str, cpu);
2090 @@ -341,10 +332,6 @@
2091 atomic_read(&global_bh_count),
2092 ppc_local_bh_count[0],
2093 ppc_local_bh_count[1]);
2095 - printk(" CPU: %d last CPU: %d\n", current->processor,current->last_processor);
2096 - print_backtrace (_get_SP());
2098 stack = (unsigned long *) &str;
2099 for (i = 40; i ; i--) {
2100 unsigned long x = *++stack;
2102 printk("<[%08lx]> ", x);
2108 static inline void wait_on_bh(void)
2109 diff -urN linux.orig/arch/ppc/kernel/local_irq.h linux/arch/ppc/kernel/local_irq.h
2110 --- linux.orig/arch/ppc/kernel/local_irq.h Sun Mar 25 18:31:49 2001
2111 +++ linux/arch/ppc/kernel/local_irq.h Thu Jul 11 15:43:29 2002
2114 struct irqaction *action;
2115 struct hw_interrupt_type *ctl;
2119 extern struct irqdesc irq_desc[NR_IRQS];
2120 diff -urN linux.orig/arch/ppc/kernel/mbx_pci.c linux/arch/ppc/kernel/mbx_pci.c
2121 --- linux.orig/arch/ppc/kernel/mbx_pci.c Sun Mar 25 18:31:49 2001
2122 +++ linux/arch/ppc/kernel/mbx_pci.c Thu Jul 11 15:43:29 2002
2126 #include <asm/mbx.h>
2127 -#include <asm/machdep.h>
2132 * This blows......The MBX uses the Tundra QSpan PCI bridge. When
2133 diff -urN linux.orig/arch/ppc/kernel/mbx_setup.c linux/arch/ppc/kernel/mbx_setup.c
2134 --- linux.orig/arch/ppc/kernel/mbx_setup.c Sun Mar 25 18:31:49 2001
2135 +++ linux/arch/ppc/kernel/mbx_setup.c Thu Jul 11 15:43:29 2002
2137 #include <linux/init.h>
2138 #include <linux/blk.h>
2139 #include <linux/ioport.h>
2140 -#include <linux/delay.h>
2142 #include <asm/mmu.h>
2143 #include <asm/processor.h>
2145 #include <asm/ide.h>
2146 #include <asm/mbx.h>
2147 #include <asm/machdep.h>
2148 -#include <asm/keyboard.h>
2149 -#include <asm/8xx_immap.h>
2150 -#include <asm/time.h>
2153 #include "local_irq.h"
2155 static int mbx_set_rtc_time(unsigned long time);
2156 unsigned long mbx_get_rtc_time(void);
2157 void mbx_calibrate_decr(void);
2159 -extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
2160 -extern int pckbd_getkeycode(unsigned int scancode);
2161 -extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
2163 -extern char pckbd_unexpected_up(unsigned char keycode);
2164 -extern void pckbd_leds(unsigned char leds);
2165 -extern void pckbd_init_hw(void);
2166 -extern unsigned char pckbd_sysrq_xlate[128];
2168 extern int mackbd_setkeycode(unsigned int scancode, unsigned int keycode);
2169 extern int mackbd_getkeycode(unsigned int scancode);
2170 extern int mackbd_translate(unsigned char scancode, unsigned char *keycode,
2172 extern void mackbd_leds(unsigned char leds);
2173 extern void mackbd_init_hw(void);
2175 +extern unsigned long loops_per_jiffy;
2177 unsigned long empty_zero_page[1024];
2179 #ifdef CONFIG_BLK_DEV_RAM
2181 ppc_md.kbd_leds = pckbd_leds;
2182 ppc_md.kbd_init_hw = pckbd_init_hw;
2183 #ifdef CONFIG_MAGIC_SYSRQ
2184 - ppc_md.sysrq_xlate = pckbd_sysrq_xlate;
2185 + ppc_md.kbd_sysrq_xlate = pckbd_sysrq_xlate;
2189 diff -urN linux.orig/arch/ppc/kernel/misc.S linux/arch/ppc/kernel/misc.S
2190 --- linux.orig/arch/ppc/kernel/misc.S Sun Mar 25 18:37:30 2001
2191 +++ linux/arch/ppc/kernel/misc.S Thu Jul 11 15:43:29 2002
2192 @@ -125,33 +125,12 @@
2196 -#if defined(CONFIG_SMP)
2199 - rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */
2202 - lis r9,hash_table_lock@h
2203 - ori r9,r9,hash_table_lock@l
2204 - lwz r8,PROCESSOR(r2)
2212 -#endif /* CONFIG_SMP */
2220 - stw r0,0(r9) /* clear hash_table_lock */
2226 @@ -159,32 +138,11 @@
2227 * Flush MMU TLB for a particular address
2230 -#if defined(CONFIG_SMP)
2233 - rlwinm r0,r10,0,17,15 /* clear bit 16 (MSR_EE) */
2236 - lis r9,hash_table_lock@h
2237 - ori r9,r9,hash_table_lock@l
2238 - lwz r8,PROCESSOR(r2)
2246 -#endif /* CONFIG_SMP */
2254 - stw r0,0(r9) /* clear hash_table_lock */
2260 @@ -317,8 +275,10 @@
2261 stwcx. r5,0,r3 /* Update with new value */
2262 bne- 10b /* Retry if "reservation" (i.e. lock) lost */
2266 + cmpi 0,r5,0 /* Return 'true' IFF 0 */
2271 _GLOBAL(atomic_clear_mask)
2273 @@ -354,10 +314,8 @@
2274 * The *_ns versions don't do byte-swapping.
2284 @@ -365,10 +323,8 @@
2295 @@ -376,10 +332,8 @@
2306 @@ -387,10 +341,8 @@
2317 @@ -398,10 +350,8 @@
2328 @@ -409,10 +359,8 @@
2339 @@ -421,10 +369,8 @@
2350 @@ -433,10 +379,8 @@
2361 @@ -444,10 +388,8 @@
2372 @@ -455,10 +397,8 @@
2383 @@ -466,59 +406,48 @@
2387 - * Extended precision shifts.
2389 - * Updated to be valid for shift counts from 0 to 63 inclusive.
2391 + * Extended precision shifts
2393 * R3/R4 has 64 bit value
2394 * R5 has shift count
2397 - * ashrdi3: arithmetic right shift (sign propagation)
2398 - * lshrdi3: logical right shift
2399 - * ashldi3: left shift
2400 + * ashrdi3: XXXYYY/ZZZAAA -> SSSXXX/YYYZZZ
2401 + * ashldi3: XXXYYY/ZZZAAA -> YYYZZZ/AAA000
2402 + * lshrdi3: XXXYYY/ZZZAAA -> 000XXX/YYYZZZ
2406 - srw r4,r4,r5 # LSW = count > 31 ? 0 : LSW >> count
2407 - addi r7,r5,32 # could be xori, or addi with -32
2408 - slw r6,r3,r6 # t1 = count > 31 ? 0 : MSW << (32-count)
2409 - rlwinm r8,r7,0,32 # t3 = (count < 32) ? 32 : 0
2410 - sraw r7,r3,r7 # t2 = MSW >> (count-32)
2411 - or r4,r4,r6 # LSW |= t1
2412 - slw r7,r7,r8 # t2 = (count < 32) ? 0 : t2
2413 - sraw r3,r3,r5 # MSW = MSW >> count
2414 - or r4,r4,r7 # LSW |= t2
2417 + slw r7,r3,r6 /* isolate YYY */
2418 + srw r4,r4,r5 /* isolate ZZZ */
2419 + or r4,r4,r7 /* YYYZZZ */
2420 + sraw r3,r3,r5 /* SSSXXX */
2425 - slw r3,r3,r5 # MSW = count > 31 ? 0 : MSW << count
2426 - addi r7,r5,32 # could be xori, or addi with -32
2427 - srw r6,r4,r6 # t1 = count > 31 ? 0 : LSW >> (32-count)
2428 - slw r7,r4,r7 # t2 = count < 32 ? 0 : LSW << (count-32)
2429 - or r3,r3,r6 # MSW |= t1
2430 - slw r4,r4,r5 # LSW = LSW << count
2431 - or r3,r3,r7 # MSW |= t2
2434 + srw r7,r4,r6 /* isolate ZZZ */
2435 + slw r4,r4,r5 /* AAA000 */
2436 + slw r3,r3,r5 /* YYY--- */
2437 + or r3,r3,r7 /* YYYZZZ */
2442 - srw r4,r4,r5 # LSW = count > 31 ? 0 : LSW >> count
2443 - addi r7,r5,32 # could be xori, or addi with -32
2444 - slw r6,r3,r6 # t1 = count > 31 ? 0 : MSW << (32-count)
2445 - srw r7,r3,r7 # t2 = count < 32 ? 0 : MSW >> (count-32)
2446 - or r4,r4,r6 # LSW |= t1
2447 - srw r3,r3,r5 # MSW = MSW >> count
2448 - or r4,r4,r7 # LSW |= t2
2451 + slw r7,r3,r6 /* isolate YYY */
2452 + srw r4,r4,r5 /* isolate ZZZ */
2453 + or r4,r4,r7 /* YYYZZZ */
2454 + srw r3,r3,r5 /* 000XXX */
2468 mr r3,r1 /* Close enough */
2469 @@ -563,14 +492,6 @@
2470 isync /* Handle erratas in some cases */
2483 Copyright © 1997-1998 by PowerLogix R & D, Inc.
2484 @@ -592,17 +513,6 @@
2486 Thur, Dec. 12, 1998.
2487 - First public release, contributed by PowerLogix.
2489 - Sat, Aug. 7, 1999.
2490 - - Terry: Made sure code disabled interrupts before running. (Previously
2491 - it was assumed interrupts were already disabled).
2492 - - Terry: Updated for tentative G4 support. 4MB of memory is now flushed
2493 - instead of 2MB. (Prob. only 3 is necessary).
2494 - - Terry: Updated for workaround to HID0[DPM] processor bug
2495 - during global invalidates.
2497 - Thu, July 13, 2000.
2498 - - Terry: Added isync to correct for an errata.
2500 Author: Terry Greeniaus (tgree@phys.ualberta.ca)
2501 Please e-mail updates to this file to me, thanks!
2502 @@ -641,94 +551,80 @@
2503 causes cache pushes from the L1 cache to go to the L2 cache
2504 instead of to main memory.
2507 - * Summary: this procedure ignores the L2I bit in the value passed in,
2508 - * flushes the cache if it was already enabled, always invalidates the
2509 - * cache, then enables the cache if the L2E bit is set in the value
2515 - /* Make sure this is a 750 or 7400 chip */
2516 + /* Make sure this is a 750 chip */
2518 rlwinm r4,r4,16,16,31
2520 - cmpwi cr1,r4,0x000c
2524 - /* Turn off interrupts and data relocation. */
2525 - mfmsr r7 /* Save MSR in r7 */
2526 - rlwinm r4,r7,0,17,15
2527 - rlwinm r4,r4,0,28,26 /* Turn off DR bit */
2534 + /* Get the current enable bit of the L2CR into r4 */
2538 + /* See if we want to perform a global inval this time. */
2539 + rlwinm r6,r3,0,10,10 /* r6 contains the new invalidate bit */
2540 + rlwinm. r5,r3,0,0,0 /* r5 contains the new enable bit */
2541 + rlwinm r3,r3,0,11,9 /* Turn off the invalidate bit */
2542 + rlwimi r3,r4,0,0,0 /* Keep the enable bit the same as it was. */
2543 + bne dontDisableCache /* Only disable the cache if L2CRApply
2544 + has the enable bit off */
2547 + /* Disable the cache. First, we turn off interrupts.
2548 + An interrupt while we are flushing the cache could bring
2549 + in data which may not get properly flushed. */
2550 + rlwinm r4,r7,0,17,15 /* Turn off EE bit */
2555 - /* Get the current enable bit of the L2CR into r4 */
2558 - /* Tweak some bits */
2559 - rlwinm r5,r3,0,0,0 /* r5 contains the new enable bit */
2560 - rlwinm r3,r3,0,11,9 /* Turn off the invalidate bit */
2561 - rlwinm r3,r3,0,1,31 /* Turn off the enable bit */
2563 - /* Check to see if we need to flush */
2564 - rlwinm. r4,r4,0,0,0
2567 - /* Flush the cache. First, read the first 4MB of memory (physical) to
2568 - * put new data in the cache. (Actually we only need
2569 - * the size of the L2 cache plus the size of the L1 cache, but 4MB will
2570 - * cover everything just to be safe).
2573 - /**** Might be a good idea to set L2DO here - to prevent instructions
2574 - from getting into the cache. But since we invalidate
2575 - the next time we enable the cache it doesn't really matter.
2580 + Now, read the first 2MB of memory to put new data in the cache.
2581 + (Actually we only need the size of the L2 cache plus the size
2582 + of the L1 cache, but 2MB will cover everything just to be safe).
2589 - addi r4,r4,32 /* Go to start of next cache line */
2590 + lis r4,KERNELBASE@h
2592 + addi r4,r4,0x0020 /* Go to start of next cache line */
2595 - /* Now, flush the first 4MB of memory */
2597 + /* Now, flush the first 2MB of memory */
2601 + lis r4,KERNELBASE@h
2605 - addi r4,r4,32 /* Go to start of next cache line */
2609 - /* Set up the L2CR configuration bits (and switch L2 off) */
2611 + addi r4,r4,0x0020 /* Go to start of next cache line */
2614 + /* Turn off the L2CR enable bit. */
2615 + rlwinm r3,r3,0,1,31
2618 + /* Set up the L2CR configuration bits */
2623 - /* Before we perform the global invalidation, we must disable dynamic
2624 - * power management via HID0[DPM] to work around a processor bug where
2625 - * DPM can possibly interfere with the state machine in the processor
2626 - * that invalidates the L2 cache tags.
2628 - mfspr r8,HID0 /* Save HID0 in r8 */
2629 - rlwinm r4,r8,0,12,10 /* Turn off HID0[DPM] */
2631 - mtspr HID0,r4 /* Disable DPM */
2632 + /* Reenable interrupts if necessary. */
2640 /* Perform a global invalidation */
2645 - isync /* For errata */
2647 /* Wait for the invalidation to complete */
2649 @@ -740,38 +636,25 @@
2653 - /* Restore HID0[DPM] to whatever it was before */
2659 /* See if we need to enable the cache */
2664 /* Enable the cache */
2669 - /* Restore MSR (restores EE and DR bits to original state) */
2679 /* Make sure this is a 750 chip */
2683 - cmpwi cr1,r3,0x000c
2684 + rlwinm r3,r3,16,16,31
2690 /* Return the L2CR contents */
2693 @@ -779,6 +662,16 @@
2694 /* --- End of PowerLogix code ---
2709 * These are used in the alignment trap handler when emulating
2710 @@ -1036,7 +929,11 @@
2711 .long sys_getresuid /* 165 */
2712 .long sys_query_module
2715 .long sys_nfsservctl
2717 + .long sys_ni_syscall
2720 .long sys_getresgid /* 170 */
2722 @@ -1058,18 +955,4 @@
2723 .long sys_ni_syscall /* streams1 */
2724 .long sys_ni_syscall /* streams2 */
2726 - .long sys_ni_syscall /* 190 */ /* MacOnLinux - old */
2727 - .long sys_ni_syscall /* 191 */ /* Unused */
2728 - .long sys_ni_syscall /* 192 - reserved - mmap2 */
2729 - .long sys_ni_syscall /* 193 - reserved - truncate64 */
2730 - .long sys_ni_syscall /* 194 - reserved - ftruncate64 */
2731 - .long sys_ni_syscall /* 195 - reserved - stat64 */
2732 - .long sys_ni_syscall /* 196 - reserved - lstat64 */
2733 - .long sys_ni_syscall /* 197 - reserved - fstat64 */
2734 - .long sys_pciconfig_read /* 198 */
2735 - .long sys_pciconfig_write /* 199 */
2736 - .long sys_pciconfig_iobase /* 200 */
2737 - .long sys_ni_syscall /* 201 - reserved - MacOnLinux - new */
2738 - .rept NR_syscalls-201
2739 - .long sys_ni_syscall
2741 + .space (NR_syscalls-183)*4
2742 diff -urN linux.orig/arch/ppc/kernel/mk_defs.c linux/arch/ppc/kernel/mk_defs.c
2743 --- linux.orig/arch/ppc/kernel/mk_defs.c Fri Nov 2 17:39:05 2001
2744 +++ linux/arch/ppc/kernel/mk_defs.c Thu Jul 11 15:43:29 2002
2746 * #defines from the assembly-language output.
2749 -#include <linux/config.h>
2750 +#include <stddef.h>
2751 #include <linux/signal.h>
2752 #include <linux/sched.h>
2753 #include <linux/kernel.h>
2755 #include <asm/page.h>
2756 #include <asm/pgtable.h>
2757 #include <asm/processor.h>
2758 +#include <asm/pf-compat.h>
2760 #define DEFINE(sym, val) \
2761 asm volatile("\n#define\t" #sym "\t%0" : : "i" (val))
2763 DEFINE(PGD, offsetof(struct mm_struct, pgd));
2764 DEFINE(LAST_SYSCALL, offsetof(struct thread_struct, last_syscall));
2765 DEFINE(PT_REGS, offsetof(struct thread_struct, regs));
2766 - DEFINE(PT_TRACESYS, PT_TRACESYS);
2767 + DEFINE(PF_TRACESYS, PF_TRACESYS);
2768 DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
2769 - DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));
2770 DEFINE(NEED_RESCHED, offsetof(struct task_struct, need_resched));
2771 DEFINE(TSS_FPR0, offsetof(struct thread_struct, fpr[0]));
2772 DEFINE(TSS_FPSCR, offsetof(struct thread_struct, fpscr));
2773 -#ifdef CONFIG_ALTIVEC
2774 - DEFINE(TSS_VR0, offsetof(struct thread_struct, vr[0]));
2775 - DEFINE(TSS_VRSAVE, offsetof(struct thread_struct, vrsave));
2776 - DEFINE(TSS_VSCR, offsetof(struct thread_struct, vscr));
2777 -#endif /* CONFIG_ALTIVEC */
2779 /* Interrupt register frame */
2780 DEFINE(TASK_UNION_SIZE, sizeof(union task_union));
2781 DEFINE(STACK_FRAME_OVERHEAD, STACK_FRAME_OVERHEAD);
2782 diff -urN linux.orig/arch/ppc/kernel/open_pic.c linux/arch/ppc/kernel/open_pic.c
2783 --- linux.orig/arch/ppc/kernel/open_pic.c Sun Mar 25 18:31:49 2001
2784 +++ linux/arch/ppc/kernel/open_pic.c Thu Jul 11 15:43:29 2002
2789 - * Common support routines for platforms with an OpenPIC interrupt controller
2793 #include <linux/stddef.h>
2794 #include <linux/init.h>
2795 #include <linux/sched.h>
2796 #include <linux/signal.h>
2797 #include <linux/openpic.h>
2798 #include <asm/irq.h>
2799 -#include <asm/processor.h>
2800 #include "open_pic.h"
2803 -extern volatile unsigned char *chrp_int_ack_special;
2805 -void open_pic_do_IRQ(struct pt_regs *regs, int cpu, int isfake)
2808 - int openpic_eoi_done = 0;
2812 - unsigned int loops = 1000000;
2813 - while (test_bit(0, &global_irq_lock)) {
2814 - if (smp_processor_id() == global_irq_holder) {
2815 - printk("uh oh, interrupt while we hold global irq lock!\n");
2821 - if (loops-- == 0) {
2822 - printk("do_IRQ waiting for irq lock (holder=%d)\n", global_irq_holder);
2829 +void openpic_ipi_action(int cpl, void *dev_id, struct pt_regs *regs)
2831 + smp_message_recv(cpl-OPENPIC_VEC_IPI);
2833 #endif /* __SMP__ */
2835 - irq = openpic_irq(smp_processor_id());
2836 - /* make sure open_pic.irq_offset is set to something!
2837 - * do we really need the _MACH_Pmac test??
2839 - if (!(_machine == _MACH_Pmac) && (irq == open_pic.irq_offset))
2842 - * This magic address generates a PCI IACK cycle.
2844 - * This should go in the above mask/ack code soon. -- Cort
2846 - if ( chrp_int_ack_special )
2847 - irq = *chrp_int_ack_special;
2848 -#ifndef CONFIG_PMAC
2850 - irq = i8259_irq(0);
2853 - * Acknowledge as soon as possible to allow i8259
2854 - * interrupt nesting */
2855 - openpic_eoi(smp_processor_id());
2856 - openpic_eoi_done = 1;
2858 - if (irq == OPENPIC_VEC_SPURIOUS)
2861 - * Spurious interrupts should never be
2864 - ppc_spurious_interrupts++;
2865 - openpic_eoi_done = 1;
2871 - printk(KERN_DEBUG "Bogus interrupt %d from PC = %lx\n",
2873 - ppc_spurious_interrupts++;
2877 - ppc_irq_dispatch_handler( regs, irq );
2880 - if (!openpic_eoi_done)
2881 - openpic_eoi(smp_processor_id());
2882 +void chrp_mask_and_ack_irq(unsigned int irq_nr)
2884 + if ((_machine != _MACH_gemini) && is_8259_irq(irq_nr))
2885 + i8259_pic.mask_and_ack(irq_nr);
2889 -void openpic_ipi_action(int cpl, void *dev_id, struct pt_regs *regs)
2890 +static void chrp_mask_irq(unsigned int irq_nr)
2892 - smp_message_recv(cpl-OPENPIC_VEC_IPI);
2893 + if ((_machine != _MACH_gemini) && is_8259_irq(irq_nr))
2894 + i8259_pic.disable(irq_nr);
2896 + openpic_disable_irq(irq_nr-open_pic.irq_offset);
2898 -#endif /* __SMP__ */
2900 +static void chrp_unmask_irq(unsigned int irq_nr)
2902 + if ((_machine != _MACH_gemini) && is_8259_irq(irq_nr))
2903 + i8259_pic.enable(irq_nr);
2905 + openpic_enable_irq(irq_nr-open_pic.irq_offset);
2908 struct hw_interrupt_type open_pic = {
2913 - openpic_enable_irq,
2914 - openpic_disable_irq,
2915 - /* Theorically, the mask&ack should be NULL for OpenPIC. However, doing
2916 - * so shows tons of bogus interrupts coming in.
2917 - * This problem is apparently due to the common code always calling
2918 - * unmask(). I apparently (need more test) fixed it in the 2.4 new IRQ
2919 - * management by cleanly implementing the handler's end() function, so
2920 - * neither mask nor unmask are needed. In the meantime, the fix below will
2921 - * work for 2.2 -Benh
2923 - * Hopefully this will fix my bogus interrups on MTX
2924 - * I merged everthing together so we don't have the same code in three
2925 - * places. This might cause stability problems, but I'd rather
2926 - * get it right once than three different times because someone forgot
2927 - * to make the same change to PReP or something --Troy
2929 - openpic_disable_irq,
2932 + chrp_mask_and_ack_irq,
2935 diff -urN linux.orig/arch/ppc/kernel/open_pic.h linux/arch/ppc/kernel/open_pic.h
2936 --- linux.orig/arch/ppc/kernel/open_pic.h Sun Mar 25 18:31:49 2001
2937 +++ linux/arch/ppc/kernel/open_pic.h Thu Jul 11 15:43:29 2002
2940 extern struct hw_interrupt_type open_pic;
2942 -void open_pic_do_IRQ(struct pt_regs *regs, int cpu, int isfake);
2943 void openpic_ipi_action(int cpl, void *dev_id, struct pt_regs *regs);
2944 void openpic_enable_IPI(u_int ipi);
2945 void do_openpic_setup_cpu(void);
2946 diff -urN linux.orig/arch/ppc/kernel/openpic.c linux/arch/ppc/kernel/openpic.c
2947 --- linux.orig/arch/ppc/kernel/openpic.c Fri Nov 2 17:39:05 2001
2948 +++ linux/arch/ppc/kernel/openpic.c Thu Jul 11 15:43:29 2002
2951 * Fixed up IPI and restructured a bit
2952 * Cort Dougan <cort@ppc.kernel.org>
2954 - * Added initialisation code for Apple Core99 machines, tweaked a few things
2955 - * to avoid bogus interrupts and to make sure the disable function exits with
2956 - * the interrupt actually masked. --BenH
2957 - * Todo: map interrupts to all available CPUs after the ack round
2959 * This file is subject to the terms and conditions of the GNU General Public
2960 * License. See the file COPYING in the main directory of this archive
2963 #include <asm/irq.h>
2964 #include "open_pic.h"
2966 -#include <asm/prom.h>
2969 #define REGISTER_DEBUG
2970 #undef REGISTER_DEBUG
2973 -extern int use_of_interrupt_tree;
2975 +#define OPENPIC_SENSE_POLARITY 0x00800000 /* Undoc'd */
2977 volatile struct OpenPIC *OpenPIC = NULL;
2978 u_int OpenPIC_NumInitSenses __initdata = 0;
2983 -static inline u_int in_le32(volatile u_int *addr)
2984 +static inline u_int ld_le32(volatile u_int *addr)
2992 - val = in_le32(addr);
2993 + val = ld_le32(addr);
2994 #ifdef REGISTER_DEBUG
2995 printk("openpic_read(0x%08x) = 0x%08x\n", (u_int)addr, val);
2999 openpic_setfield(addr, OPENPIC_MASK);
3000 /* wait until it's not in use */
3001 - /* BenH: Is this code really enough ? I would rather check the result
3002 - * and eventually retry ...
3004 while (openpic_read(addr) & OPENPIC_ACTIVITY);
3005 openpic_writefield(addr, mask | OPENPIC_MASK, field | OPENPIC_MASK);
3007 @@ -164,20 +151,7 @@
3009 * Initialize the OpenPIC
3014 - * With BootX, we consider the controller as beeing already initialized by MacOS
3015 - * and we only mask out interrupts.
3016 - * With OF booting, we initialize the interrupts that we find in the device tree,
3017 - * other ones are just masked out.
3018 - * Note: We might want to adjust priorities too.
3021 -/* Not an init func, called on pbook wakeup --BenH */
3024 -openpic_init(int main_pic)
3025 +__initfunc(void openpic_init(int main_pic))
3029 @@ -207,16 +181,13 @@
3030 OPENPIC_FEATURE_LAST_SOURCE_SHIFT) + 1;
3031 printk("OpenPIC Version %s (%d CPUs and %d IRQ sources) at %p\n", version,
3032 NumProcessors, NumSources, OpenPIC);
3033 - /* Apple's OpenPIC is an IBM MPIC without the timer. */
3034 - if (_machine != _MACH_Pmac) {
3035 - timerfreq = openpic_read(&OpenPIC->Global.Timer_Frequency);
3036 - printk("OpenPIC timer frequency is ");
3038 - printk("%d Hz\n", timerfreq);
3040 - printk("not set\n");
3043 + timerfreq = openpic_read(&OpenPIC->Global.Timer_Frequency);
3044 + printk("OpenPIC timer frequency is ");
3046 + printk("%d Hz\n", timerfreq);
3048 + printk("not set\n");
3052 /* Initialize timer interrupts */
3053 @@ -229,60 +200,24 @@
3055 /* Initialize IPI interrupts */
3056 for (i = 0; i < OPENPIC_NUM_IPI; i++) {
3057 - openpic_initipi(i, 10+i, OPENPIC_VEC_IPI+i);
3058 + openpic_initipi(i, 10, OPENPIC_VEC_IPI+i);
3061 - if (_machine != _MACH_Pmac) {
3062 - /* Initialize external interrupts */
3063 - for (i = 0; i < NumSources; i++) {
3064 - /* Enabled, Priority 8 */
3065 - openpic_initirq(i, 8, open_pic.irq_offset+i, 0,
3066 - i < OpenPIC_NumInitSenses ? OpenPIC_InitSenses[i] : 1);
3068 - openpic_mapirq(i, 1<<0);
3071 - /* Prevent any interrupt from occurring during initialisation.
3072 - * Hum... I believe this is not necessary, Apple does that in
3073 - * Darwin's PowerExpress code.
3075 - openpic_set_priority(0, 0xf);
3077 - /* First disable all interrupts and map them to CPU 0 */
3078 - for (i = 0; i < NumSources; i++) {
3079 - openpic_disable_irq(i);
3080 - openpic_mapirq(i, 1<<0);
3083 - /* If we use the device tree, then lookup all interrupts and
3084 - * initialize them according to sense infos found in the tree
3086 - if (use_of_interrupt_tree) {
3087 - struct device_node* np = find_all_nodes();
3090 - pri = strcmp(np->name, "programmer-switch") ? 2 : 7;
3091 - for (j=0;j<np->n_intrs;j++) {
3092 - openpic_initirq( np->intrs[j].line,
3094 - np->intrs[j].line,
3096 - np->intrs[j].sense);
3097 - irq_desc[np->intrs[j].line].level = np->intrs[j].sense;
3102 - /* Fixme: read level value from controller */
3103 - printk("openpic: WARNING, openpic running without interrupt tree\n");
3105 + /* Initialize external interrupts */
3106 + for (i = 0; i < NumSources; i++) {
3107 + /* Enabled, Priority 8 */
3108 + openpic_initirq(i, 8, open_pic.irq_offset+i, 0,
3109 + i < OpenPIC_NumInitSenses ? OpenPIC_InitSenses[i] : 1);
3111 + openpic_mapirq(i, 1<<0);
3115 /* Initialize the spurious interrupt */
3116 openpic_set_spurious(OPENPIC_VEC_SPURIOUS);
3118 /* Gemini has no i8259 */
3119 - if (( _machine != _MACH_gemini ) && (_machine != _MACH_Pmac)) {
3120 + if ( _machine != _MACH_gemini )
3122 /* SIOint (8259 cascade) is special */
3123 openpic_initirq(0, 8, open_pic.irq_offset, 1, 1);
3124 openpic_mapirq(0, 1<<0);
3125 @@ -292,14 +227,6 @@
3127 openpic_set_priority(0, 0);
3128 openpic_disable_8259_pass_through();
3130 - /* We ack pending interrupts to avoid blocking them */
3131 - if (_machine == _MACH_Pmac) {
3132 - for (i = 0; i < NumSources; i++) {
3133 - (void)openpic_irq(0);
3140 @@ -311,10 +238,6 @@
3142 openpic_setfield(&OpenPIC->Global.Global_Configuration0,
3143 OPENPIC_CONFIG_RESET);
3144 - /* Wait for reset to complete */
3145 - while(openpic_readfield(&OpenPIC->Global.Global_Configuration0,
3146 - OPENPIC_CONFIG_RESET))
3154 openpic_write(&OpenPIC->THIS_CPU.EOI, 0);
3155 - (void)openpic_read(&OpenPIC->THIS_CPU.EOI);
3159 @@ -465,12 +387,12 @@
3161 for ( i = 0; i < OPENPIC_NUM_IPI ; i++ )
3162 openpic_enable_IPI(i);
3165 /* let the openpic know we want intrs */
3166 for ( i = 0; i < NumSources ; i++ )
3167 openpic_mapirq(i, openpic_read(&OpenPIC->Source[i].Destination)
3168 | (1<<smp_processor_id()) );
3171 openpic_set_priority(smp_processor_id(), 0);
3174 @@ -506,43 +428,14 @@
3176 void openpic_enable_irq(u_int irq)
3178 - /* on SMP, we get IPI vector numbers here, we should handle them
3179 - * or at least ignore them.
3181 - if (irq < 0 || irq >= NumSources)
3183 + check_arg_irq(irq);
3184 openpic_clearfield(&OpenPIC->Source[irq].Vector_Priority, OPENPIC_MASK);
3185 - /* make sure mask gets to controller before we return to user */
3188 - } while(openpic_readfield(&OpenPIC->Source[irq].Vector_Priority,
3192 -u_int openpic_get_enable(u_int irq)
3194 - if (irq < 0 || irq >= NumSources)
3196 - return !openpic_readfield(&OpenPIC->Source[irq].Vector_Priority,
3200 void openpic_disable_irq(u_int irq)
3204 - /* on SMP, we get IPI vector numbers here, we should handle them
3205 - * or at least ignore them.
3207 - if (irq < 0 || irq >= NumSources)
3209 + check_arg_irq(irq);
3210 openpic_setfield(&OpenPIC->Source[irq].Vector_Priority, OPENPIC_MASK);
3211 - /* make sure mask gets to controller before we return to user */
3213 - mb(); /* sync is probably useless here */
3214 - vp = openpic_readfield(&OpenPIC->Source[irq].Vector_Priority,
3215 - OPENPIC_MASK | OPENPIC_ACTIVITY);
3216 - } while((vp & OPENPIC_ACTIVITY) && !(vp & OPENPIC_MASK));
3220 @@ -561,11 +454,10 @@
3222 openpic_safe_writefield(&OpenPIC->Source[irq].Vector_Priority,
3223 OPENPIC_PRIORITY_MASK | OPENPIC_VECTOR_MASK |
3224 - OPENPIC_POLARITY_MASK | OPENPIC_SENSE_MASK,
3225 + OPENPIC_SENSE_POLARITY | OPENPIC_SENSE_LEVEL,
3226 (pri << OPENPIC_PRIORITY_SHIFT) | vec |
3227 - (pol ? OPENPIC_POLARITY_POSITIVE :
3228 - OPENPIC_POLARITY_NEGATIVE) |
3229 - (sense ? OPENPIC_SENSE_LEVEL : OPENPIC_SENSE_EDGE));
3230 + (pol ? OPENPIC_SENSE_POLARITY : 0) |
3231 + (sense ? OPENPIC_SENSE_LEVEL : 0));
3236 OPENPIC_SENSE_LEVEL,
3237 (sense ? OPENPIC_SENSE_LEVEL : 0));
3240 #ifdef CONFIG_PMAC_PBOOK
3241 static u32 save_ipi_vp[OPENPIC_NUM_IPI];
3242 static u32 save_irq_src_vp[OPENPIC_MAX_SOURCES];
3243 diff -urN linux.orig/arch/ppc/kernel/pci.c linux/arch/ppc/kernel/pci.c
3244 --- linux.orig/arch/ppc/kernel/pci.c Sun Mar 25 18:31:48 2001
3245 +++ linux/arch/ppc/kernel/pci.c Thu Jul 11 15:43:29 2002
3247 #include <linux/init.h>
3248 #include <linux/config.h>
3249 #include <linux/openpic.h>
3250 -#include <linux/capability.h>
3251 -#include <linux/sched.h>
3252 -#include <linux/errno.h>
3254 #include <asm/processor.h>
3256 #include <asm/prom.h>
3257 #include <asm/pci-bridge.h>
3258 -#include <asm/pci.h>
3259 #include <asm/residual.h>
3260 #include <asm/byteorder.h>
3261 #include <asm/irq.h>
3262 #include <asm/gg2.h>
3263 -#include <asm/uaccess.h>
3269 for (; node != 0;node = node->sibling) {
3270 class_code = (unsigned int *) get_property(node, "class-code", 0);
3271 - if(class_code && (*class_code >> 8) == PCI_CLASS_BRIDGE_PCI)
3272 + if((*class_code >> 8) == PCI_CLASS_BRIDGE_PCI)
3273 fix_intr(node->child, dev);
3274 reg = (unsigned int *) get_property(node, "reg", 0);
3275 if (reg == 0 || ((reg[0] >> 8) & 0xff) != dev->devfn)
3276 @@ -110,156 +105,3 @@
3283 -pci_dev_io_base(unsigned char bus, unsigned char devfn, int physical)
3285 - if (!ppc_md.pci_dev_io_base) {
3286 - /* Please, someone fix this for non-pmac machines, we
3287 - * need either the virtual or physical PCI IO base
3291 - return ppc_md.pci_dev_io_base(bus, devfn, physical);
3295 -pci_dev_mem_base(unsigned char bus, unsigned char devfn)
3297 - /* Default memory base is 0 (1:1 mapping) */
3298 - if (!ppc_md.pci_dev_mem_base) {
3299 - /* Please, someone fix this for non-pmac machines.*/
3302 - return ppc_md.pci_dev_mem_base(bus, devfn);
3305 -/* Returns the root-bridge number (Uni-N number) of a device */
3307 -pci_dev_root_bridge(unsigned char bus, unsigned char devfn)
3309 - /* Defaults to 0 */
3310 - if (!ppc_md.pci_dev_root_bridge)
3312 - return ppc_md.pci_dev_root_bridge(bus, devfn);
3316 - * Those syscalls are derived from the Alpha versions, they
3317 - * allow userland apps to retreive the per-device iobase and
3318 - * mem-base. They also provide wrapper for userland to do
3319 - * config space accesses.
3320 - * The "host_number" returns the number of the Uni-N sub bridge
3324 -sys_pciconfig_read(unsigned long bus, unsigned long dfn,
3325 - unsigned long off, unsigned long len,
3326 - unsigned char *buf)
3328 - unsigned char ubyte;
3329 - unsigned short ushort;
3330 - unsigned int uint;
3333 - if (!capable(CAP_SYS_ADMIN))
3335 - if (!pcibios_present())
3340 - err = pcibios_read_config_byte(bus, dfn, off, &ubyte);
3341 - put_user(ubyte, buf);
3344 - err = pcibios_read_config_word(bus, dfn, off, &ushort);
3345 - put_user(ushort, (unsigned short *)buf);
3348 - err = pcibios_read_config_dword(bus, dfn, off, &uint);
3349 - put_user(uint, (unsigned int *)buf);
3359 -sys_pciconfig_write(unsigned long bus, unsigned long dfn,
3360 - unsigned long off, unsigned long len,
3361 - unsigned char *buf)
3363 - unsigned char ubyte;
3364 - unsigned short ushort;
3365 - unsigned int uint;
3368 - if (!capable(CAP_SYS_ADMIN))
3370 - if (!pcibios_present())
3375 - err = get_user(ubyte, buf);
3378 - err = pcibios_write_config_byte(bus, dfn, off, ubyte);
3379 - if (err != PCIBIOS_SUCCESSFUL) {
3384 - err = get_user(ushort, (unsigned short *)buf);
3387 - err = pcibios_write_config_word(bus, dfn, off, ushort);
3388 - if (err != PCIBIOS_SUCCESSFUL) {
3393 - err = get_user(uint, (unsigned int *)buf);
3396 - err = pcibios_write_config_dword(bus, dfn, off, uint);
3397 - if (err != PCIBIOS_SUCCESSFUL) {
3408 -/* Provide information on locations of various I/O regions in physical
3409 - * memory. Do this on a per-card basis so that we choose the right
3411 - * Note that the returned IO or memory base is a physical address
3415 -sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
3417 - long result = -EOPNOTSUPP;
3420 - case IOBASE_BRIDGE_NUMBER:
3421 - return (long)pci_dev_root_bridge(bus, devfn);
3422 - case IOBASE_MEMORY:
3423 - return (long)pci_dev_mem_base(bus, devfn);
3425 - result = (long)pci_dev_io_base(bus, devfn, 1);
3427 - result = -EOPNOTSUPP;
3433 diff -urN linux.orig/arch/ppc/kernel/pmac_pci.c linux/arch/ppc/kernel/pmac_pci.c
3434 --- linux.orig/arch/ppc/kernel/pmac_pci.c Fri Nov 2 17:39:05 2001
3435 +++ linux/arch/ppc/kernel/pmac_pci.c Thu Jul 11 15:43:29 2002
3437 struct bridge_data **bridges, *bridge_list;
3440 -struct uninorth_data {
3441 - struct device_node* node;
3442 - volatile unsigned int* cfg_addr;
3443 - volatile unsigned int* cfg_data;
3445 - void* iobase_phys;
3448 -static struct uninorth_data uninorth_bridges[3];
3449 -static int uninorth_count;
3450 -static int uninorth_default = -1;
3454 static void add_bridges(struct device_node *dev, unsigned long *mem_ptr);
3461 -/* This routines figures out on which root bridge a given PCI device
3464 - * WARNING: When passed the address of the bridge itself (11), it must
3465 - * return the AGP bus. Currently, it returns 0, which is by
3466 - * chance the AGP one. We may have to improve that however...
3470 -pmac_pci_dev_root_bridge(unsigned char bus, unsigned char dev_fn)
3472 - struct device_node *node, *bridge_node;
3473 - int bridge = uninorth_default;
3475 - if (uninorth_count == 0)
3477 - if (bus == 0 && PCI_SLOT(dev_fn) < 11)
3480 - /* We look for the OF device corresponding to this bus/devfn pair. If we
3481 - * don't find it, we default to the external PCI */
3482 - bridge_node = NULL;
3483 - node = find_pci_device_OFnode(bus, dev_fn & 0xf8);
3485 - /* note: we don't stop on the first occurrence since we need to go
3486 - * up to the root bridge */
3488 - if (node->type && !strcmp(node->type, "pci")
3489 - && device_is_compatible(node, "uni-north"))
3490 - bridge_node = node;
3491 - node=node->parent;
3494 - if (bridge_node) {
3496 - for (i=0;i<uninorth_count;i++)
3497 - if (uninorth_bridges[i].node == bridge_node) {
3503 - if (bridge == -1) {
3504 - printk(KERN_WARNING "pmac_pci: no default bridge !\n");
3513 -pmac_pci_dev_io_base(unsigned char bus, unsigned char devfn, int physical)
3516 - if (uninorth_count != 0)
3517 - bridge = pmac_pci_dev_root_bridge(bus, devfn);
3518 - if (bridge == -1) {
3519 - struct bridge_data *bp;
3521 - if (bus > max_bus || (bp = bridges[bus]) == 0)
3523 - return physical ? bp->io_base_phys : bp->io_base;
3525 - return physical ? uninorth_bridges[bridge].iobase_phys
3526 - : uninorth_bridges[bridge].iobase;
3531 -pmac_pci_dev_mem_base(unsigned char bus, unsigned char devfn)
3536 -/* This function only works for bus 0, uni-N uses a different mecanism for
3537 - * other busses (see below)
3539 -#define UNI_N_CFA0(devfn, off) \
3540 - ((1 << (unsigned long)PCI_SLOT(dev_fn)) \
3541 - | (((unsigned long)PCI_FUNC(dev_fn)) << 8) \
3542 - | (((unsigned long)(off)) & 0xFCUL))
3544 -/* This one is for type 1 config accesses */
3545 -#define UNI_N_CFA1(bus, devfn, off) \
3546 - ((((unsigned long)(bus)) << 16) \
3547 - |(((unsigned long)(devfn)) << 8) \
3548 - |(((unsigned long)(off)) & 0xFCUL) \
3554 -uni_north_access_data(unsigned char bus, unsigned char dev_fn,
3555 - unsigned char offset)
3558 - unsigned int caddr;
3560 - bridge = pmac_pci_dev_root_bridge(bus, dev_fn);
3562 - caddr = UNI_N_CFA0(dev_fn, offset);
3564 - caddr = UNI_N_CFA1(bus, dev_fn, offset);
3566 - if (bridge == -1) {
3567 - printk(KERN_WARNING "pmac_pci: no default bridge !\n");
3571 - /* Uninorth will return garbage if we don't read back the value ! */
3572 - out_le32(uninorth_bridges[bridge].cfg_addr, caddr);
3573 - (void)in_le32(uninorth_bridges[bridge].cfg_addr);
3574 - /* Yes, offset is & 7, not & 3 ! */
3575 - return (unsigned int)(uninorth_bridges[bridge].cfg_data) + (offset & 0x07);
3579 -int uni_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn,
3580 - unsigned char offset, unsigned char *val)
3582 - unsigned int addr;
3585 - addr = uni_north_access_data(bus, dev_fn, offset);
3587 - return PCIBIOS_DEVICE_NOT_FOUND;
3588 - *val = in_8((volatile unsigned char*)addr);
3589 - return PCIBIOS_SUCCESSFUL;
3593 -int uni_pcibios_read_config_word(unsigned char bus, unsigned char dev_fn,
3594 - unsigned char offset, unsigned short *val)
3596 - unsigned int addr;
3599 - addr = uni_north_access_data(bus, dev_fn, offset);
3601 - return PCIBIOS_DEVICE_NOT_FOUND;
3602 - *val = in_le16((volatile unsigned short*)addr);
3603 - return PCIBIOS_SUCCESSFUL;
3607 -int uni_pcibios_read_config_dword(unsigned char bus, unsigned char dev_fn,
3608 - unsigned char offset, unsigned int *val)
3610 - unsigned int addr;
3613 - addr = uni_north_access_data(bus, dev_fn, offset);
3615 - return PCIBIOS_DEVICE_NOT_FOUND;
3616 - *val = in_le32((volatile unsigned int*)addr);
3617 - return PCIBIOS_SUCCESSFUL;
3621 -int uni_pcibios_write_config_byte(unsigned char bus, unsigned char dev_fn,
3622 - unsigned char offset, unsigned char val)
3624 - unsigned int addr;
3626 - addr = uni_north_access_data(bus, dev_fn, offset);
3628 - return PCIBIOS_DEVICE_NOT_FOUND;
3629 - out_8((volatile unsigned char *)addr, val);
3630 - (void)in_8((volatile unsigned char *)addr);
3631 - return PCIBIOS_SUCCESSFUL;
3635 -int uni_pcibios_write_config_word(unsigned char bus, unsigned char dev_fn,
3636 - unsigned char offset, unsigned short val)
3638 - unsigned int addr;
3640 - addr = uni_north_access_data(bus, dev_fn, offset);
3642 - return PCIBIOS_DEVICE_NOT_FOUND;
3643 - out_le16((volatile unsigned short *)addr, val);
3644 - (void)in_le16((volatile unsigned short *)addr);
3645 - return PCIBIOS_SUCCESSFUL;
3649 -int uni_pcibios_write_config_dword(unsigned char bus, unsigned char dev_fn,
3650 - unsigned char offset, unsigned int val)
3652 - unsigned int addr;
3654 - addr = uni_north_access_data(bus, dev_fn, offset);
3656 - return PCIBIOS_DEVICE_NOT_FOUND;
3657 - out_le32((volatile unsigned int *)addr, val);
3658 - (void)in_le32((volatile unsigned int *)addr);
3659 - return PCIBIOS_SUCCESSFUL;
3664 int pmac_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn,
3665 unsigned char offset, unsigned char *val)
3666 @@ -576,80 +360,6 @@
3670 -#define GRACKLE_PICR1_STG 0x00000040
3671 -#define GRACKLE_PICR1_LOOPSNOOP 0x00000010
3673 -/* N.B. this is called before bridges is initialized, so we can't
3674 - use grackle_pcibios_{read,write}_config_dword. */
3675 -static inline void grackle_set_stg(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_STG) :
3682 - (val & ~GRACKLE_PICR1_STG);
3683 - out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
3684 - out_le32((volatile unsigned int *)bp->cfg_data, val);
3687 -static inline void grackle_set_loop_snoop(struct bridge_data *bp, int enable)
3691 - out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
3692 - val = in_le32((volatile unsigned int *)bp->cfg_data);
3693 - val = enable? (val | GRACKLE_PICR1_LOOPSNOOP) :
3694 - (val & ~GRACKLE_PICR1_LOOPSNOOP);
3695 - out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
3696 - out_le32((volatile unsigned int *)bp->cfg_data, val);
3700 -fixup_one_level_bus_range(struct device_node *node, int higher)
3702 - for (; node != 0;node = node->sibling) {
3704 - unsigned int *class_code;
3707 - /* For PCI<->PCI bridges or CardBus bridges, we go down */
3708 - class_code = (unsigned int *) get_property(node, "class-code", 0);
3709 - if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
3710 - (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
3712 - bus_range = (int *) get_property(node, "bus-range", &len);
3713 - if (bus_range != NULL && len > 2 * sizeof(int)) {
3714 - if (bus_range[1] > higher)
3715 - higher = bus_range[1];
3717 - higher = fixup_one_level_bus_range(node->child, higher);
3722 -/* This routine fixes the "bus-range" property of all bridges in the
3723 - * system since they tend to have their "last" member wrong on macs
3725 - * Note that the bus numbers manipulated here are OF bus numbers, they
3726 - * are not Linux bus numbers.
3729 -fixup_bus_range(struct device_node *bridge)
3734 - /* Lookup the "bus-range" property for the hose */
3735 - bus_range = (int *) get_property(bridge, "bus-range", &len);
3736 - if (bus_range == NULL || len < 2 * sizeof(int)) {
3737 - printk(KERN_WARNING "Can't get bus-range for %s\n",
3738 - bridge->full_name);
3741 - bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]);
3744 __initfunc(unsigned long pmac_find_bridges(unsigned long mem_start, unsigned long mem_end))
3751 - fixup_bus_range(dev);
3752 bus_range = (int *) get_property(dev, "bus-range", &len);
3753 if (bus_range == NULL || len < 2 * sizeof(int)) {
3754 printk(KERN_WARNING "Can't get bus-range for %s\n",
3755 @@ -702,54 +411,21 @@
3756 printk(KERN_INFO "PCI buses %d..%d", bus_range[0],
3758 printk(" controlled by %s at %x\n", dev->name, addr->address);
3759 - if (device_is_compatible(dev, "uni-north")) {
3760 - int i = uninorth_count++;
3761 - uninorth_bridges[i].cfg_addr = ioremap(addr->address + 0x800000, 0x1000);
3762 - uninorth_bridges[i].cfg_data = ioremap(addr->address + 0xc00000, 0x1000);
3763 - uninorth_bridges[i].node = dev;
3764 - uninorth_bridges[i].iobase_phys = (void *)addr->address;
3765 - /* is 0x10000 enough for io space ? */
3766 - uninorth_bridges[i].iobase = (void *)ioremap(addr->address, 0x10000);
3767 - /* XXX This is the bridge with the PCI expansion bus. This is also the
3768 - * address of the bus that will receive type 1 config accesses and io
3769 - * accesses. Appears to be correct for iMac DV and G4 Sawtooth too.
3770 - * That means that we cannot do io cycles on the AGP bus nor the internal
3771 - * ethernet/fw bus. Fortunately, they appear not to be needed on iMac DV
3774 - if (addr->address == 0xf2000000)
3775 - uninorth_default = i;
3779 bp = (struct bridge_data *) *mem_ptr;
3780 *mem_ptr += sizeof(struct bridge_data);
3781 - if (device_is_compatible(dev, "uni-north")) {
3784 - bp->io_base = uninorth_bridges[uninorth_count-1].iobase;
3785 - bp->io_base_phys = uninorth_bridges[uninorth_count-1].iobase_phys;
3786 - } else if (strcmp(dev->name, "pci") == 0) {
3787 - /* XXX assume this is a mpc106 (grackle) */
3788 - bp->cfg_addr = (volatile unsigned int *)
3789 - ioremap(0xfec00000, 0x1000);
3790 - bp->cfg_data = (volatile unsigned char *)
3791 - ioremap(0xfee00000, 0x1000);
3792 - bp->io_base = (void *) ioremap(0xfe000000, 0x20000);
3793 - bp->io_base_phys = (void *)0xfe000000;
3794 - if (machine_is_compatible("AAPL,PowerBook1998"))
3795 - grackle_set_loop_snoop(bp, 1);
3796 -#if 0 /* Disabled for now, HW problems ??? */
3797 - grackle_set_stg(bp, 1);
3800 - /* a `bandit' or `chaos' bridge */
3801 + if (strcmp(dev->name, "pci") != 0) {
3802 bp->cfg_addr = (volatile unsigned int *)
3803 ioremap(addr->address + 0x800000, 0x1000);
3804 bp->cfg_data = (volatile unsigned char *)
3805 ioremap(addr->address + 0xc00000, 0x1000);
3806 bp->io_base = (void *) ioremap(addr->address, 0x10000);
3807 - bp->io_base_phys = (void *)addr->address;
3810 + bp->cfg_addr = (volatile unsigned int *)
3811 + ioremap(0xfec00000, 0x1000);
3812 + bp->cfg_data = (volatile unsigned char *)
3813 + ioremap(0xfee00000, 0x1000);
3814 + bp->io_base = (void *) ioremap(0xfe000000, 0x20000);
3816 if (isa_io_base == 0)
3817 isa_io_base = (unsigned long) bp->io_base;
3818 @@ -792,13 +468,7 @@
3819 if (pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin) ||
3821 continue; /* No interrupt generated -> no fixup */
3822 - /* We iterate all instances of uninorth for now */
3823 - if (uninorth_count && dev->bus->number == 0) {
3825 - for (i=0;i<uninorth_count;i++)
3826 - fix_intr(uninorth_bridges[i].node->child, dev);
3828 - fix_intr(bp->node->child, dev);
3829 + fix_intr(bp->node->child, dev);
3833 @@ -806,17 +476,9 @@
3835 pmac_setup_pci_ptrs(void))
3837 - struct device_node* np;
3839 - np = find_devices("pci");
3841 - if (device_is_compatible(np, "uni-north")) {
3842 - /* looks like an Core99 powermac */
3843 - set_config_access_method(uni);
3845 - /* looks like a G3 powermac */
3846 - set_config_access_method(grackle);
3848 + if (find_devices("pci") != 0) {
3849 + /* looks like a G3 powermac */
3850 + set_config_access_method(grackle);
3852 set_config_access_method(pmac);
3854 diff -urN linux.orig/arch/ppc/kernel/pmac_pic.c linux/arch/ppc/kernel/pmac_pic.c
3855 --- linux.orig/arch/ppc/kernel/pmac_pic.c Sun Mar 25 18:31:49 2001
3856 +++ linux/arch/ppc/kernel/pmac_pic.c Thu Jul 11 15:43:29 2002
3858 #include <linux/sched.h>
3859 #include <linux/signal.h>
3860 #include <linux/pci.h>
3861 -#include <linux/openpic.h>
3862 #include <asm/pci-bridge.h>
3864 #include <asm/smp.h>
3865 #include <asm/prom.h>
3866 #include "pmac_pic.h"
3867 -#include "open_pic.h"
3869 struct pmac_irq_hw {
3872 static int max_irqs;
3873 static int max_real_irqs;
3875 -extern u_int openpic_read(volatile u_int *addr);
3877 #define MAXCOUNT 10000000
3879 #define GATWICK_IRQ_POOL_SIZE 10
3884 - extern void psurge_smp_message_recv(void);
3887 unsigned long bits = 0;
3893 - psurge_smp_message_recv();
3894 + pmac_smp_message_recv();
3897 /* could be here due to a do_fake_interrupt call but we don't
3898 @@ -356,58 +350,6 @@
3899 struct device_node *irqctrler;
3900 volatile struct pmac_irq_hw *addr;
3905 - /* We first try to detect Apple's new Core99 chipset, since mac-io
3906 - * is quite different on those machines and contains an IBM MPIC2.
3908 - irqctrler = find_type_devices("open-pic");
3909 - if (irqctrler != NULL) {
3910 - printk("PowerMac using OpenPIC irq controller\n");
3911 - if (irqctrler->n_addrs > 0) {
3913 - struct device_node* pswitch;
3914 -#endif /* CONFIG_XMON */
3915 - OpenPIC = (volatile struct OpenPIC *)
3916 - ioremap(irqctrler->addrs[0].address,
3917 - irqctrler->addrs[0].size);
3918 - /* from openpic.c code... --Troy
3919 - * dynamically figure out how many interrupts
3920 - * We should really do something like panic
3921 - * if nr_irq >= OPENPIC_VEC_IPI
3923 - t = openpic_read(&OpenPIC->Global.Feature_Reporting0);
3924 - nr_irq = ((t & OPENPIC_FEATURE_LAST_SOURCE_MASK) >>
3925 - OPENPIC_FEATURE_LAST_SOURCE_SHIFT) + 1;
3927 - for ( i = 0 ; i < nr_irq ; i++ ) {
3928 - irq_desc[i].ctl = &open_pic;
3929 - irq_desc[i].level = 0;
3931 - ppc_md.do_IRQ = open_pic_do_IRQ;
3932 - open_pic.irq_offset = 0;
3935 - pswitch = find_devices("programmer-switch");
3936 - if (pswitch && pswitch->n_intrs)
3937 - request_irq(pswitch->intrs[0].line, xmon_irq, 0,
3939 -#endif /* CONFIG_XMON */
3941 - request_irq(OPENPIC_VEC_IPI, openpic_ipi_action,
3943 - request_irq(OPENPIC_VEC_IPI+1, openpic_ipi_action,
3944 - 0, "IPI1 (invalidate TLB)", 0);
3945 - request_irq(OPENPIC_VEC_IPI+2, openpic_ipi_action,
3946 - 0, "IPI2 (stop CPU)", 0);
3947 - request_irq(OPENPIC_VEC_IPI+3, openpic_ipi_action,
3948 - 0, "IPI3 (reschedule)", 0);
3949 -#endif /* __SMP__ */
3956 * G3 powermacs and 1999 G3 PowerBooks have 64 interrupts,
3958 * sleep_save_intrs() saves the states of all interrupt enables
3959 * and disables all interupts except for the nominated one.
3960 * sleep_restore_intrs() restores the states of all interrupt enables.
3962 - * TODO: Those should be sleep notifiers with high priority.
3964 unsigned int sleep_save_mask[2];
3967 sleep_save_mask[1] = ppc_cached_irq_mask[1];
3968 ppc_cached_irq_mask[0] = 0;
3969 ppc_cached_irq_mask[1] = 0;
3971 - set_bit(viaint, ppc_cached_irq_mask);
3972 + set_bit(viaint, ppc_cached_irq_mask);
3973 out_le32(&pmac_irq_hw[0]->enable, ppc_cached_irq_mask[0]);
3974 if (max_real_irqs > 32)
3975 out_le32(&pmac_irq_hw[1]->enable, ppc_cached_irq_mask[1]);
3981 out_le32(&pmac_irq_hw[0]->enable, 0);
3982 if (max_real_irqs > 32)
3983 out_le32(&pmac_irq_hw[1]->enable, 0);
3984 diff -urN linux.orig/arch/ppc/kernel/pmac_setup.c linux/arch/ppc/kernel/pmac_setup.c
3985 --- linux.orig/arch/ppc/kernel/pmac_setup.c Sun Mar 25 18:37:30 2001
3986 +++ linux/arch/ppc/kernel/pmac_setup.c Tue Jul 16 15:49:52 2002
3988 #include <asm/ide.h>
3989 #include <asm/machdep.h>
3990 #include <asm/keyboard.h>
3991 -#include <asm/time.h>
3994 #include "local_irq.h"
3995 #include "pmac_pic.h"
3997 #undef SHOW_GATWICK_IRQS
3999 -extern long pmac_time_init(void);
4000 -extern unsigned long pmac_get_rtc_time(void);
4001 -extern int pmac_set_rtc_time(unsigned long nowtime);
4002 -extern void pmac_read_rtc_time(void);
4003 -extern void pmac_calibrate_decr(void);
4004 -extern void pmac_setup_pci_ptrs(void);
4005 +unsigned long pmac_get_rtc_time(void);
4006 +int pmac_set_rtc_time(unsigned long nowtime);
4007 +void pmac_read_rtc_time(void);
4008 +void pmac_calibrate_decr(void);
4009 +void pmac_setup_pci_ptrs(void);
4011 extern int mackbd_setkeycode(unsigned int scancode, unsigned int keycode);
4012 extern int mackbd_getkeycode(unsigned int scancode);
4014 extern void mackbd_leds(unsigned char leds);
4015 extern void mackbd_init_hw(void);
4016 #ifdef CONFIG_MAGIC_SYSRQ
4017 -extern unsigned char mackbd_sysrq_xlate[128];
4018 extern unsigned char mac_hid_kbd_sysrq_xlate[128];
4019 extern unsigned char pckbd_sysrq_xlate[128];
4020 +unsigned char mackbd_sysrq_xlate[128];
4021 #endif /* CONFIG_MAGIC_SYSRQ */
4022 extern int keyboard_sends_linux_keycodes;
4023 extern int mac_hid_kbd_translate(unsigned char scancode,
4025 extern char mac_hid_kbd_unexpected_up(unsigned char keycode);
4026 extern void mac_hid_init_hw(void);
4028 -extern void pmac_nvram_update(void);
4030 -extern void *pmac_pci_dev_io_base(unsigned char bus, unsigned char devfn);
4031 -extern void *pmac_pci_dev_mem_base(unsigned char bus, unsigned char devfn);
4032 -extern int pmac_pci_dev_root_bridge(unsigned char bus, unsigned char devfn);
4033 +extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
4034 +extern int pckbd_getkeycode(unsigned int scancode);
4035 +extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
4037 +extern char pckbd_unexpected_up(unsigned char keycode);
4038 +extern void pckbd_leds(unsigned char leds);
4039 +extern void pckbd_init_hw(void);
4041 unsigned char drive_info;
4043 int ppc_override_l2cr = 0;
4044 int ppc_override_l2cr_value;
4046 -static int current_root_goodness = -1;
4048 extern char saved_command_line[];
4050 -extern int pmac_newworld;
4052 #define DEFAULT_ROOT_DEVICE 0x0801 /* sda1 - slightly silly choice */
4054 extern void zs_kgdb_hook(int tty_num);
4055 static void ohare_init(void);
4056 static void init_p2pbridge(void);
4059 -volatile static long int core99_l2_cache;
4060 -void core99_init_l2(void)
4062 - int cpu = smp_processor_id();
4064 - if ( (_get_PVR() >> 16) != 8 && (_get_PVR() >> 16) != 12 )
4068 - core99_l2_cache = _get_L2CR();
4069 - printk("CPU0: L2CR is %lx\n", core99_l2_cache);
4071 - printk("CPU%d: L2CR was %lx\n", cpu, _get_L2CR());
4072 - _set_L2CR(core99_l2_cache);
4073 - printk("CPU%d: L2CR set to %lx\n", cpu, core99_l2_cache);
4076 -#endif /* CONFIG_SMP */
4080 pmac_get_cpuinfo(char *buffer)
4081 @@ -219,10 +196,6 @@
4082 len += sprintf(buffer+len, "l2cr override\t: 0x%x\n", *l2cr);
4086 - /* Indicate newworld/oldworld */
4087 - len += sprintf(buffer+len, "pmac-generation\t: %s\n",
4088 - pmac_newworld ? "NewWorld" : "OldWorld");
4092 @@ -282,10 +255,8 @@
4094 switch (_get_PVR() >> 16) {
4098 case 10: /* mach V (604ev5) */
4101 loops_per_jiffy = *fp / HZ;
4103 @@ -304,11 +275,9 @@
4105 *memory_start_p = pmac_find_bridges(*memory_start_p, *memory_end_p);
4108 - /* Checks "l2cr-value" property in the registry
4109 - * And enable G3/G4 Dynamic Power Management
4111 - if ( (_get_PVR() >> 16) == 8 || (_get_PVR() >> 16) == 12 ) {
4113 + /* Checks "l2cr-value" property in the registry */
4114 + if ( (_get_PVR() >> 16) == 8) {
4115 struct device_node *np = find_devices("cpus");
4117 np = find_type_devices("cpu");
4118 @@ -319,22 +288,17 @@
4119 ppc_override_l2cr = 1;
4120 ppc_override_l2cr_value = *l2cr;
4122 - if (ppc_override_l2cr_value)
4123 - _set_L2CR(ppc_override_l2cr_value);
4124 + _set_L2CR(ppc_override_l2cr_value);
4127 - _set_HID0(_get_HID0() | HID0_DPM);
4130 if (ppc_override_l2cr)
4131 printk(KERN_INFO "L2CR overriden (0x%x), backside cache is %s\n",
4132 ppc_override_l2cr_value, (ppc_override_l2cr_value & 0x80000000)
4133 ? "enabled" : "disabled");
4147 - pmac_nvram_init();
4149 #ifdef CONFIG_DUMMY_CONSOLE
4150 conswitchp = &dummy_con;
4156 + pmac_nvram_init();
4160 @@ -493,14 +456,13 @@
4162 /* can't be initfunc - can be called whenever a disk is first accessed */
4164 -void note_bootable_part(kdev_t dev, int part, int goodness)
4165 +void note_bootable_part(kdev_t dev, int part)
4167 static int found_boot = 0;
4170 /* Do nothing if the root has been set already. */
4171 - if ((goodness < current_root_goodness) &&
4172 - (ROOT_DEV != to_kdev_t(DEFAULT_ROOT_DEVICE)))
4173 + if (ROOT_DEV != to_kdev_t(DEFAULT_ROOT_DEVICE))
4175 p = strstr(saved_command_line, "root=");
4176 if (p != NULL && (p == saved_command_line || p[-1] == ' '))
4178 if (boot_dev == 0 || dev == boot_dev) {
4179 ROOT_DEV = MKDEV(MAJOR(dev), MINOR(dev) + part);
4181 - current_root_goodness = goodness;
4182 + printk(" (root)");
4188 struct adb_request req;
4190 - pmac_nvram_update();
4192 switch (adb_hardware) {
4194 cuda_request(&req, NULL, 2, CUDA_PACKET,
4197 struct adb_request req;
4199 - pmac_nvram_update();
4201 switch (adb_hardware) {
4203 cuda_request(&req, NULL, 2, CUDA_PACKET,
4215 /* This is declared in drivers/block/ide-pmac.c */
4216 -void pmac_ide_init_hwif_ports (ide_ioreg_t *p, ide_ioreg_t base, int *irq);
4217 +void pmac_ide_init_hwif_ports (hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq);
4222 @@ -663,15 +623,11 @@
4223 ppc_md.power_off = pmac_power_off;
4224 ppc_md.halt = pmac_halt;
4226 - ppc_md.time_init = pmac_time_init;
4227 + ppc_md.time_init = NULL;
4228 ppc_md.set_rtc_time = pmac_set_rtc_time;
4229 ppc_md.get_rtc_time = pmac_get_rtc_time;
4230 ppc_md.calibrate_decr = pmac_calibrate_decr;
4232 - ppc_md.pci_dev_root_bridge = pmac_pci_dev_root_bridge;
4233 - ppc_md.pci_dev_mem_base = pmac_pci_dev_mem_base;
4234 - ppc_md.pci_dev_io_base = pmac_pci_dev_io_base;
4237 #ifdef CONFIG_MAC_KEYBOARD
4238 ppc_md.kbd_setkeycode = mackbd_setkeycode;
4239 diff -urN linux.orig/arch/ppc/kernel/pmac_support.c linux/arch/ppc/kernel/pmac_support.c
4240 --- linux.orig/arch/ppc/kernel/pmac_support.c Sun Mar 25 18:31:49 2001
4241 +++ linux/arch/ppc/kernel/pmac_support.c Thu Jul 11 15:43:29 2002
4244 * Miscellaneous procedures for dealing with the PowerMac hardware.
4245 - * Contains support for the nvram.
4247 - * Copyright (C) 2000 Paul Mackerras
4248 - * Copyright (C) 2000 Benjamin Herrenschmidt
4250 - * ToDo: Handle type 0 and type 1 "NameRegistry" NVRAM properties. Those
4251 - * contain, among other things, the brightness, video mode, etc...
4253 #include <linux/kernel.h>
4254 #include <linux/stddef.h>
4255 #include <linux/reboot.h>
4256 #include <linux/nvram.h>
4257 -#include <linux/slab.h>
4258 -#include <linux/delay.h>
4259 #include <asm/init.h>
4260 #include <asm/ptrace.h>
4263 #include <asm/prom.h>
4264 #include <asm/adb.h>
4265 #include <asm/pmu.h>
4266 -#include <asm/machdep.h>
4267 #include <asm/nvram.h>
4268 #include <asm/backlight.h>
4272 -#define NVRAM_SIZE 0x2000 /* 8kB of non-volatile RAM */
4274 -#define CORE99_SIGNATURE 0x5a
4275 -#define CORE99_ADLER_START 0x14
4277 -/* Core99 nvram is a flash */
4278 -#define CORE99_FLASH_STATUS_DONE 0x80
4279 -#define CORE99_FLASH_STATUS_ERR 0x38
4280 -#define CORE99_FLASH_CMD_ERASE_CONFIRM 0xd0
4281 -#define CORE99_FLASH_CMD_ERASE_SETUP 0x20
4282 -#define CORE99_FLASH_CMD_RESET 0xff
4283 -#define CORE99_FLASH_CMD_WRITE_SETUP 0x40
4285 -/* CHRP NVRAM header */
4286 -struct chrp_header {
4294 -struct core99_header {
4295 - struct chrp_header hdr;
4302 * Read and write the non-volatile RAM on PowerMacs and CHRP machines.
4304 static int nvram_naddrs;
4305 static volatile unsigned char *nvram_addr;
4306 static volatile unsigned char *nvram_data;
4307 -static int nvram_mult, is_core_99;
4308 -static int core99_bank = 0;
4309 +static int nvram_mult;
4310 static int nvram_partitions[3];
4312 static struct backlight_controller *backlighter = NULL;
4313 @@ -73,213 +31,22 @@
4314 static int backlight_level = BACKLIGHT_MAX;
4315 static int backlight_enabled = 1;
4317 -/* FIXME: kmalloc fails to allocate the image now that I had to move it
4318 - * before time_init(). For now, I allocate a static buffer here
4319 - * but it's a waste of space on all but core99 machines
4322 -static char* nvram_image;
4324 -static char nvram_image[NVRAM_SIZE];
4327 -extern int pmac_newworld;
4330 -chrp_checksum(struct chrp_header* hdr)
4333 - u16 sum = hdr->signature;
4334 - for (ptr = (u8 *)&hdr->len; ptr < hdr->data; ptr++)
4336 - while (sum > 0xFF)
4337 - sum = (sum & 0xFF) + (sum>>8);
4342 -core99_calc_adler(u8 *buffer)
4347 - buffer += CORE99_ADLER_START;
4350 - for (cnt=0; cnt<(NVRAM_SIZE-CORE99_ADLER_START); cnt++) {
4351 - if ((cnt % 5000) == 0) {
4355 - low += buffer[cnt];
4361 - return (high << 16) | low;
4365 -core99_check(u8* datas)
4367 - struct core99_header* hdr99 = (struct core99_header*)datas;
4368 +#define NVRAM_SIZE 0x2000 /* 8kB of non-volatile RAM */
4370 - if (hdr99->hdr.signature != CORE99_SIGNATURE) {
4372 - printk("Invalid signature\n");
4376 - if (hdr99->hdr.cksum != chrp_checksum(&hdr99->hdr)) {
4378 - printk("Invalid checksum\n");
4382 - if (hdr99->adler != core99_calc_adler(datas)) {
4384 - printk("Invalid adler\n");
4388 - return hdr99->generation;
4392 -core99_erase_bank(int bank)
4396 - u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
4398 - out_8(base, CORE99_FLASH_CMD_ERASE_SETUP);
4399 - out_8(base, CORE99_FLASH_CMD_ERASE_CONFIRM);
4400 - do { stat = in_8(base); }
4401 - while(!(stat & CORE99_FLASH_STATUS_DONE));
4402 - out_8(base, CORE99_FLASH_CMD_RESET);
4403 - if (stat & CORE99_FLASH_STATUS_ERR) {
4404 - printk("nvram: flash error 0x%02x on erase !\n", stat);
4407 - for (i=0; i<NVRAM_SIZE; i++)
4408 - if (base[i] != 0xff) {
4409 - printk("nvram: flash erase failed !\n");
4416 -core99_write_bank(int bank, u8* datas)
4420 - u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
4422 - for (i=0; i<NVRAM_SIZE; i++) {
4423 - out_8(base+i, CORE99_FLASH_CMD_WRITE_SETUP);
4424 - out_8(base+i, datas[i]);
4425 - do { stat = in_8(base); }
4426 - while(!(stat & CORE99_FLASH_STATUS_DONE));
4427 - if (stat & CORE99_FLASH_STATUS_ERR)
4430 - out_8(base, CORE99_FLASH_CMD_RESET);
4431 - if (stat & CORE99_FLASH_STATUS_ERR) {
4432 - printk("nvram: flash error 0x%02x on write !\n", stat);
4435 - for (i=0; i<NVRAM_SIZE; i++)
4436 - if (base[i] != datas[i]) {
4437 - printk("nvram: flash write failed !\n");
4444 -lookup_partitions(void)
4448 - struct chrp_header* hdr;
4450 - if (pmac_newworld) {
4451 - nvram_partitions[pmac_nvram_OF] = -1;
4452 - nvram_partitions[pmac_nvram_XPRAM] = -1;
4453 - nvram_partitions[pmac_nvram_NR] = -1;
4454 - hdr = (struct chrp_header *)buffer;
4459 - for (i=0;i<16;i++)
4460 - buffer[i] = nvram_read_byte(offset+i);
4461 - if (!strcmp(hdr->name, "common"))
4462 - nvram_partitions[pmac_nvram_OF] = offset + 0x10;
4463 - if (!strcmp(hdr->name, "APL,MacOS75")) {
4464 - nvram_partitions[pmac_nvram_XPRAM] = offset + 0x10;
4465 - nvram_partitions[pmac_nvram_NR] = offset + 0x110;
4467 - offset += (hdr->len * 0x10);
4468 - } while(offset < NVRAM_SIZE);
4470 - nvram_partitions[pmac_nvram_OF] = 0x1800;
4471 - nvram_partitions[pmac_nvram_XPRAM] = 0x1300;
4472 - nvram_partitions[pmac_nvram_NR] = 0x1400;
4475 - printk("nvram: OF partition at 0x%x\n", nvram_partitions[pmac_nvram_OF]);
4476 - printk("nvram: XP partition at 0x%x\n", nvram_partitions[pmac_nvram_XPRAM]);
4477 - printk("nvram: NR partition at 0x%x\n", nvram_partitions[pmac_nvram_NR]);
4482 void pmac_nvram_init(void)
4484 struct device_node *dp;
4488 dp = find_devices("nvram");
4490 printk(KERN_ERR "Can't find NVRAM device\n");
4494 nvram_naddrs = dp->n_addrs;
4495 - is_core_99 = device_is_compatible(dp, "nvram,flash");
4496 - printk("pmac nvram is core99: %d\n", is_core_99);
4499 - u32 gen_bank0, gen_bank1;
4501 - if (nvram_naddrs < 1) {
4502 - printk(KERN_ERR "nvram: no address\n");
4506 - nvram_image = kmalloc(NVRAM_SIZE, GFP_KERNEL);
4507 - if (!nvram_image) {
4508 - printk(KERN_ERR "nvram: can't allocate image\n");
4512 - nvram_data = ioremap(dp->addrs[0].address, NVRAM_SIZE*2);
4514 - printk("nvram: Checking bank 0...\n");
4516 - gen_bank0 = core99_check((u8 *)nvram_data);
4517 - gen_bank1 = core99_check((u8 *)nvram_data + NVRAM_SIZE);
4518 - core99_bank = (gen_bank0 < gen_bank1) ? 1 : 0;
4520 - printk("nvram: gen0=%d, gen1=%d\n", gen_bank0, gen_bank1);
4521 - printk("nvram: Active bank is: %d\n", core99_bank);
4523 - for (i=0; i<NVRAM_SIZE; i++)
4524 - nvram_image[i] = nvram_data[i + core99_bank*NVRAM_SIZE];
4525 - } else if (_machine == _MACH_chrp && nvram_naddrs == 1) {
4526 + if (_machine == _MACH_chrp && nvram_naddrs == 1) {
4527 nvram_data = ioremap(dp->addrs[0].address, dp->addrs[0].size);
4529 } else if (nvram_naddrs == 1) {
4530 @@ -288,45 +55,15 @@
4531 } else if (nvram_naddrs == 2) {
4532 nvram_addr = ioremap(dp->addrs[0].address, dp->addrs[0].size);
4533 nvram_data = ioremap(dp->addrs[1].address, dp->addrs[1].size);
4534 - } else if (nvram_naddrs == 0 && adb_controller &&
4535 - adb_controller->kind == ADB_VIAPMU) {
4536 + } else if (nvram_naddrs == 0 && adb_hardware == ADB_VIAPMU) {
4539 printk(KERN_ERR "Don't know how to access NVRAM with %d addresses\n",
4542 - lookup_partitions();
4546 -pmac_nvram_update(void)
4548 - struct core99_header* hdr99;
4550 - if (!is_core_99 || !nvram_data || !nvram_image)
4552 - if (!memcmp(nvram_image, (u8*)nvram_data + core99_bank*NVRAM_SIZE,
4556 - printk("Updating nvram...\n");
4558 - hdr99 = (struct core99_header*)nvram_image;
4559 - hdr99->generation++;
4560 - hdr99->hdr.signature = CORE99_SIGNATURE;
4561 - hdr99->hdr.cksum = chrp_checksum(&hdr99->hdr);
4562 - hdr99->adler = core99_calc_adler(nvram_image);
4563 - core99_bank = core99_bank ? 0 : 1;
4564 - if (core99_erase_bank(core99_bank)) {
4565 - printk("nvram: Error erasing bank %d\n", core99_bank);
4568 - if (core99_write_bank(core99_bank, nvram_image))
4569 - printk("nvram: Error writing bank %d\n", core99_bank);
4572 -unsigned char __pmac
4573 -nvram_read_byte(int addr)
4574 +unsigned char nvram_read_byte(int addr)
4576 struct adb_request req;
4580 return req.reply[1];
4583 - return nvram_image ? nvram_image[addr] : 0;
4584 return nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult];
4586 *nvram_addr = addr >> 5;
4592 -nvram_write_byte(unsigned char val, int addr)
4593 +void nvram_write_byte(unsigned char val, int addr)
4595 struct adb_request req;
4604 - nvram_image[addr] = val;
4607 nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult] = val;
4610 diff -urN linux.orig/arch/ppc/kernel/pmac_time.c linux/arch/ppc/kernel/pmac_time.c
4611 --- linux.orig/arch/ppc/kernel/pmac_time.c Sun Mar 25 18:31:49 2001
4612 +++ linux/arch/ppc/kernel/pmac_time.c Thu Jul 11 15:43:29 2002
4614 #include <asm/system.h>
4616 #include <asm/pgtable.h>
4617 -#include <asm/nvram.h>
4619 -#include <asm/time.h>
4622 /* Apparently the RTC stores seconds since 1 Jan 1904 */
4623 #define RTC_OFFSET 2082844800
4625 /* Bits in IFR and IER */
4626 #define T1_INT 0x40 /* Timer 1 interrupt */
4628 -extern struct timezone sys_tz;
4631 -long pmac_time_init(void)
4636 - delta = ((s32)pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x9)) << 16;
4637 - delta |= ((s32)pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0xa)) << 8;
4638 - delta |= pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0xb);
4639 - if (delta & 0x00800000UL)
4640 - delta |= 0xFF000000UL;
4641 - dst = ((pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x8) & 0x80) != 0);
4642 - printk("GMT Delta read from XPRAM: %d minutes, DST: %s\n", delta/60,
4643 - dst ? "on" : "off");
4649 unsigned long pmac_get_rtc_time(void)
4651 struct adb_request req;
4654 int pmac_set_rtc_time(unsigned long nowtime)
4656 - struct adb_request req;
4659 - nowtime += RTC_OFFSET;
4661 - /* Set the time in the RTC */
4662 - if (adb_controller == 0)
4664 - /* adb_controller->kind, not adb_hardware, since that doesn't
4665 - get set until we call adb_init - paulus. */
4666 - switch (adb_controller->kind) {
4668 - if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME,
4669 - nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0)
4671 - while (!req.complete)
4673 -// if (req.reply_len != 7)
4674 - printk(KERN_ERR "pmac_set_rtc_time: got %d byte reply\n",
4678 - if (pmu_request(&req, NULL, 5, PMU_SET_RTC,
4679 - nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0)
4681 - while (!req.complete)
4683 - if (req.reply_len != 5)
4684 - printk(KERN_ERR "pmac_set_rtc_time: got %d byte reply\n",
4696 diff -urN linux.orig/arch/ppc/kernel/ppc-stub.c linux/arch/ppc/kernel/ppc-stub.c
4697 --- linux.orig/arch/ppc/kernel/ppc-stub.c Sun Mar 25 18:31:49 2001
4698 +++ linux/arch/ppc/kernel/ppc-stub.c Thu Jul 11 15:43:29 2002
4701 static inline void set_msr(int msr)
4703 - asm volatile("mtmsr %0" : : "r" (msr));
4704 + asm volatile("mfmsr %0" : : "r" (msr));
4707 /* Set up exception handlers for tracing and breakpoints
4708 diff -urN linux.orig/arch/ppc/kernel/ppc_asm.tmpl linux/arch/ppc/kernel/ppc_asm.tmpl
4709 --- linux.orig/arch/ppc/kernel/ppc_asm.tmpl Sun Mar 25 18:31:48 2001
4710 +++ linux/arch/ppc/kernel/ppc_asm.tmpl Thu Jul 11 15:43:29 2002
4748 diff -urN linux.orig/arch/ppc/kernel/ppc_htab.c linux/arch/ppc/kernel/ppc_htab.c
4749 --- linux.orig/arch/ppc/kernel/ppc_htab.c Sun Mar 25 18:31:49 2001
4750 +++ linux/arch/ppc/kernel/ppc_htab.c Thu Jul 11 15:43:29 2002
4752 "0.5", "1.0", "(reserved2)", "(reserved3)"
4755 - if ( ((_get_PVR() >> 16) != 8) && ((_get_PVR() >> 16) != 12))
4757 + if ( (_get_PVR() >> 16) != 8) return -EFAULT;
4759 if ( /*!table->maxlen ||*/ (filp->f_pos && !write)) {
4768 + while ( _get_L2CR() & 0x1 )
4769 + /* wait for invalidate to finish */;
4773 diff -urN linux.orig/arch/ppc/kernel/ppc_ksyms.c linux/arch/ppc/kernel/ppc_ksyms.c
4774 --- linux.orig/arch/ppc/kernel/ppc_ksyms.c Tue Jun 11 19:39:18 2002
4775 +++ linux/arch/ppc/kernel/ppc_ksyms.c Fri Jul 12 18:41:29 2002
4777 #include <linux/sched.h>
4778 #include <linux/string.h>
4779 #include <linux/interrupt.h>
4780 -#include <linux/smp_lock.h>
4781 #include <linux/vt_kern.h>
4782 #include <linux/nvram.h>
4784 +#include <asm/page.h>
4785 #include <asm/semaphore.h>
4786 #include <asm/processor.h>
4787 #include <asm/uaccess.h>
4788 +#include <asm/io.h>
4789 #include <asm/ide.h>
4790 +#include <asm/atomic.h>
4791 +#include <asm/bitops.h>
4792 #include <asm/checksum.h>
4793 #include <asm/pgtable.h>
4794 #include <asm/adb.h>
4795 #include <asm/cuda.h>
4796 #include <asm/pmu.h>
4797 #include <asm/prom.h>
4798 +#include <asm/system.h>
4799 #include <asm/pci-bridge.h>
4800 #include <asm/irq.h>
4801 #include <asm/feature.h>
4802 +#include <asm/spinlock.h>
4803 #include <asm/dma.h>
4804 -#include <asm/nvram.h>
4805 -#include <asm/time.h>
4806 +#include <asm/machdep.h>
4808 /* Tell string.h we don't want memcpy etc. as cpp defines */
4809 #define EXPORT_SYMTAB_STROPS
4811 unsigned int, unsigned int, unsigned int);
4812 extern void to_tm(int tim, struct rtc_time * tm);
4814 -long long __ashrdi3(long long, int);
4815 -long long __ashldi3(long long, int);
4816 -long long __lshrdi3(long long, int);
4818 +asmlinkage long long __ashrdi3(long long, int);
4819 +asmlinkage long long __ashldi3(long long, int);
4820 +asmlinkage long long __lshrdi3(long long, int);
4821 +asmlinkage int abs(int);
4823 EXPORT_SYMBOL(clear_page);
4824 EXPORT_SYMBOL(do_signal);
4826 EXPORT_SYMBOL(isa_mem_base);
4827 EXPORT_SYMBOL(pci_dram_offset);
4828 EXPORT_SYMBOL(ISA_DMA_THRESHOLD);
4829 -EXPORT_SYMBOL_NOVERS(DMA_MODE_READ);
4830 +EXPORT_SYMBOL(DMA_MODE_READ);
4831 EXPORT_SYMBOL(DMA_MODE_WRITE);
4832 -#if defined(CONFIG_PREP) || defined(CONFIG_ALL_PPC)
4833 EXPORT_SYMBOL(_prep_type);
4834 EXPORT_SYMBOL(ucSystemType);
4837 EXPORT_SYMBOL(atomic_add);
4838 EXPORT_SYMBOL(atomic_sub);
4839 @@ -167,16 +169,11 @@
4840 EXPORT_SYMBOL(enable_kernel_fp);
4841 EXPORT_SYMBOL(flush_icache_range);
4842 EXPORT_SYMBOL(xchg_u32);
4844 -#ifdef CONFIG_ALTIVEC
4845 -EXPORT_SYMBOL(giveup_altivec);
4849 -EXPORT_SYMBOL(cpu_data);
4850 -EXPORT_SYMBOL(kernel_flag);
4851 -EXPORT_SYMBOL(cpu_number_map);
4852 -EXPORT_SYMBOL(smp_num_cpus);
4853 +EXPORT_SYMBOL(__global_cli);
4854 +EXPORT_SYMBOL(__global_sti);
4855 +EXPORT_SYMBOL(__global_save_flags);
4856 +EXPORT_SYMBOL(__global_restore_flags);
4857 EXPORT_SYMBOL(_spin_lock);
4858 EXPORT_SYMBOL(_spin_unlock);
4859 EXPORT_SYMBOL(spin_trylock);
4860 @@ -184,35 +181,11 @@
4861 EXPORT_SYMBOL(_read_unlock);
4862 EXPORT_SYMBOL(_write_lock);
4863 EXPORT_SYMBOL(_write_unlock);
4865 -/* Global SMP irq stuff */
4866 -EXPORT_SYMBOL(synchronize_irq);
4867 -EXPORT_SYMBOL(synchronize_bh);
4868 -EXPORT_SYMBOL(global_bh_count);
4869 -EXPORT_SYMBOL(global_bh_lock);
4870 -EXPORT_SYMBOL(global_irq_holder);
4871 -EXPORT_SYMBOL(__global_cli);
4872 -EXPORT_SYMBOL(__global_sti);
4873 -EXPORT_SYMBOL(__global_save_flags);
4874 -EXPORT_SYMBOL(__global_restore_flags);
4875 -#endif /* __SMP__ */
4878 EXPORT_SYMBOL(_machine);
4879 EXPORT_SYMBOL(ppc_md);
4880 -EXPORT_SYMBOL(abort);
4883 -EXPORT_SYMBOL(find_devices);
4884 -EXPORT_SYMBOL(find_type_devices);
4885 -EXPORT_SYMBOL(find_compatible_devices);
4886 -EXPORT_SYMBOL(find_path_device);
4887 -EXPORT_SYMBOL(find_phandle);
4888 -EXPORT_SYMBOL(device_is_compatible);
4889 -EXPORT_SYMBOL(machine_is_compatible);
4890 -EXPORT_SYMBOL(find_pci_device_OFnode);
4891 -EXPORT_SYMBOL(find_all_nodes);
4892 -EXPORT_SYMBOL(get_property);
4893 -#endif /* CONFIG_MBX */
4894 #ifdef CONFIG_POWERMAC
4895 EXPORT_SYMBOL(adb_request);
4896 EXPORT_SYMBOL(adb_register);
4897 @@ -227,21 +200,25 @@
4898 EXPORT_SYMBOL(pmu_enable_irled);
4899 #endif /* CONFIG_PMAC_PBOOK */
4900 #ifdef CONFIG_POWERMAC
4901 +EXPORT_SYMBOL(abort);
4902 +EXPORT_SYMBOL(find_devices);
4903 +EXPORT_SYMBOL(find_type_devices);
4904 +EXPORT_SYMBOL(find_compatible_devices);
4905 +EXPORT_SYMBOL(find_path_device);
4906 +EXPORT_SYMBOL(find_phandle);
4907 +EXPORT_SYMBOL(device_is_compatible);
4908 +EXPORT_SYMBOL(machine_is_compatible);
4909 +EXPORT_SYMBOL(find_pci_device_OFnode);
4910 +EXPORT_SYMBOL(get_property);
4911 EXPORT_SYMBOL(pci_io_base);
4912 -EXPORT_SYMBOL(pci_dev_io_base);
4913 -EXPORT_SYMBOL(pci_dev_mem_base);
4914 EXPORT_SYMBOL(pci_device_loc);
4915 EXPORT_SYMBOL(feature_set);
4916 EXPORT_SYMBOL(feature_clear);
4917 EXPORT_SYMBOL(feature_test);
4918 EXPORT_SYMBOL(feature_set_gmac_power);
4919 EXPORT_SYMBOL(feature_set_gmac_phy_reset);
4920 -EXPORT_SYMBOL(feature_set_usb_power);
4921 -EXPORT_SYMBOL(feature_set_firewire_power);
4922 EXPORT_SYMBOL(nvram_read_byte);
4923 EXPORT_SYMBOL(nvram_write_byte);
4924 -EXPORT_SYMBOL(pmac_xpram_read);
4925 -EXPORT_SYMBOL(pmac_xpram_write);
4927 EXPORT_SYMBOL(note_scsi_host);
4928 #endif /* CONFIG_SCSI */
4929 diff -urN linux.orig/arch/ppc/kernel/prep_pci.c linux/arch/ppc/kernel/prep_pci.c
4930 --- linux.orig/arch/ppc/kernel/prep_pci.c Sun Mar 25 18:31:49 2001
4931 +++ linux/arch/ppc/kernel/prep_pci.c Thu Jul 11 15:43:29 2002
4935 #include <linux/types.h>
4936 -#include <linux/string.h>
4937 #include <linux/pci.h>
4938 #include <linux/kernel.h>
4939 #include <linux/init.h>
4941 #include <asm/residual.h>
4942 #include <asm/processor.h>
4943 #include <asm/irq.h>
4944 +#include <asm/irq-compat.h>
4945 #include <asm/machdep.h>
4948 -#include "open_pic.h"
4950 #define MAX_DEVNR 22
4953 unsigned char *Motherboard_routes;
4954 void (*Motherboard_non0)(struct pci_dev *);
4956 -void Powerplus_Map_Non0(struct pci_dev *);
4957 +void Mesquite_Map_Non0(struct pci_dev *);
4959 /* Used for Motorola to store system config register */
4960 static unsigned long *ProcInfo;
4962 +extern void chrp_do_IRQ(struct pt_regs *,int , int);
4964 /* Tables for known hardware */
4966 /* Motorola PowerStackII - Utah */
4967 @@ -508,51 +509,6 @@
4971 -/* Motorola PowerPlus architecture PCI IRQ tables */
4972 -/* Interrupt line values for INTA-D on primary/secondary MPIC inputs */
4974 -struct powerplus_irq_list
4976 - unsigned char primary[4]; /* INT A-D */
4977 - unsigned char secondary[4]; /* INT A-D */
4981 - * For standard PowerPlus boards, bus 0 PCI INTs A-D are routed to
4982 - * OpenPIC inputs 9-12. PCI INTs A-D from the on board P2P bridge
4983 - * are routed to OpenPIC inputs 5-8. These values are offset by
4984 - * 16 in the table to reflect the Linux kernel interrupt value.
4986 -struct powerplus_irq_list Powerplus_pci_IRQ_list =
4993 - * For the MCP750 (system slot board), bus 0 PCI INTs A-D are routed
4994 - * to OpenPIC inputs 8-11. PCI INTs A-D from the on board P2P bridge
4995 - * are routed to OpenPIC inputs 12-15. These values are offset by 16
4996 - * in the table to reflect the Linux kernel interrupt value.
4998 -struct powerplus_irq_list Mesquite_pci_IRQ_list =
5005 - * This table represents the standard PCI swizzle defined in the
5006 - * PCI bus specification.
5008 -static unsigned char prep_pci_intpins[4][4] =
5010 - { 1, 2, 3, 4}, /* Buses 0, 4, 8, ... */
5011 - { 2, 3, 4, 1}, /* Buses 1, 5, 9, ... */
5012 - { 3, 4, 1, 2}, /* Buses 2, 6, 10 ... */
5013 - { 4, 1, 2, 3}, /* Buses 3, 7, 11 ... */
5016 /* We have to turn on LEVEL mode for changed IRQ's */
5017 /* All PCI IRQ's need to be level mode, so this should be something
5018 * other than hard-coded as well... IRQ's are individually mappable
5020 #define MOT_RAVEN_PRESENT 0x1
5021 #define MOT_HAWK_PRESENT 0x2
5023 -int mot_entry = -1;
5024 +/* Keyboard present flag */
5025 +int prep_kbd_present = 1; /* Keyboard present by default */
5030 OpenPIC_InitSenses = mvme2600_openpic_initsenses;
5031 OpenPIC_NumInitSenses = sizeof(mvme2600_openpic_initsenses);
5033 - ppc_md.do_IRQ = open_pic_do_IRQ;
5034 + ppc_md.do_IRQ = chrp_do_IRQ;
5036 /* If raven is present on Motorola store the system config register
5038 @@ -795,17 +752,13 @@
5043 - * If a Motorola MVME2300, 2400, or MCPN750 board is detected
5044 - * disable keyboard controller initialization to avoid system
5046 + /* This is a hack. If this is a 2300 or 2400 mot board then there is
5047 + * no keyboard controller and we have to indicate that.
5049 base_mod = inb(MOTOROLA_BASETYPE_REG);
5050 if ((MotMPIC == MOT_HAWK_PRESENT) || (base_mod == 0xF9) ||
5051 - (base_mod == 0xFA) || (base_mod == 0xE1)) {
5052 - ppc_md.kbd_leds = NULL;
5053 - ppc_md.kbd_init_hw = NULL;
5055 + (base_mod == 0xFA) || (base_mod == 0xE1))
5056 + prep_kbd_present = 0;
5060 @@ -819,35 +772,33 @@
5062 unsigned char *routes;
5063 void (*map_non0_bus)(struct pci_dev *); /* For boards with more than bus 0 devices. */
5064 - struct powerplus_irq_list *pci_irq_list; /* List of PCI MPIC inputs */
5065 - unsigned char secondary_bridge_devfn; /* devfn of secondary bus transparent bridge */
5067 - {0x300, 0x00, 0x00, "MVME 2400", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5068 - {0x010, 0x00, 0x00, "Genesis", Genesis_pci_IRQ_map, Genesis_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5069 - {0x020, 0x00, 0x00, "Powerstack (Series E)", Comet_pci_IRQ_map, Comet_pci_IRQ_routes, NULL, NULL, 0x00},
5070 - {0x040, 0x00, 0x00, "Blackhawk (Powerstack)", Blackhawk_pci_IRQ_map, Blackhawk_pci_IRQ_routes, NULL, NULL, 0x00},
5071 - {0x050, 0x00, 0x00, "Omaha (PowerStack II Pro3000)", Omaha_pci_IRQ_map, Omaha_pci_IRQ_routes, NULL, NULL, 0x00},
5072 - {0x060, 0x00, 0x00, "Utah (Powerstack II Pro4000)", Utah_pci_IRQ_map, Utah_pci_IRQ_routes, NULL, NULL, 0x00},
5073 - {0x0A0, 0x00, 0x00, "Powerstack (Series EX)", Comet2_pci_IRQ_map, Comet2_pci_IRQ_routes, NULL, NULL, 0x00},
5074 - {0x1E0, 0xE0, 0x00, "Mesquite cPCI (MCP750)", Mesquite_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Mesquite_pci_IRQ_list, 0x00},
5075 - {0x1E0, 0xE1, 0x00, "Sitka cPCI (MCPN750)", Sitka_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5076 - {0x1E0, 0xE2, 0x00, "Mesquite cPCI (MCP750) w/ HAC", Mesquite_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Mesquite_pci_IRQ_list, 0xC0},
5077 - {0x1E0, 0xF6, 0x80, "MTX Plus", MTXplus_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xA0},
5078 - {0x1E0, 0xF6, 0x81, "Dual MTX Plus", MTXplus_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xA0},
5079 - {0x1E0, 0xF7, 0x80, "MTX wo/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5080 - {0x1E0, 0xF7, 0x81, "Dual MTX wo/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5081 - {0x1E0, 0xF8, 0x80, "MTX w/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5082 - {0x1E0, 0xF8, 0x81, "Dual MTX w/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5083 - {0x1E0, 0xF9, 0x00, "MVME 2300", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5084 - {0x1E0, 0xFA, 0x00, "MVME 2300SC/2600", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5085 - {0x1E0, 0xFB, 0x00, "MVME 2600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5086 - {0x1E0, 0xFC, 0x00, "MVME 2600/2700 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5087 - {0x1E0, 0xFD, 0x80, "MVME 3600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5088 - {0x1E0, 0xFD, 0x81, "MVME 4600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5089 - {0x1E0, 0xFE, 0x80, "MVME 3600 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5090 - {0x1E0, 0xFE, 0x81, "MVME 4600 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
5091 - {0x1E0, 0xFF, 0x00, "MVME 1600-001 or 1600-011", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL, NULL, 0x00},
5092 - {0x000, 0x00, 0x00, "", NULL, NULL, NULL, 0x00}
5093 + {0x300, 0x00, 0x00, "MVME 2400", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5094 + {0x010, 0x00, 0x00, "Genesis", Genesis_pci_IRQ_map, Genesis_pci_IRQ_routes, NULL},
5095 + {0x020, 0x00, 0x00, "Powerstack (Series E)", Comet_pci_IRQ_map, Comet_pci_IRQ_routes, NULL},
5096 + {0x040, 0x00, 0x00, "Blackhawk (Powerstack)", Blackhawk_pci_IRQ_map, Blackhawk_pci_IRQ_routes, NULL},
5097 + {0x050, 0x00, 0x00, "Omaha (PowerStack II Pro3000)", Omaha_pci_IRQ_map, Omaha_pci_IRQ_routes, NULL},
5098 + {0x060, 0x00, 0x00, "Utah (Powerstack II Pro4000)", Utah_pci_IRQ_map, Utah_pci_IRQ_routes, NULL},
5099 + {0x0A0, 0x00, 0x00, "Powerstack (Series EX)", Comet2_pci_IRQ_map, Comet2_pci_IRQ_routes, NULL},
5100 + {0x1E0, 0xE0, 0x00, "Mesquite cPCI (MCP750)", Mesquite_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5101 + {0x1E0, 0xE1, 0x00, "Sitka cPCI (MCPN750)", Sitka_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5102 + {0x1E0, 0xE2, 0x00, "Mesquite cPCI (MCP750) w/ HAC", Mesquite_pci_IRQ_map, Raven_pci_IRQ_routes, Mesquite_Map_Non0},
5103 + {0x1E0, 0xF6, 0x80, "MTX Plus", MTXplus_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5104 + {0x1E0, 0xF6, 0x81, "Dual MTX Plus", MTXplus_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5105 + {0x1E0, 0xF7, 0x80, "MTX wo/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5106 + {0x1E0, 0xF7, 0x81, "Dual MTX wo/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5107 + {0x1E0, 0xF8, 0x80, "MTX w/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5108 + {0x1E0, 0xF8, 0x81, "Dual MTX w/ Parallel Port", MTX_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5109 + {0x1E0, 0xF9, 0x00, "MVME 2300", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5110 + {0x1E0, 0xFA, 0x00, "MVME 2300SC/2600", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5111 + {0x1E0, 0xFB, 0x00, "MVME 2600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5112 + {0x1E0, 0xFC, 0x00, "MVME 2600/2700 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5113 + {0x1E0, 0xFD, 0x80, "MVME 3600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5114 + {0x1E0, 0xFD, 0x81, "MVME 4600 with MVME712M", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5115 + {0x1E0, 0xFE, 0x80, "MVME 3600 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5116 + {0x1E0, 0xFE, 0x81, "MVME 4600 with MVME761", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5117 + {0x1E0, 0xFF, 0x00, "MVME 1600-001 or 1600-011", Genesis2_pci_IRQ_map, Raven_pci_IRQ_routes, NULL},
5118 + {0x000, 0x00, 0x00, "", NULL, NULL, NULL}
5121 __initfunc(unsigned long prep_route_pci_interrupts(void))
5123 unsigned char cpu_type;
5124 unsigned char base_mod;
5126 + int mot_entry = -1;
5128 cpu_type = inb(MOTOROLA_CPUTYPE_REG) & 0xF0;
5129 base_mod = inb(MOTOROLA_BASETYPE_REG);
5130 @@ -1038,91 +990,91 @@
5135 - * Remove a device from the kernel PCI device list based on its
5136 - * devfn identifier.
5140 -prep_exclude_pci_device(unsigned char devfn)
5142 +static unsigned int pci_localpirqs[4] =
5144 - struct pci_dev *dev, *pdev = NULL;
5151 - /* Walk the pci device list */
5152 - for(dev=pci_devices; dev; dev=dev->next) {
5153 - if (dev->devfn == devfn)
5156 - * If we find a matching device, adjust
5157 - * the list to remove the device.
5160 - pdev->next = dev->next;
5162 - pci_devices = dev->next;
5163 +static unsigned int pci_remotepirqs[4] =
5176 +static unsigned int pci_remotedev = 0xc0;
5179 -Powerplus_Map_Non0(struct pci_dev *dev)
5180 +Mesquite_Map_Non0(struct pci_dev *pdev)
5182 - struct pci_bus *pbus; /* Parent bus structure pointer */
5183 - struct pci_dev *tdev; /* Temporary device structure */
5184 - unsigned int devnum; /* Accumulated device number */
5185 - unsigned char intline; /* Linux interrupt value */
5186 - unsigned char intpin; /* PCI interrupt pin */
5188 - /* Check for valid PCI dev pointer */
5189 - if (dev == NULL) return;
5191 - /* Fill our temporary device, and get the device number */
5193 - devnum = PCI_SLOT(tdev->devfn);
5195 - /* Read the interrupt pin of the device and adjust for indexing */
5196 - pcibios_read_config_byte(tdev->bus->number, tdev->devfn,
5197 - PCI_INTERRUPT_PIN, &intpin);
5198 + struct pci_bus *pbus; /* Parent Bus Structure Pointer */
5199 + unsigned int devnum; /* Accumulated Device Number */
5200 + unsigned int irq; /* IRQ Value */
5202 - /* If device doesn't request an interrupt, return */
5203 - if ( (intpin < 1) || (intpin > 4) )
5206 + ** Device Interrupt Line register initialization.
5207 + ** The IRQ line number will be generated after
5208 + ** taking into account all the PCI-2-PCI bridge
5209 + ** devices between the device and the Host Bridge.
5211 + devnum = PCI_SLOT(pdev->devfn);
5214 + while ((pbus->parent)->primary != (pbus->parent)->secondary)
5216 + devnum += PCI_SLOT((pbus->self)->devfn);
5218 + pbus = pbus->parent;
5224 + ** By default, get the PCI local domain IRQ value.
5226 + irq = pci_localpirqs[devnum];
5229 + ** Determine if the device is located in the
5230 + ** remote domain or not. We must find the
5231 + ** domain's bridge device located on bus 0.
5235 + while (pbus->primary != 0)
5236 + pbus = pbus->parent;
5240 + ** Check the device/function of domain's bridge
5241 + ** device against the remote device/function.
5242 + ** If the same, then the device is located in
5243 + ** the remote domain. Thus, get the PCI remote
5244 + ** domain IRQ value.
5246 + if ((pbus->self)->devfn == pci_remotedev)
5247 + irq = pci_remotepirqs[devnum];
5249 - /* Walk up to bus 0, adjusting the interrupt pin for the standard
5250 - PCI bus swizzle. */
5252 - intpin = (prep_pci_intpins[devnum % 4][intpin]) - 1;
5253 - pbus = tdev->bus; /* up one level */
5254 - tdev = pbus->self;
5255 - devnum = PCI_SLOT(tdev->devfn);
5256 - } while(tdev->bus->number);
5258 - /* Use the primary interrupt inputs by default */
5259 - intline = mot_info[mot_entry].pci_irq_list->primary[intpin];
5261 - /* If the board has secondary interrupt inputs, walk the bus and
5262 - note the devfn of the bridge from bus 0. If it is the same as
5263 - the devfn of the bus bridge with secondary inputs, use those. */
5264 - if (mot_info[mot_entry].secondary_bridge_devfn)
5266 + ** Validate the IRQ number.
5272 - while (pbus->primary != 0)
5273 - pbus = pbus->parent;
5275 - if ((pbus->self)->devfn == mot_info[mot_entry].secondary_bridge_devfn)
5276 - intline = mot_info[mot_entry].pci_irq_list->secondary[intpin];
5278 + ** Set the device's Interrupt Line register
5279 + ** to the IRQ number and save it in the
5280 + ** device's structure.
5283 + pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, (u8)irq);
5289 - /* Write calculated interrupt value to header and device list */
5290 - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, (u8)intline);
5291 - dev->irq = intline;
5295 int motopenpic_to_irq(int n)
5296 @@ -1130,7 +1082,7 @@
5300 - return(n+open_pic.irq_offset);
5301 + return(openpic_to_irq(n));
5305 @@ -1169,17 +1121,6 @@
5306 dev->devfn, 0x44, short_reg);
5309 - if ((dev = pci_find_device(PCI_VENDOR_ID_WINBOND,
5310 - PCI_DEVICE_ID_WINBOND_82C105, dev))){
5312 - /* Disable LEGIRQ mode so PCI INTs are routed to
5314 - pci_write_config_dword(dev, 0x40, 0x10ff00a1);
5316 - /* Enable LEGIRQ for PCI INT -> 8259 IRQ routing */
5317 - pci_write_config_dword(dev, 0x40, 0x10ff08a1);
5323 @@ -1197,15 +1138,6 @@
5325 prep_route_pci_interrupts();
5328 - * If MTX+, exclude the SL82C105 IDE controller so the driver
5331 - if ( _prep_type == _PREP_Motorola )
5332 - if ( strstr(mot_info[mot_entry].name, "MTX Plus") )
5333 - /* On MTX+, SL82C105 is at IDSEL 0xb function 0x1 */
5334 - prep_exclude_pci_device(PCI_DEVFN(0xb, 0x1));
5338 printk("Setting PCI interrupts for a \"%s\"\n", Motherboard_map_name);
5339 @@ -1219,7 +1151,7 @@
5340 motopenpic_to_irq(Motherboard_map[PCI_SLOT(dev->devfn)]);
5342 pcibios_write_config_byte(dev->bus->number, dev->devfn,
5343 - PCI_INTERRUPT_LINE, dev->irq);
5344 + PCI_INTERRUPT_PIN, dev->irq);
5346 if (Motherboard_non0 != NULL)
5347 Motherboard_non0(dev);
5348 diff -urN linux.orig/arch/ppc/kernel/prep_setup.c linux/arch/ppc/kernel/prep_setup.c
5349 --- linux.orig/arch/ppc/kernel/prep_setup.c Sun Mar 25 18:31:49 2001
5350 +++ linux/arch/ppc/kernel/prep_setup.c Thu Jul 11 15:46:34 2002
5352 #include <linux/timex.h>
5353 #include <linux/pci.h>
5354 #include <linux/openpic.h>
5355 -#include <linux/delay.h>
5357 #include <asm/mmu.h>
5358 #include <asm/processor.h>
5359 #include <asm/residual.h>
5361 +#include <asm/irq-compat.h>
5362 #include <asm/pgtable.h>
5363 #include <asm/ide.h>
5364 #include <asm/cache.h>
5366 #include <asm/prep_nvram.h>
5367 #include <asm/raven.h>
5368 #include <asm/keyboard.h>
5369 -#include <asm/time.h>
5370 -#include <asm/vga.h>
5374 #include "local_irq.h"
5376 #include "open_pic.h"
5377 @@ -102,12 +102,16 @@
5378 extern PTE *Hash, *Hash_end;
5379 extern unsigned long Hash_size, Hash_mask;
5380 extern int probingmem;
5381 +extern unsigned long loops_per_jiffy;
5383 #ifdef CONFIG_BLK_DEV_RAM
5384 extern int rd_doload; /* 1 = load ramdisk, 0 = don't load */
5385 extern int rd_prompt; /* 1 = prompt for ramdisk, 0 = don't prompt */
5386 extern int rd_image_start; /* starting block # of image */
5388 +#ifdef CONFIG_VGA_CONSOLE
5389 +unsigned long vgacon_remap_base;
5397 if (OpenPIC != NULL) {
5398 - open_pic.irq_offset = 16;
5399 for ( i = 16 ; i < 36 ; i++ )
5400 irq_desc[i].ctl = &open_pic;
5402 @@ -615,14 +618,8 @@
5403 irq_desc[i].ctl = &i8259_pic;
5406 - request_irq(OPENPIC_VEC_IPI, openpic_ipi_action,
5407 + request_irq(openpic_to_irq(OPENPIC_VEC_SPURIOUS), openpic_ipi_action,
5409 - request_irq(OPENPIC_VEC_IPI+1, openpic_ipi_action,
5410 - 0, "IPI1 (invalidate TLB)", 0);
5411 - request_irq(OPENPIC_VEC_IPI+2, openpic_ipi_action,
5412 - 0, "IPI2 (stop CPU)", 0);
5413 - request_irq(OPENPIC_VEC_IPI+3, openpic_ipi_action,
5414 - 0, "IPI3 (reschedule)", 0);
5415 #endif /* __SMP__ */
5418 diff -urN linux.orig/arch/ppc/kernel/prep_time.c linux/arch/ppc/kernel/prep_time.c
5419 --- linux.orig/arch/ppc/kernel/prep_time.c Sun Mar 25 18:31:49 2001
5420 +++ linux/arch/ppc/kernel/prep_time.c Thu Jul 11 15:43:29 2002
5422 #include <asm/prep_nvram.h>
5423 #include <asm/mk48t59.h>
5425 -#include <asm/time.h>
5429 * The motorola uses the m48t18 rtc (includes DS1643) whose registers
5430 diff -urN linux.orig/arch/ppc/kernel/process.c linux/arch/ppc/kernel/process.c
5431 --- linux.orig/arch/ppc/kernel/process.c Sun Mar 25 18:31:49 2001
5432 +++ linux/arch/ppc/kernel/process.c Thu Jul 11 15:43:29 2002
5434 #include <asm/mmu_context.h>
5436 int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs);
5437 -int dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs);
5438 extern unsigned long _get_SP(void);
5440 struct task_struct *last_task_used_math = NULL;
5441 -struct task_struct *last_task_used_altivec = NULL;
5442 static struct vm_area_struct init_mmap = INIT_MMAP;
5443 static struct fs_struct init_fs = INIT_FS;
5444 static struct files_struct init_files = INIT_FILES;
5449 -#ifdef CONFIG_ALTIVEC
5451 -dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs)
5453 - if (regs->msr & MSR_VEC)
5454 - giveup_altivec(current);
5455 - memcpy(vrregs, ¤t->tss.vr[0], sizeof(*vrregs));
5460 -enable_kernel_altivec(void)
5463 - if (current->tss.regs && (current->tss.regs->msr & MSR_VEC))
5464 - giveup_altivec(current);
5466 - giveup_altivec(NULL); /* just enable AltiVec for kernel - force */
5468 - giveup_altivec(last_task_used_altivec);
5469 -#endif /* __SMP __ */
5470 - printk("MSR_VEC in enable_altivec_kernel\n");
5472 -#endif /* CONFIG_ALTIVEC */
5475 enable_kernel_fp(void)
5477 @@ -221,53 +194,22 @@
5478 _enable_interrupts(s);
5486 -void print_bits(unsigned int val, struct bits *bits)
5488 - const char *sep = "";
5491 - for (; bits->bit != 0; ++bits) {
5492 - if (val & bits->bit) {
5493 - printk("%s%s", sep, bits->name);
5500 -struct bits msr_bits[] = {
5511 -void show_regs(struct pt_regs *regs)
5512 +void show_regs(struct pt_regs * regs)
5516 printk("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx\n",
5517 regs->nip, regs->xer, regs->link, regs,regs->trap);
5518 - printk("MSR: %08lx ", regs->msr);
5519 - print_bits(regs->msr, msr_bits);
5521 + printk("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
5522 + regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
5523 + regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
5524 + regs->msr&MSR_IR ? 1 : 0,
5525 + regs->msr&MSR_DR ? 1 : 0);
5526 printk("TASK = %p[%d] '%s' mm->pgd %p ",
5527 current, current->pid, current->comm, current->mm->pgd);
5528 printk("Last syscall: %ld ", current->tss.last_syscall);
5529 - if (last_task_used_math)
5530 - printk("\nlast math %p", last_task_used_math);
5531 - if (last_task_used_altivec)
5532 - printk("\nlast altivec %p", last_task_used_altivec);
5534 + printk("\nlast math %p", last_task_used_math);
5537 printk(" CPU: %d last CPU: %d", current->processor,current->last_processor);
5538 #endif /* __SMP__ */
5539 @@ -314,16 +256,12 @@
5541 if (last_task_used_math == current)
5542 last_task_used_math = NULL;
5543 - if (last_task_used_altivec == current)
5544 - last_task_used_altivec = NULL;
5547 void flush_thread(void)
5549 if (last_task_used_math == current)
5550 last_task_used_math = NULL;
5551 - if (last_task_used_altivec == current)
5552 - last_task_used_altivec = NULL;
5556 @@ -381,19 +319,6 @@
5557 if (regs->msr & MSR_FP)
5558 giveup_fpu(current);
5560 -#ifdef CONFIG_ALTIVEC
5562 - * copy altiVec info - assume lazy altiVec switch
5565 - if (regs->msr & MSR_VEC)
5566 - giveup_altivec(current);
5568 - memcpy(&p->tss.vr, ¤t->tss.vr, sizeof(p->tss.vr));
5569 - p->tss.vscr = current->tss.vscr;
5570 - childregs->msr &= ~MSR_VEC;
5571 -#endif /* CONFIG_ALTIVEC */
5573 memcpy(&p->tss.fpr, ¤t->tss.fpr, sizeof(p->tss.fpr));
5574 p->tss.fpscr = current->tss.fpscr;
5575 childregs->msr &= ~MSR_FP;
5577 shove_aux_table(sp);
5578 if (last_task_used_math == current)
5579 last_task_used_math = 0;
5580 - if (last_task_used_altivec == current)
5581 - last_task_used_altivec = 0;
5582 current->tss.fpscr = 0;
5585 @@ -516,10 +439,6 @@
5587 if (regs->msr & MSR_FP)
5588 giveup_fpu(current);
5589 -#ifdef CONFIG_ALTIVEC
5590 - if (regs->msr & MSR_VEC)
5591 - giveup_altivec(current);
5592 -#endif /* CONFIG_ALTIVEC */
5593 error = do_execve(filename, (char **) a1, (char **) a2, regs);
5596 diff -urN linux.orig/arch/ppc/kernel/prom.c linux/arch/ppc/kernel/prom.c
5597 --- linux.orig/arch/ppc/kernel/prom.c Sun Mar 25 18:37:30 2001
5598 +++ linux/arch/ppc/kernel/prom.c Thu Jul 11 15:43:29 2002
5600 #include <linux/string.h>
5601 #include <linux/init.h>
5602 #include <linux/version.h>
5603 -#include <linux/fs.h>
5604 -#include <linux/console.h>
5605 #include <asm/spinlock.h>
5606 #include <asm/prom.h>
5607 #include <asm/page.h>
5608 #include <asm/processor.h>
5609 #include <asm/irq.h>
5610 +#include <asm/irq-compat.h>
5612 #include <asm/smp.h>
5613 #include <asm/bootx.h>
5614 #include <asm/system.h>
5615 #include <asm/gemini.h>
5616 -#include <asm/linux_logo.h>
5617 -#include <asm/mmu.h>
5618 -#include <asm/pgtable.h>
5619 -#include <asm/adb.h>
5620 -#include <asm/pmu.h>
5623 * Properties whose value is longer than this get excluded from our
5624 * copy of the device tree. This way we don't waste space storing
5625 * things like "driver,AAPL,MacOS,PowerPC" properties.
5628 #define MAX_PROPERTY_LENGTH 1024
5632 char *of_stdout_device = 0;
5634 prom_entry prom = 0;
5635 -ihandle prom_chosen = 0, prom_stdout = 0, prom_disp_node = 0;
5636 +ihandle prom_chosen = 0, prom_stdout = 0;
5637 int prom_version = 0;
5639 extern char *klimit;
5641 char *bootdevice = 0;
5643 -unsigned int rtas_data = 0; /* physical pointer */
5644 +unsigned int rtas_data = 0; /* virtual pointer */
5645 unsigned int rtas_entry = 0; /* physical pointer */
5646 unsigned int rtas_size = 0;
5647 unsigned int old_rtas = 0;
5649 -/* Set for a newworld machine */
5650 -int use_of_interrupt_tree = 0;
5651 -int pmac_newworld = 0;
5653 static struct device_node *allnodes = 0;
5655 -#ifdef CONFIG_BOOTX_TEXT
5658 - * The VGA font is in the _pmac section. Can't this cause problems with CHRP
5659 - * using some of the prom_xxxx functions ?
5660 - * All this need to be moved in a separate source file anyway
5663 static void clearscreen(void);
5664 static void flushscreen(void);
5666 +#ifdef CONFIG_BOOTX_TEXT
5668 void drawchar(char c);
5669 void drawstring(const char *c);
5670 -void drawhex(unsigned long v);
5671 +static void drawhex(unsigned long v);
5672 static void scrollscreen(void);
5673 -static void prepare_disp_BAT(void);
5674 -static void boot_console_write(struct console *co, const char *s,
5677 static void draw_byte(unsigned char c, long locX, long locY);
5678 -static void draw_byte_32(unsigned char *bits, unsigned long *base, int rb);
5679 -static void draw_byte_16(unsigned char *bits, unsigned long *base, int rb);
5680 -static void draw_byte_8(unsigned char *bits, unsigned long *base, int rb);
5682 -/* We want those in the data section */
5683 -static long g_loc_X = 0;
5684 -static long g_loc_Y = 0;
5685 -static long g_max_loc_X = 0;
5686 -static long g_max_loc_Y = 0;
5688 -unsigned long disp_BATL = 0;
5689 -unsigned long disp_BATU = 0;
5690 +static void draw_byte_32(unsigned char *bits, unsigned long *base);
5691 +static void draw_byte_16(unsigned char *bits, unsigned long *base);
5692 +static void draw_byte_8(unsigned char *bits, unsigned long *base);
5694 +static long g_loc_X;
5695 +static long g_loc_Y;
5696 +static long g_max_loc_X;
5697 +static long g_max_loc_Y;
5699 #define cmapsz (16*256)
5701 static unsigned char vga_font[cmapsz];
5703 -static struct console boot_cons = {
5705 - boot_console_write,
5716 -static int boot_cons_registered = 0;
5718 -#endif /* CONFIG_BOOTX_TEXT */
5722 static void *call_prom(const char *service, int nargs, int nret, ...);
5723 @@ -175,25 +138,15 @@
5724 unsigned long, struct device_node ***);
5725 static unsigned long finish_node(struct device_node *, unsigned long,
5727 -static unsigned long finish_node_interrupts(struct device_node *, unsigned long);
5728 static unsigned long check_display(unsigned long);
5729 static int prom_next_node(phandle *);
5730 static void *early_get_property(unsigned long, unsigned long, char *);
5732 -#ifdef CONFIG_BOOTX_TEXT
5733 -static void setup_disp_fake_bi(ihandle dp);
5734 -static void prom_welcome(boot_infos_t* bi, unsigned long phys);
5737 extern void enter_rtas(void *);
5738 extern unsigned long reloc_offset(void);
5740 extern char cmd_line[512]; /* XXX */
5741 boot_infos_t *boot_infos = 0; /* init it so it's in data segment not bss */
5742 -#ifdef CONFIG_BOOTX_TEXT
5743 -boot_infos_t *disp_bi = 0;
5744 -boot_infos_t fake_bi = {0,};
5748 * prom_init() is called very early on, before the kernel text
5750 return prom_args.args[nargs];
5756 prom_print(const char *msg)
5759 if (RELOC(prom_stdout) == 0)
5761 #ifdef CONFIG_BOOTX_TEXT
5762 - if (RELOC(disp_bi) != 0)
5763 + if (RELOC(boot_infos) != 0)
5767 @@ -307,22 +260,6 @@
5772 -prom_print_hex(unsigned int v)
5777 - for (i = 0; i < 8; ++i) {
5778 - c = (v >> ((7-i)*4)) & 0xf;
5779 - c += (c >= 10)? ('a' - 10): '0';
5787 unsigned long smp_ibm_chrp_hack __initdata = 0;
5792 char type[16], *path;
5796 ihandle prom_rtas, prom_mmu, prom_op;
5797 unsigned long offset = reloc_offset();
5798 @@ -365,19 +301,22 @@
5799 unsigned long space;
5800 unsigned long ptr, x;
5802 +#ifdef CONFIG_BOOTX_TEXT
5803 + unsigned long flags;
5806 RELOC(boot_infos) = PTRUNRELOC(bi);
5807 if (!BOOT_INFO_IS_V2_COMPATIBLE(bi))
5808 bi->logicalDisplayBase = 0;
5812 #ifdef CONFIG_BOOTX_TEXT
5815 RELOC(g_max_loc_X) = (bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) / 8;
5816 RELOC(g_max_loc_Y) = (bi->dispDeviceRect[3] - bi->dispDeviceRect[1]) / 16;
5817 - RELOC(disp_bi) = PTRUNRELOC(bi);
5821 /* Test if boot-info is compatible. Done only in config CONFIG_BOOTX_TEXT since
5822 there is nothing much we can do with an incompatible version, except display
5823 a message and eventually hang the processor...
5824 @@ -388,10 +327,24 @@
5825 if (!BOOT_INFO_IS_COMPATIBLE(bi))
5826 prom_print(RELOC(" !!! WARNING - Incompatible version of BootX !!!\n\n\n"));
5828 - prom_welcome(bi, phys);
5829 + prom_print(RELOC("Welcome to Linux, kernel " UTS_RELEASE "\n"));
5830 + prom_print(RELOC("\nstarted at : 0x"));
5831 + drawhex(reloc_offset() + KERNELBASE);
5832 + prom_print(RELOC("\nlinked at : 0x"));
5833 + drawhex(KERNELBASE);
5834 + prom_print(RELOC("\nframe buffer at : 0x"));
5835 + drawhex((unsigned long)bi->dispDeviceBase);
5836 + prom_print(RELOC(" (phys), 0x"));
5837 + drawhex((unsigned long)bi->logicalDisplayBase);
5838 + prom_print(RELOC(" (log)"));
5839 + prom_print(RELOC("\nMSR : 0x"));
5840 + __asm__ __volatile__ ("mfmsr %0" : "=r" ((flags)) : : "memory");
5842 + prom_print(RELOC("\n\n"));
5844 + /* Out of the #if/#endif since it flushes the clearscreen too */
5846 -#endif /* CONFIG_BOOTX_TEXT */
5849 /* New BootX enters kernel with MMU off, i/os are not allowed
5850 here. This hack will have been done by the boostrap anyway.
5855 #ifdef CONFIG_BOOTX_TEXT
5856 - prepare_disp_BAT();
5857 prom_print(RELOC("booting...\n"));
5860 @@ -470,15 +422,12 @@
5862 sz = (int)call_prom(RELOC("getprop"), 4, 1, prom_op, RELOC("model"), model, 64);
5864 - if ( strncmp(model,RELOC("IBM"),3) ) {
5866 - for (c = model; *c; c++)
5867 - if (*c >= '0' && *c <= '9') {
5868 - RELOC(prom_version) = *c - '0';
5874 + for (c = model; *c; c++)
5875 + if (*c >= '0' && *c <= '9') {
5876 + RELOC(prom_version) = *c - '0';
5881 if (RELOC(prom_version) >= 3)
5882 @@ -498,6 +447,15 @@
5883 RELOC(bootdevice) = PTRUNRELOC(d);
5884 mem = ALIGN(mem + strlen(d) + 1);
5887 + mem = check_display(mem);
5889 + prom_print(RELOC("copying OF device tree..."));
5890 + mem = copy_device_tree(mem, mem + (1<<20));
5891 + prom_print(RELOC("done\n"));
5894 + RELOC(klimit) = (char *) (mem - offset);
5896 prom_rtas = call_prom(RELOC("finddevice"), 1, 1, RELOC("/rtas"));
5897 if (prom_rtas != (void *) -1) {
5898 @@ -509,14 +467,18 @@
5899 RELOC(rtas_data) = 0;
5902 - * Ask OF for some space for RTAS.
5903 + * We do _not_ want the rtas_data inside the klimit
5904 + * boundry since it'll be squashed when we do the
5905 + * relocate of the kernel on chrp right after prom_init()
5906 + * in head.S. So, we just pick a spot in memory.
5909 - RELOC(rtas_data) = (unsigned int)
5910 - call_prom(RELOC("claim"), 3, 1, 0,
5911 - RELOC(rtas_size), 0x1000);
5912 - prom_print(RELOC("rtas at "));
5913 - prom_print_hex(RELOC(rtas_data));
5914 - prom_print(RELOC("\n"));
5916 + mem = (mem + 4095) & -4096;
5917 + RELOC(rtas_data) = mem + KERNELBASE;
5918 + mem += RELOC(rtas_size);
5920 + RELOC(rtas_data) = (6<<20) + KERNELBASE;
5922 prom_rtas = call_prom(RELOC("open"), 1, 1, RELOC("/rtas"));
5926 prom_args.args[0] = RELOC("instantiate-rtas");
5927 prom_args.args[1] = prom_rtas;
5928 - prom_args.args[2] = (void *) RELOC(rtas_data);
5929 + prom_args.args[2] = ((void *)(RELOC(rtas_data)-KERNELBASE));
5930 RELOC(prom)(&prom_args);
5931 if (prom_args.args[nargs] != 0)
5933 @@ -542,15 +504,6 @@
5934 prom_print(RELOC(" done\n"));
5937 - mem = check_display(mem);
5939 - prom_print(RELOC("copying OF device tree..."));
5940 - /* N.B. do this *after* any claims */
5941 - mem = copy_device_tree(mem, mem + (1<<20));
5942 - prom_print(RELOC("done\n"));
5944 - RELOC(klimit) = (char *) (mem - offset);
5946 /* If we are already running at 0xc0000000, we assume we were loaded by
5947 * an OF bootloader which did set a BAT for us. This breaks OF translate
5948 * so we force phys to be 0
5949 @@ -582,11 +535,6 @@
5953 -#ifdef CONFIG_BOOTX_TEXT
5954 - if (RELOC(prom_disp_node) != 0)
5955 - setup_disp_fake_bi(RELOC(prom_disp_node));
5960 * With CHRP SMP we need to use the OF to start the other
5961 @@ -607,11 +555,7 @@
5962 * is in its holding pattern code.
5966 - * This code crashes on some pmacs since the memory at 8M is not
5967 - * claim'ed and so can be unmapped. -- BenH
5971 extern void __secondary_hold(void);
5977 - for (node = 0; chrp && prom_next_node(&node);)
5978 + for (node = 0; prom_next_node(&node);)
5981 call_prom(RELOC("getprop"), 4, 1, node, RELOC("device_type"),
5982 @@ -666,132 +610,19 @@
5984 prom_print(RELOC("...failed\n"));
5986 +#endif /* CONFIG_SMP */
5989 - /* If PowerMac, then use quiesce call */
5991 + /* If OpenFirmware version >= 3, then use quiesce call */
5992 + if (RELOC(prom_version) >= 3) {
5993 prom_print(RELOC("Calling quiesce ...\n"));
5994 call_prom(RELOC("quiesce"), 0, 0);
5995 offset = reloc_offset();
5996 phys = offset + KERNELBASE;
5999 -#ifdef CONFIG_BOOTX_TEXT
6000 - if (!chrp && RELOC(disp_bi)) {
6001 - RELOC(prom_stdout) = 0;
6003 - prepare_disp_BAT();
6004 - prom_welcome(PTRRELOC(RELOC(disp_bi)), phys);
6008 - prom_print(RELOC("booting...\n"));
6012 -#ifdef CONFIG_BOOTX_TEXT
6014 -prom_welcome(boot_infos_t* bi, unsigned long phys)
6016 - unsigned long offset = reloc_offset();
6017 - unsigned long flags;
6018 - unsigned long pvr;
6020 - prom_print(RELOC("Welcome to Linux, kernel " UTS_RELEASE "\n"));
6021 - prom_print(RELOC("\nstarted at : 0x"));
6023 - prom_print(RELOC("\nlinked at : 0x"));
6024 - drawhex(KERNELBASE);
6025 - prom_print(RELOC("\nframe buffer at : 0x"));
6026 - drawhex((unsigned long)bi->dispDeviceBase);
6027 - prom_print(RELOC(" (phys), 0x"));
6028 - drawhex((unsigned long)bi->logicalDisplayBase);
6029 - prom_print(RELOC(" (log)"));
6030 - prom_print(RELOC("\nMSR : 0x"));
6031 - __asm__ __volatile__ ("mfmsr %0" : "=r" (flags));
6033 - __asm__ __volatile__ ("mfspr %0, 287" : "=r" (pvr));
6036 - prom_print(RELOC("\nHID0 : 0x"));
6037 - __asm__ __volatile__ ("mfspr %0, 1008" : "=r" (flags));
6040 - if (pvr == 8 || pvr == 12) {
6041 - prom_print(RELOC("\nICTC : 0x"));
6042 - __asm__ __volatile__ ("mfspr %0, 1019" : "=r" (flags));
6045 - prom_print(RELOC("\n\n"));
6048 -void showvalue(char *str, unsigned long val)
6055 -/* Calc BAT values for mapping the display and store them
6056 - * in disp_BATH and disp_BATL. Those values are then used
6057 - * from head.S to map the display during identify_machine()
6060 - * For now, the display is mapped in place (1:1). This should
6061 - * be changed if the display physical address overlaps
6062 - * KERNELBASE, which is fortunately not the case on any machine
6063 - * I know of. This mapping is temporary and will disappear as
6064 - * soon as the setup done by MMU_Init() is applied
6066 - * For now, we align the BAT and then map 8Mb on 601 and 16Mb
6067 - * on other PPCs. This may cause trouble if the framebuffer
6068 - * is really badly aligned, but I didn't encounter this case
6073 -prepare_disp_BAT(void)
6075 - unsigned long offset = reloc_offset();
6076 - boot_infos_t* bi = PTRRELOC(RELOC(disp_bi));
6077 - unsigned long addr = (unsigned long)bi->dispDeviceBase;
6079 - if ((_get_PVR() >> 16) != 1) {
6080 - /* 603, 604, G3, G4, ... */
6081 - addr &= 0xFF000000UL;
6082 - RELOC(disp_BATU) = addr | (BL_16M<<2) | 2;
6083 - RELOC(disp_BATL) = addr | (_PAGE_NO_CACHE | _PAGE_GUARDED | BPP_RW);
6086 - addr &= 0xFF800000UL;
6087 - RELOC(disp_BATU) = addr | (_PAGE_NO_CACHE | PP_RWXX) | 4;
6088 - RELOC(disp_BATL) = addr | BL_8M | 0x40;
6090 - bi->logicalDisplayBase = bi->dispDeviceBase;
6097 -prom_set_color(ihandle ih, int i, int r, int g, int b)
6099 - struct prom_args prom_args;
6100 - unsigned long offset = reloc_offset();
6102 - prom_args.service = RELOC("call-method");
6103 - prom_args.nargs = 6;
6104 - prom_args.nret = 1;
6105 - prom_args.args[0] = RELOC("color!");
6106 - prom_args.args[1] = ih;
6107 - prom_args.args[2] = (void *) i;
6108 - prom_args.args[3] = (void *) b;
6109 - prom_args.args[4] = (void *) g;
6110 - prom_args.args[5] = (void *) r;
6111 - RELOC(prom)(&prom_args);
6112 - return (int) prom_args.args[6];
6116 * If we have a display that we don't know how to drive,
6117 * we will want to try to execute OF's open method for it
6118 @@ -804,32 +635,11 @@
6119 static unsigned long
6120 check_display(unsigned long mem)
6126 unsigned long offset = reloc_offset();
6127 - char type[16], *path, name[32];
6128 - static unsigned char default_colors[] = {
6147 - RELOC(prom_disp_node) = 0;
6148 + char type[16], *path;
6150 for (node = 0; prom_next_node(&node); ) {
6152 @@ -837,12 +647,6 @@
6153 type, sizeof(type));
6154 if (strcmp(type, RELOC("display")) != 0)
6157 - call_prom(RELOC("getprop"), 4, 1, node, RELOC("name"),
6158 - name, sizeof(name));
6159 - if (!strcmp(name, RELOC("offscreen-display")))
6162 /* It seems OF doesn't null-terminate the path :-( */
6163 path = (char *) mem;
6164 memset(path, 0, 256);
6165 @@ -858,24 +662,6 @@
6167 prom_print(RELOC("... ok\n"));
6169 - if (RELOC(prom_disp_node) == 0)
6170 - RELOC(prom_disp_node) = node;
6172 - /* Setup a useable color table when the appropriate
6173 - * method is available. Should update this to set-colors */
6174 - for (i = 0; i < 32; i++)
6175 - if (prom_set_color(ih, i, RELOC(default_colors)[i*3],
6176 - RELOC(default_colors)[i*3+1],
6177 - RELOC(default_colors)[i*3+2]) != 0)
6180 - for (i = 0; i < LINUX_LOGO_COLORS; i++)
6181 - if (prom_set_color(ih, i + 32,
6182 - RELOC(linux_logo_red)[i],
6183 - RELOC(linux_logo_green)[i],
6184 - RELOC(linux_logo_blue)[i]) != 0)
6188 * If this display is the device that OF is using for stdout,
6189 * move it to the front of the list.
6190 @@ -892,85 +678,9 @@
6191 if (RELOC(prom_num_displays) >= FB_MAX)
6194 -#endif /* CONFIG_FB */
6198 -/* This function will enable the early boot text when doing OF booting. This
6199 - * way, xmon output should work too
6201 -#ifdef CONFIG_BOOTX_TEXT
6204 -setup_disp_fake_bi(ihandle dp)
6207 - int width = 640, height = 480, depth = 8, pitch;
6210 - unsigned long offset = reloc_offset();
6212 - prom_print(RELOC("Initing fake screen\n"));
6215 - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("depth"), &len, sizeof(len));
6217 - prom_print(RELOC("Warning: assuming display depth = 8\n"));
6221 - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("width"), &len, sizeof(len));
6224 - prom_print(RELOC("Failed to get width\n"));
6228 - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("height"), &len, sizeof(len));
6230 - if (height == 0) {
6231 - prom_print(RELOC("Failed to get height\n"));
6235 - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("linebytes"), &len, sizeof(len));
6238 - prom_print(RELOC("Failed to get pitch\n"));
6243 - address = len = 0;
6245 - call_prom(RELOC("getprop"), 4, 1, dp, RELOC("address"), &len, sizeof(len));
6247 - if (address == 0) {
6248 - prom_print(RELOC("Failed to get address\n"));
6252 - /* kludge for valkyrie */
6253 - if (strcmp(dp->name, "valkyrie") == 0)
6254 - address += 0x1000;
6257 - RELOC(disp_bi) = &fake_bi;
6258 - bi = PTRRELOC((&fake_bi));
6259 - RELOC(g_loc_X) = 0;
6260 - RELOC(g_loc_Y) = 0;
6261 - RELOC(g_max_loc_X) = width / 8;
6262 - RELOC(g_max_loc_Y) = height / 16;
6263 - bi->logicalDisplayBase = (unsigned char *)address;
6264 - bi->dispDeviceBase = (unsigned char *)address;
6265 - bi->dispDeviceRowBytes = pitch;
6266 - bi->dispDeviceDepth = depth;
6267 - bi->dispDeviceRect[0] = bi->dispDeviceRect[1] = 0;
6268 - bi->dispDeviceRect[2] = width;
6269 - bi->dispDeviceRect[3] = height;
6275 prom_next_node(phandle *nodep)
6276 @@ -1106,18 +816,6 @@
6278 unsigned long mem = (unsigned long) klimit;
6280 - /* All newworld machines and CHRP now use the interrupt tree */
6281 - struct device_node *np = allnodes;
6282 - while(np && (_machine == _MACH_Pmac)) {
6283 - if (get_property(np, "interrupt-parent", 0)) {
6284 - pmac_newworld = 1;
6289 - if ((_machine == _MACH_chrp) || (boot_infos == 0 && pmac_newworld))
6290 - use_of_interrupt_tree = 1;
6292 mem = finish_node(allnodes, mem, NULL);
6293 printk(KERN_INFO "device tree used %lu bytes\n",
6294 mem - (unsigned long) allnodes);
6295 @@ -1158,9 +856,6 @@
6296 if (ifunc != NULL) {
6297 mem_start = ifunc(np, mem_start);
6299 - if (use_of_interrupt_tree) {
6300 - mem_start = finish_node_interrupts(np, mem_start);
6303 /* the f50 sets the name to 'display' and 'compatible' to what we
6304 * expect for the name -- Cort
6305 @@ -1207,151 +902,6 @@
6309 -/* This routine walks the interrupt tree for a given device node and gather
6310 - * all necessary informations according to the draft interrupt mapping
6311 - * for CHRP. The current version was only tested on Apple "Core99" machines
6312 - * and may not handle cascaded controllers correctly.
6315 -static unsigned long
6316 -finish_node_interrupts(struct device_node *np, unsigned long mem_start)
6318 - /* Finish this node */
6319 - unsigned int *isizep, *asizep, *interrupts, *map, *map_mask, *reg;
6321 - struct device_node *node, *parent_node;
6322 - int l, isize, ipsize, asize, map_size, regpsize;
6324 - /* Currently, we don't look at all nodes with no "interrupts" property */
6325 - interrupts = (unsigned int *)get_property(np, "interrupts", &l);
6326 - if (interrupts == NULL)
6330 - reg = (unsigned int *)get_property(np, "reg", &l);
6333 - /* We assume default interrupt cell size is 1 (bugus ?) */
6338 - /* We adjust the cell size if the current parent contains an #interrupt-cells
6340 - isizep = (unsigned int *)get_property(node, "#interrupt-cells", &l);
6344 - /* We don't do interrupt cascade (ISA) for now, we stop on the first
6345 - * controller found
6347 - if (get_property(node, "interrupt-controller", &l)) {
6349 - np->intrs = (struct interrupt_info *) mem_start;
6350 - np->n_intrs = ipsize / isize;
6351 - mem_start += np->n_intrs * sizeof(struct interrupt_info);
6352 - for (i = 0; i < np->n_intrs; ++i) {
6353 - np->intrs[i].line = *interrupts++;
6354 - np->intrs[i].sense = 0;
6356 - np->intrs[i].sense = *interrupts++;
6357 - for (j=2; j<isize; j++)
6361 - * On the CHRP LongTrail, ISA interrupts are cascaded through
6362 - * the OpenPIC. For compatibility reasons, ISA interrupts are
6363 - * numbered 0-15 and OpenPIC interrupts start at 16.
6364 - * Hence we have to fixup the interrupt numbers for sources
6365 - * that are attached to the OpenPIC and thus have an
6366 - * interrupt-controller named `open-pic'.
6368 - * FIXME: The name of the interrupt-controller node for the
6369 - * `ide' node has no name, although its parent is
6370 - * correctly specified in interrupt-map, so we check
6371 - * for a NULL name as well.
6373 - if (_machine == _MACH_chrp &&
6374 - ((node->name && !strcmp(node->name, "open-pic")) ||
6376 - for (i = 0; i < np->n_intrs; ++i)
6377 - np->intrs[i].line = np->intrs[i].line + NUM_8259_INTERRUPTS;
6381 - /* We lookup for an interrupt-map. This code can only handle one interrupt
6382 - * per device in the map. We also don't handle #address-cells in the parent
6383 - * I skip the pci node itself here, may not be necessary but I don't like it's
6387 - map = (unsigned int *)get_property(node, "interrupt-map", &l);
6391 - int i, found, temp_isize;
6393 - map_mask = (unsigned int *)get_property(node, "interrupt-map-mask", &l);
6394 - asizep = (unsigned int *)get_property(node, "#address-cells", &l);
6395 - if (asizep && l == sizeof(unsigned int))
6400 - while(map_size>0 && !found) {
6402 - for (i=0; i<asize; i++) {
6403 - unsigned int mask = map_mask ? map_mask[i] : 0xffffffff;
6404 - if (!reg || (i>=regpsize) || ((mask & *map) != (mask & reg[i])))
6409 - for (i=0; i<isize; i++) {
6410 - unsigned int mask = map_mask ? map_mask[i+asize] : 0xffffffff;
6411 - if ((mask & *map) != (mask & interrupts[i]))
6416 - parent = *((phandle *)(map));
6417 - map+=1; map_size-=1;
6418 - parent_node = find_phandle(parent);
6419 - temp_isize = isize;
6420 - if (parent_node) {
6421 - isizep = (unsigned int *)get_property(parent_node, "#interrupt-cells", &l);
6423 - temp_isize = *isizep;
6426 - map += temp_isize;
6427 - map_size-=temp_isize;
6431 - node = parent_node;
6434 - interrupts = (unsigned int *)map;
6435 - ipsize = temp_isize*1;
6439 - /* We look for an explicit interrupt-parent.
6441 - parent = (phandle *)get_property(node, "interrupt-parent", &l);
6442 - if (parent && (l == sizeof(phandle)) &&
6443 - (parent_node = find_phandle(*parent))) {
6444 - node = parent_node;
6447 - /* Default, get real parent */
6448 - node = node->parent;
6455 * When BootX makes a copy of the device tree from the MacOS
6456 * Name Registry, it is in the format we use but all of the pointers
6457 @@ -1410,9 +960,6 @@
6458 mem_start += i * sizeof(struct address_range);
6461 - if (use_of_interrupt_tree)
6465 * If the pci host bridge has an interrupt-map property,
6466 * look for our node in it.
6467 @@ -1422,28 +969,14 @@
6468 get_property(np->parent, "interrupt-map", &ml)) != 0
6469 && (ip = (int *) get_property(np, "interrupts", &l)) != 0) {
6470 unsigned int devfn = pci_addrs[0].addr.a_hi & 0xff00;
6471 - unsigned int cell_size;
6472 - struct device_node* np2;
6473 - /* This is hackish, but is only used for BootX booting */
6474 - cell_size = sizeof(struct pci_intr_map);
6477 - if (device_is_compatible(np2, "uni-north")) {
6481 - np2 = np2->parent;
6484 np->intrs = (struct interrupt_info *) mem_start;
6485 - for (i = 0; (ml -= cell_size) >= 0; ++i) {
6486 - if (imp->addr.a_hi == devfn) {
6487 - np->intrs[np->n_intrs].line = imp->intr;
6488 - np->intrs[np->n_intrs].sense = 0; /* FIXME */
6489 + for (i = 0; (ml -= sizeof(struct pci_intr_map)) >= 0; ++i) {
6490 + if (imp[i].addr.a_hi == devfn) {
6491 + np->intrs[np->n_intrs].line = imp[i].intr;
6492 + np->intrs[np->n_intrs].sense = 0;
6495 - imp = (struct pci_intr_map *)(((unsigned int)imp)
6498 if (np->n_intrs == 0)
6500 @@ -1500,9 +1033,6 @@
6501 mem_start += i * sizeof(struct address_range);
6504 - if (use_of_interrupt_tree)
6507 ip = (int *) get_property(np, "AAPL,interrupts", &l);
6509 ip = (int *) get_property(np, "interrupts", &l);
6510 @@ -1526,14 +1056,13 @@
6511 struct reg_property *rp;
6512 struct address_range *adr;
6513 unsigned long base_address;
6514 - int i, l, keylargo, *ip;
6516 struct device_node *db;
6519 for (db = np->parent; db != NULL; db = db->parent) {
6520 if (!strcmp(db->type, "mac-io") && db->n_addrs != 0) {
6521 base_address = db->addrs[0].address;
6522 - keylargo = device_is_compatible(db, "Keylargo");
6526 @@ -1553,9 +1082,6 @@
6527 mem_start += i * sizeof(struct address_range);
6530 - if (use_of_interrupt_tree)
6533 ip = (int *) get_property(np, "interrupts", &l);
6535 ip = (int *) get_property(np, "AAPL,interrupts", &l);
6536 @@ -1564,21 +1090,15 @@
6537 if (_machine == _MACH_Pmac) {
6539 np->n_intrs = l / sizeof(int);
6540 - /* Hack for BootX on Core99 */
6542 - np->n_intrs = np->n_intrs/2;
6543 for (i = 0; i < np->n_intrs; ++i) {
6544 np->intrs[i].line = *ip++;
6546 - np->intrs[i].sense = *ip++;
6548 - np->intrs[i].sense = 0;
6549 + np->intrs[i].sense = 0;
6553 np->n_intrs = l / (2 * sizeof(int));
6554 for (i = 0; i < np->n_intrs; ++i) {
6555 - np->intrs[i].line = (*ip++) + NUM_8259_INTERRUPTS;
6556 + np->intrs[i].line = openpic_to_irq(*ip++);
6557 np->intrs[i].sense = *ip++;
6560 @@ -1612,9 +1132,6 @@
6561 mem_start += i * sizeof(struct address_range);
6564 - if (use_of_interrupt_tree)
6567 ip = (int *) get_property(np, "interrupts", &l);
6569 np->intrs = (struct interrupt_info *) mem_start;
6570 @@ -1652,9 +1169,6 @@
6571 mem_start += i * sizeof(struct address_range);
6574 - if (use_of_interrupt_tree)
6577 ip = (int *) get_property(np, "AAPL,interrupts", &l);
6579 ip = (int *) get_property(np, "interrupts", &l);
6580 @@ -1711,57 +1225,6 @@
6584 -/* Finds a device node given its PCI bus number, device number
6585 - * and function number
6588 -struct device_node *
6589 -find_pci_device_OFnode(unsigned char bus, unsigned char dev_fn)
6591 - struct device_node* np;
6592 - unsigned int *reg;
6595 - for (np = allnodes; np != 0; np = np->allnext) {
6597 - struct device_node* parent = np->parent;
6599 - char *pname = (char *)get_property(parent, "name", &l);
6600 - if (pname && strcmp(pname, "mac-io") == 0) {
6604 - parent = parent->parent;
6608 - reg = (unsigned int *) get_property(np, "reg", &l);
6609 - if (reg == 0 || l < sizeof(struct reg_property))
6611 - if (((reg[0] >> 8) & 0xff) == dev_fn && ((reg[0] >> 16) & 0xff) == bus)
6618 - * Returns all nodes linked together
6621 -struct device_node *
6622 -find_all_nodes(void)
6624 - struct device_node *head, **prevp, *np;
6627 - for (np = allnodes; np != 0; np = np->allnext) {
6629 - prevp = &np->next;
6635 /* Checks if the given "compat" string matches one of the strings in
6636 * the device's "compatible" property
6638 @@ -1851,7 +1314,7 @@
6639 struct property *pp;
6641 for (pp = np->properties; pp != 0; pp = pp->next)
6642 - if (pp->name && strcmp(pp->name, name) == 0) {
6643 + if (strcmp(pp->name, name) == 0) {
6647 @@ -1963,63 +1426,18 @@
6651 -/* Indicates whether the root node has a given value in its
6652 - * compatible property.
6656 -machine_is_compatible(const char *compat)
6658 - struct device_node *root;
6660 - root = find_path_device("/");
6663 - return device_is_compatible(root, compat);
6667 -#ifdef CONFIG_BOOTX_TEXT
6669 -/* Here's a small text engine to use during early boot or for debugging purposes
6673 - * - build some kind of vgacon with it to enable early printk
6674 - * - move to a separate file
6675 - * - add a few video driver hooks to keep in sync with display
6682 map_bootx_text(void)
6684 - unsigned long base, offset, size;
6686 + if (boot_infos == 0)
6688 - base = ((unsigned long) disp_bi->dispDeviceBase) & 0xFFFFF000UL;
6689 - offset = ((unsigned long) disp_bi->dispDeviceBase) - base;
6690 - size = disp_bi->dispDeviceRowBytes * disp_bi->dispDeviceRect[3] + offset
6691 - + disp_bi->dispDeviceRect[0];
6692 - disp_bi->logicalDisplayBase = ioremap(base, size) + offset;
6697 -install_boot_console(void)
6699 - register_console(&boot_cons);
6700 - boot_cons_registered = 1;
6704 -remove_boot_console(void)
6706 - if (boot_cons_registered)
6707 - unregister_console(&boot_cons);
6708 - boot_cons_registered = 0;
6709 + boot_infos->logicalDisplayBase =
6710 + ioremap((unsigned long) boot_infos->dispDeviceBase,
6711 + boot_infos->dispDeviceRowBytes * boot_infos->dispDeviceRect[3]);
6713 +#endif /* CONFIG_XMON */
6715 /* Calc the base address of a given point (x,y) */
6717 @@ -2041,7 +1459,7 @@
6720 unsigned long offset = reloc_offset();
6721 - boot_infos_t* bi = PTRRELOC(RELOC(disp_bi));
6722 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
6723 unsigned long *base = (unsigned long *)calc_base(bi, 0, 0);
6724 unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
6725 (bi->dispDeviceDepth >> 3)) >> 2;
6726 @@ -2066,7 +1484,7 @@
6729 unsigned long offset = reloc_offset();
6730 - boot_infos_t* bi = PTRRELOC(RELOC(disp_bi));
6731 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
6732 unsigned long *base = (unsigned long *)calc_base(bi, 0, 0);
6733 unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
6734 (bi->dispDeviceDepth >> 3)) >> 2;
6735 @@ -2083,22 +1501,68 @@
6739 +/* Indicates whether the root node has a given value in its
6740 + * compatible property.
6744 +machine_is_compatible(const char *compat)
6746 + struct device_node *root;
6748 + root = find_path_device("/");
6751 + return device_is_compatible(root, compat);
6754 +/* Finds a device node given its PCI bus number, device number
6755 + * and function number
6758 +struct device_node *
6759 +find_pci_device_OFnode(unsigned char bus, unsigned char dev_fn)
6761 + struct device_node* np;
6762 + unsigned int *reg;
6765 + for (np = allnodes; np != 0; np = np->allnext) {
6767 + struct device_node* parent = np->parent;
6769 + char *pname = (char *)get_property(parent, "name", &l);
6770 + if (pname && strcmp(pname, "mac-io") == 0) {
6774 + parent = parent->parent;
6778 + reg = (unsigned int *) get_property(np, "reg", &l);
6779 + if (reg == 0 || l < sizeof(struct reg_property))
6781 + if (((reg[0] >> 8) & 0xff) == dev_fn && ((reg[0] >> 16) & 0xff) == bus)
6787 +#ifdef CONFIG_BOOTX_TEXT
6793 unsigned long offset = reloc_offset();
6794 - boot_infos_t* bi = PTRRELOC(RELOC(disp_bi));
6795 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
6796 unsigned long *src = (unsigned long *)calc_base(bi,0,16);
6797 unsigned long *dst = (unsigned long *)calc_base(bi,0,0);
6798 unsigned long width = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
6799 (bi->dispDeviceDepth >> 3)) >> 2;
6802 -#ifdef CONFIG_POWERMAC
6807 for (i=0; i<(bi->dispDeviceRect[3] - bi->dispDeviceRect[1] - 16); i++)
6809 unsigned long *src_ptr = src;
6810 @@ -2115,10 +1579,6 @@
6812 dst += (bi->dispDeviceRowBytes >> 2);
6815 -#ifdef CONFIG_POWERMAC
6821 @@ -2163,18 +1623,8 @@
6825 -#ifdef CONFIG_BOOTX_TEXT
6827 -static void boot_console_write(struct console *co, const char *s,
6838 drawhex(unsigned long v)
6840 static char hex_table[] = "0123456789abcdef";
6841 @@ -2196,20 +1646,19 @@
6842 draw_byte(unsigned char c, long locX, long locY)
6844 unsigned long offset = reloc_offset();
6845 - boot_infos_t* bi = PTRRELOC(RELOC(disp_bi));
6846 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
6847 unsigned char *base = calc_base(bi, locX << 3, locY << 4);
6848 unsigned char *font = &RELOC(vga_font)[((unsigned long)c) * 16];
6849 - int rb = bi->dispDeviceRowBytes;
6851 switch(bi->dispDeviceDepth) {
6853 - draw_byte_32(font, (unsigned long *)base, rb);
6854 + draw_byte_32(font, (unsigned long *)base);
6857 - draw_byte_16(font, (unsigned long *)base, rb);
6858 + draw_byte_16(font, (unsigned long *)base);
6861 - draw_byte_8(font, (unsigned long *)base, rb);
6862 + draw_byte_8(font, (unsigned long *)base);
6866 @@ -2247,8 +1696,10 @@
6870 -draw_byte_32(unsigned char *font, unsigned long *base, int rb)
6871 +draw_byte_32(unsigned char *font, unsigned long *base)
6873 + unsigned long offset = reloc_offset();
6874 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
6876 int fg = 0xFFFFFFFFUL;
6877 int bg = 0x00000000UL;
6878 @@ -2265,18 +1716,19 @@
6879 base[5] = (-((bits >> 2) & 1) & fg) ^ bg;
6880 base[6] = (-((bits >> 1) & 1) & fg) ^ bg;
6881 base[7] = (-(bits & 1) & fg) ^ bg;
6882 - base = (unsigned long *) ((char *)base + rb);
6883 + base = (unsigned long *) ((char *)base + bi->dispDeviceRowBytes);
6889 -draw_byte_16(unsigned char *font, unsigned long *base, int rb)
6890 +draw_byte_16(unsigned char *font, unsigned long *base)
6892 + unsigned long offset = reloc_offset();
6893 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
6895 int fg = 0xFFFFFFFFUL;
6896 int bg = 0x00000000UL;
6897 - unsigned long offset = reloc_offset();
6898 unsigned long *eb = RELOC(expand_bits_16);
6900 for (l = 0; l < 16; ++l)
6901 @@ -2286,18 +1738,19 @@
6902 base[1] = (eb[(bits >> 4) & 3] & fg) ^ bg;
6903 base[2] = (eb[(bits >> 2) & 3] & fg) ^ bg;
6904 base[3] = (eb[bits & 3] & fg) ^ bg;
6905 - base = (unsigned long *) ((char *)base + rb);
6906 + base = (unsigned long *) ((char *)base + bi->dispDeviceRowBytes);
6912 -draw_byte_8(unsigned char *font, unsigned long *base, int rb)
6913 +draw_byte_8(unsigned char *font, unsigned long *base)
6915 + unsigned long offset = reloc_offset();
6916 + boot_infos_t* bi = PTRRELOC(RELOC(boot_infos));
6918 int fg = 0x0F0F0F0FUL;
6919 int bg = 0x00000000UL;
6920 - unsigned long offset = reloc_offset();
6921 unsigned long *eb = RELOC(expand_bits_8);
6923 for (l = 0; l < 16; ++l)
6924 @@ -2305,7 +1758,7 @@
6926 base[0] = (eb[bits >> 4] & fg) ^ bg;
6927 base[1] = (eb[bits & 0xf] & fg) ^ bg;
6928 - base = (unsigned long *) ((char *)base + rb);
6929 + base = (unsigned long *) ((char *)base + bi->dispDeviceRowBytes);
6933 diff -urN linux.orig/arch/ppc/kernel/ptrace.c linux/arch/ppc/kernel/ptrace.c
6934 --- linux.orig/arch/ppc/kernel/ptrace.c Fri Nov 2 17:39:05 2001
6935 +++ linux/arch/ppc/kernel/ptrace.c Thu Jul 11 15:43:29 2002
6937 #include <asm/uaccess.h>
6938 #include <asm/page.h>
6939 #include <asm/pgtable.h>
6940 +#include <asm/pf-compat.h>
6941 #include <asm/system.h>
6944 @@ -341,10 +342,10 @@
6946 if (request == PTRACE_TRACEME) {
6947 /* are we already being traced? */
6948 - if (current->ptrace & PT_PTRACED)
6949 + if (current->flags & PF_PTRACED)
6951 /* set the ptrace bit in the process flags. */
6952 - current->ptrace |= PT_PTRACED;
6953 + current->flags |= PF_PTRACED;
6958 (current->gid != child->gid)) && !capable(CAP_SYS_PTRACE))
6960 /* the same process cannot be attached many times */
6961 - if (child->ptrace & PT_PTRACED)
6962 + if (child->flags & PF_PTRACED)
6964 - child->ptrace |= PT_PTRACED;
6965 + child->flags |= PF_PTRACED;
6967 write_lock_irqsave(&tasklist_lock, flags);
6968 if (child->p_pptr != current) {
6973 - if (!(child->ptrace & PT_PTRACED))
6974 + if (!(child->flags & PF_PTRACED))
6976 if (child->state != TASK_STOPPED) {
6977 if (request != PTRACE_KILL)
6979 if ((unsigned long) data > _NSIG)
6981 if (request == PTRACE_SYSCALL)
6982 - child->ptrace |= PT_TRACESYS;
6983 + child->flags |= PF_TRACESYS;
6985 - child->ptrace &= ~PT_TRACESYS;
6986 + child->flags &= ~PF_TRACESYS;
6987 child->exit_code = data;
6988 /* make sure the single step bit is not set. */
6989 clear_single_step(child);
6992 if ((unsigned long) data > _NSIG)
6994 - child->ptrace &= ~PT_TRACESYS;
6995 + child->flags &= ~PF_TRACESYS;
6996 set_single_step(child);
6997 child->exit_code = data;
6998 /* give it a chance to run. */
7001 if ((unsigned long) data > _NSIG)
7003 - child->ptrace &= ~(PT_PTRACED|PT_TRACESYS);
7004 + child->flags &= ~(PF_PTRACED|PF_TRACESYS);
7005 child->exit_code = data;
7006 write_lock_irqsave(&tasklist_lock, flags);
7007 REMOVE_LINKS(child);
7010 asmlinkage void syscall_trace(void)
7012 - if ((current->ptrace & (PT_PTRACED|PT_TRACESYS))
7013 - != (PT_PTRACED|PT_TRACESYS))
7014 + if ((current->flags & (PF_PTRACED|PF_TRACESYS))
7015 + != (PF_PTRACED|PF_TRACESYS))
7017 current->exit_code = SIGTRAP;
7018 current->state = TASK_STOPPED;
7019 diff -urN linux.orig/arch/ppc/kernel/setup.c linux/arch/ppc/kernel/setup.c
7020 --- linux.orig/arch/ppc/kernel/setup.c Sun Mar 25 18:31:49 2001
7021 +++ linux/arch/ppc/kernel/setup.c Thu Jul 11 15:47:12 2002
7024 #include <asm/bootx.h>
7025 #include <asm/machdep.h>
7026 -#include <asm/uaccess.h>
7028 extern void pmac_init(unsigned long r3,
7035 -extern void xmon_map_scc(void);
7038 extern boot_infos_t *boot_infos;
7039 extern char cmd_line[512];
7040 char saved_command_line[256];
7043 struct ide_machdep_calls ppc_ide_md;
7045 +#ifdef CONFIG_MAGIC_SYSRQ
7046 +unsigned long SYSRQ_KEY;
7047 +#endif /* CONFIG_MAGIC_SYSRQ */
7049 unsigned long ISA_DMA_THRESHOLD;
7050 unsigned long DMA_MODE_READ, DMA_MODE_WRITE;
7054 struct machdep_calls ppc_md;
7056 -#ifdef CONFIG_MAGIC_SYSRQ
7057 -unsigned long SYSRQ_KEY;
7058 -#endif /* CONFIG_MAGIC_SYSRQ */
7059 -#ifdef CONFIG_VGA_CONSOLE
7060 -unsigned long vgacon_remap_base;
7063 /* copy of the residual data */
7067 len += sprintf(len+buffer, "604ev5 (MachV)\n");
7070 - len += sprintf(len+buffer, "7400 (G4)\n");
7073 len += sprintf(len+buffer, "821\n");
7075 @@ -322,6 +312,14 @@
7076 bogosum += CD(loops_per_jiffy);
7081 + len += sprintf(buffer+len, "\n");
7082 + len += sprintf(buffer+len,"total bogomips\t: %lu.%02lu\n",
7083 + (bogosum+2500)/500000,
7084 + (bogosum+2500)/5000 % 100);
7085 +#endif /* __SMP__ */
7088 * Ooh's and aah's info about zero'd pages in idle task
7090 @@ -486,21 +484,15 @@
7094 -#ifdef CONFIG_POWERMAC
7096 pmac_init(r3, r4, r5, r6, r7);
7099 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_PREP)
7101 prep_init(r3, r4, r5, r6, r7);
7104 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_CHRP)
7106 chrp_init(r3, r4, r5, r6, r7);
7111 apus_init(r3, r4, r5, r6, r7);
7112 @@ -554,13 +546,12 @@
7113 /* Checks "l2cr=xxxx" command-line option */
7114 void ppc_setup_l2cr(char *str, int *ints)
7116 - if ( ((_get_PVR() >> 16) == 8) || ((_get_PVR() >> 16) == 12) )
7117 + if ( (_get_PVR() >> 16) == 8)
7119 unsigned long val = simple_strtoul(str, NULL, 0);
7120 printk(KERN_INFO "l2cr set to %lx\n", val);
7128 @@ -581,16 +572,14 @@
7129 extern unsigned long find_available_memory(void);
7130 extern unsigned long *end_of_DRAM;
7136 + extern void xmon_map_scc(void);
7140 - p = strstr(cmd_line, "xmon");
7141 - if (p != NULL && (p == cmd_line || p[-1] == ' '))
7145 + p = strstr(cmd_line, "xmon");
7146 + if (p != NULL && (p == cmd_line || p[-1] == ' '))
7148 #endif /* CONFIG_XMON */
7150 /* reboot on panic */
7151 @@ -610,15 +599,7 @@
7152 *memory_end_p = (unsigned long) end_of_DRAM;
7154 ppc_md.setup_arch(memory_start_p, memory_end_p);
7156 - sort_exception_table();
7159 -#ifndef CONFIG_POWERMAC
7160 -void note_bootable_part(kdev_t dev, int part, int goodness)
7165 void ppc_generic_ide_fix_driveid(struct hd_driveid *id)
7167 diff -urN linux.orig/arch/ppc/kernel/signal.c linux/arch/ppc/kernel/signal.c
7168 --- linux.orig/arch/ppc/kernel/signal.c Fri Nov 2 17:39:05 2001
7169 +++ linux/arch/ppc/kernel/signal.c Thu Jul 11 15:43:29 2002
7171 * modify it under the terms of the GNU General Public License
7172 * as published by the Free Software Foundation; either version
7173 * 2 of the License, or (at your option) any later version.
7177 - * Define a real-time signal frame with siginfo and ucontext
7178 - * structures (setup_rt_frame()).
7179 - * Stuck up a real-time signal frame when setting the signal
7180 - * frame with SA_SIGINFO flags.
7181 - * Add sys_rt_sigreturn() to undo the signal stack.
7183 - * Giovanna Ambrosini (ambrosini@lightning.ch)
7186 #include <linux/sched.h>
7188 #include <asm/ucontext.h>
7189 #include <asm/uaccess.h>
7190 #include <asm/pgtable.h>
7191 +#include <asm/pf-compat.h>
7195 @@ -131,6 +122,13 @@
7199 +asmlinkage int sys_rt_sigreturn(unsigned long __unused)
7201 + printk("sys_rt_sigreturn(): %s/%d not yet implemented.\n",
7202 + current->comm,current->pid);
7207 sys_sigaltstack(const stack_t *uss, stack_t *uoss)
7209 @@ -174,11 +172,13 @@
7210 * When we have signals to deliver, we set up on the
7211 * user stack, going down from the original stack pointer:
7213 - * one or more sigcontext structs with
7214 + * one or more sigcontext structs
7215 * a gap of __SIGNAL_FRAMESIZE bytes
7217 * Each of these things must be a multiple of 16 bytes in size.
7219 + * XXX ultimately we will have to stack up a siginfo and ucontext
7220 + * for each rt signal.
7223 elf_gregset_t gp_regs;
7224 @@ -189,15 +189,6 @@
7230 - unsigned long _unused[2];
7231 - struct siginfo *pinfo;
7233 - struct siginfo info;
7234 - struct ucontext uc;
7238 * Do a signal return; undo the signal stack.
7240 @@ -230,10 +221,6 @@
7241 sr = (struct sigregs *) sigctx.regs;
7242 if (regs->msr & MSR_FP )
7243 giveup_fpu(current);
7244 -#ifdef CONFIG_ALTIVEC
7245 - if (regs->msr & MSR_VEC)
7246 - giveup_altivec(current);
7247 -#endif /* CONFIG_ALTIVEC */
7248 if (copy_from_user(saved_regs, &sr->gp_regs,
7249 sizeof(sr->gp_regs)))
7251 @@ -269,91 +256,6 @@
7257 - * When we have rt signals to deliver, we set up on the
7258 - * user stack, going down from the original stack pointer:
7259 - * a sigregs struct
7260 - * one rt_sigframe struct (siginfo + ucontext)
7261 - * a gap of __SIGNAL_FRAMESIZE bytes
7263 - * Each of these things must be a multiple of 16 bytes in size.
7266 -asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
7268 - struct rt_sigframe *rt_sf;
7269 - struct sigcontext_struct sigctx;
7270 - struct sigregs *sr;
7272 - elf_gregset_t saved_regs; /* an array of ELF_NGREG unsigned longs */
7275 - unsigned long prevsp;
7277 - rt_sf = (struct rt_sigframe *)(regs->gpr[1] + __SIGNAL_FRAMESIZE);
7278 - if (copy_from_user(&sigctx, &rt_sf->uc.uc_mcontext, sizeof(sigctx))
7279 - || copy_from_user(&set, &rt_sf->uc.uc_sigmask, sizeof(set))
7280 - || copy_from_user(&st, &rt_sf->uc.uc_stack, sizeof(st)))
7282 - sigdelsetmask(&set, ~_BLOCKABLE);
7283 - spin_lock_irq(¤t->sigmask_lock);
7284 - current->blocked = set;
7285 - recalc_sigpending(current);
7286 - spin_unlock_irq(¤t->sigmask_lock);
7288 - rt_sf++; /* Look at next rt_sigframe */
7289 - if (rt_sf == (struct rt_sigframe *)(sigctx.regs)) {
7290 - /* Last stacked signal - restore registers -
7291 - * sigctx is initialized to point to the
7292 - * preamble frame (where registers are stored)
7293 - * see handle_signal()
7295 - sr = (struct sigregs *) sigctx.regs;
7296 - if (regs->msr & MSR_FP )
7297 - giveup_fpu(current);
7298 - if (copy_from_user(saved_regs, &sr->gp_regs,
7299 - sizeof(sr->gp_regs)))
7301 - saved_regs[PT_MSR] = (regs->msr & ~MSR_USERCHANGE)
7302 - | (saved_regs[PT_MSR] & MSR_USERCHANGE);
7303 - memcpy(regs, saved_regs, GP_REGS_SIZE);
7304 - if (copy_from_user(current->tss.fpr, &sr->fp_regs,
7305 - sizeof(sr->fp_regs)))
7307 - /* This function sets back the stack flags into
7308 - the current task structure. */
7309 - sys_sigaltstack(&st, NULL);
7311 - ret = regs->result;
7313 - /* More signals to go */
7314 - /* Set up registers for next signal handler */
7315 - regs->gpr[1] = (unsigned long)rt_sf - __SIGNAL_FRAMESIZE;
7316 - if (copy_from_user(&sigctx, &rt_sf->uc.uc_mcontext, sizeof(sigctx)))
7318 - sr = (struct sigregs *) sigctx.regs;
7319 - regs->gpr[3] = ret = sigctx.signal;
7320 - /* Get the siginfo */
7321 - get_user(regs->gpr[4], (unsigned long *)&rt_sf->pinfo);
7322 - /* Get the ucontext */
7323 - get_user(regs->gpr[5], (unsigned long *)&rt_sf->puc);
7324 - regs->gpr[6] = (unsigned long) rt_sf;
7326 - regs->link = (unsigned long) &sr->tramp;
7327 - regs->nip = sigctx.handler;
7328 - if (get_user(prevsp, &sr->gp_regs[PT_R1])
7329 - || put_user(prevsp, (unsigned long *) regs->gpr[1]))
7341 * Set up a signal frame.
7343 @@ -367,10 +269,6 @@
7345 if (regs->msr & MSR_FP)
7346 giveup_fpu(current);
7347 -#ifdef CONFIG_ALTIVEC
7348 - if (regs->msr & MSR_VEC)
7349 - giveup_altivec(current);
7350 -#endif /* CONFIG_ALTIVEC */
7351 if (__copy_to_user(&frame->gp_regs, regs, GP_REGS_SIZE)
7352 || __copy_to_user(&frame->fp_regs, current->tss.fpr,
7353 ELF_NFPREG * sizeof(double))
7354 @@ -400,57 +298,6 @@
7360 -setup_rt_frame(struct pt_regs *regs, struct sigregs *frame,
7361 - signed long newsp)
7363 - struct rt_sigframe *rt_sf = (struct rt_sigframe *) newsp;
7365 - /* Set up preamble frame */
7366 - if (verify_area(VERIFY_WRITE, frame, sizeof(*frame)))
7368 - if (regs->msr & MSR_FP)
7369 - giveup_fpu(current);
7370 - if (__copy_to_user(&frame->gp_regs, regs, GP_REGS_SIZE)
7371 - || __copy_to_user(&frame->fp_regs, current->tss.fpr,
7372 - ELF_NFPREG * sizeof(double))
7373 - /* Set up to return from user space.
7374 - It calls the sc exception at offset 0x9999
7375 - for sys_rt_sigreturn().
7377 - || __put_user(0x38006666UL, &frame->tramp[0]) /* li r0,0x6666 */
7378 - || __put_user(0x44000002UL, &frame->tramp[1])) /* sc */
7380 - flush_icache_range((unsigned long) &frame->tramp[0],
7381 - (unsigned long) &frame->tramp[2]);
7383 - /* Retrieve rt_sigframe from stack and
7384 - set up registers for signal handler
7386 - newsp -= __SIGNAL_FRAMESIZE;
7387 - if (put_user(regs->gpr[1], (unsigned long *)newsp)
7388 - || get_user(regs->nip, &rt_sf->uc.uc_mcontext.handler)
7389 - || get_user(regs->gpr[3], &rt_sf->uc.uc_mcontext.signal)
7390 - || get_user(regs->gpr[4], (unsigned long *)&rt_sf->pinfo)
7391 - || get_user(regs->gpr[5], (unsigned long *)&rt_sf->puc))
7394 - regs->gpr[1] = newsp;
7395 - regs->gpr[6] = (unsigned long) rt_sf;
7396 - regs->link = (unsigned long) frame->tramp;
7402 - printk("badframe in setup_rt_frame, regs=%p frame=%p newsp=%lx\n",
7403 - regs, frame, newsp);
7410 * OK, we're invoking a handler
7413 unsigned long *newspp, unsigned long frame)
7415 struct sigcontext_struct *sc;
7416 - struct rt_sigframe *rt_sf;
7418 if (regs->trap == 0x0C00 /* System Call! */
7419 && ((int)regs->result == -ERESTARTNOHAND ||
7420 @@ -468,47 +314,20 @@
7421 !(ka->sa.sa_flags & SA_RESTART))))
7422 regs->result = -EINTR;
7424 - /* Set up Signal Frame */
7425 - if (ka->sa.sa_flags & SA_SIGINFO) {
7426 - /* Put a Real Time Context onto stack */
7427 - *newspp -= sizeof(*rt_sf);
7428 - rt_sf = (struct rt_sigframe *) *newspp;
7429 - if (verify_area(VERIFY_WRITE, rt_sf, sizeof(*rt_sf)))
7432 - if (__put_user((unsigned long) ka->sa.sa_handler, &rt_sf->uc.uc_mcontext.handler)
7433 - || __put_user(&rt_sf->info, &rt_sf->pinfo)
7434 - || __put_user(&rt_sf->uc, &rt_sf->puc)
7435 - /* Put the siginfo */
7436 - || __copy_to_user(&rt_sf->info, info, sizeof(*info))
7437 - /* Create the ucontext */
7438 - || __put_user(0, &rt_sf->uc.uc_flags)
7439 - || __put_user(0, &rt_sf->uc.uc_link)
7440 - || __put_user(current->sas_ss_sp, &rt_sf->uc.uc_stack.ss_sp)
7441 - || __put_user(sas_ss_flags(regs->gpr[1]),
7442 - &rt_sf->uc.uc_stack.ss_flags)
7443 - || __put_user(current->sas_ss_size, &rt_sf->uc.uc_stack.ss_size)
7444 - || __copy_to_user(&rt_sf->uc.uc_sigmask, oldset, sizeof(*oldset))
7445 - /* mcontext.regs points to preamble register frame */
7446 - || __put_user((struct pt_regs *)frame, &rt_sf->uc.uc_mcontext.regs)
7447 - || __put_user(sig, &rt_sf->uc.uc_mcontext.signal))
7450 - /* Put another sigcontext on the stack */
7451 - *newspp -= sizeof(*sc);
7452 - sc = (struct sigcontext_struct *) *newspp;
7453 - if (verify_area(VERIFY_WRITE, sc, sizeof(*sc)))
7455 + /* Put another sigcontext on the stack */
7456 + *newspp -= sizeof(*sc);
7457 + sc = (struct sigcontext_struct *) *newspp;
7458 + if (verify_area(VERIFY_WRITE, sc, sizeof(*sc)))
7461 - if (__put_user((unsigned long) ka->sa.sa_handler, &sc->handler)
7462 - || __put_user(oldset->sig[0], &sc->oldmask)
7463 + if (__put_user((unsigned long) ka->sa.sa_handler, &sc->handler)
7464 + || __put_user(oldset->sig[0], &sc->oldmask)
7466 - || __put_user(oldset->sig[1], &sc->_unused[3])
7467 + || __put_user(oldset->sig[1], &sc->_unused[3])
7469 - || __put_user((struct pt_regs *)frame, &sc->regs)
7470 - || __put_user(sig, &sc->signal))
7473 + || __put_user((struct pt_regs *)frame, &sc->regs)
7474 + || __put_user(sig, &sc->signal))
7477 if (ka->sa.sa_flags & SA_ONESHOT)
7478 ka->sa.sa_handler = SIG_DFL;
7483 - if ((current->ptrace & PT_PTRACED) && signr != SIGKILL) {
7484 + if ((current->flags & PF_PTRACED) && signr != SIGKILL) {
7485 /* Let the debugger run. */
7486 current->exit_code = signr;
7487 current->state = TASK_STOPPED;
7488 @@ -664,10 +483,7 @@
7490 return 0; /* no signals delivered */
7492 - if (ka->sa.sa_flags & SA_SIGINFO)
7493 - setup_rt_frame(regs, (struct sigregs *) frame, newsp);
7495 - setup_frame(regs, (struct sigregs *) frame, newsp);
7496 + setup_frame(regs, (struct sigregs *) frame, newsp);
7500 diff -urN linux.orig/arch/ppc/kernel/sleep.S linux/arch/ppc/kernel/sleep.S
7501 --- linux.orig/arch/ppc/kernel/sleep.S Sun Mar 25 18:37:30 2001
7502 +++ linux/arch/ppc/kernel/sleep.S Thu Jul 11 15:43:29 2002
7505 * This file contains sleep low-level functions for PowerBook G3.
7506 - * Copyright (C) 1999 Benjamin Herrenschmidt (benh@kernel.crashing.org)
7507 + * Copyright (C) 1999 Benjamin Herrenschmidt (bh40@calva.net)
7508 * and Paul Mackerras (paulus@cs.anu.edu.au).
7510 * This program is free software; you can redistribute it and/or
7514 /* Set up stuff at address 0 */
7515 - lis r5,grackle_wake_up@ha
7516 - addi r5,r5,grackle_wake_up@l
7518 + addi r5,r5,wake_up@l
7522 @@ -124,28 +124,22 @@
7526 - /* Setup stuffs at 0x80-0x84 for Core99 */
7527 - lis r3,core99_wake_up@ha
7528 - addi r3,r3,core99_wake_up@l
7534 - * Flush the L1 data cache by reading the first 128kB of RAM
7535 + * Flush the L1 data cache by reading the first 64kB of RAM
7536 * and then flushing the same area with the dcbf instruction.
7537 * The L2 cache has already been disabled.
7539 - li r4,0x1000 /* 128kB / 32B */
7540 + li r4,0x0800 /* 64kB / 32B */
7545 - addi r4,r4,0x0020 /* Go to start of next cache line */
7546 + addi r4,r4,0x0020 /* Go to start of next cache line */
7550 - li r4,0x1000 /* 128kB / 32B */
7551 + li r4,0x0800 /* 64k */
7555 @@ -154,14 +148,6 @@
7559 -/* Turn off L1 (necessary ?) */
7561 - ori r3,r3, HID0_ICE|HID0_DCE
7562 - xori r3,r3, HID0_ICE|HID0_DCE
7568 * Set the HID0 and MSR for sleep.
7570 @@ -177,50 +163,20 @@
7579 * Here is the resume code.
7580 - * Core99 machines resume here
7581 - * r4 has the physical address of SL_PC(sp).
7587 - /* use rlwinm ... */
7588 - oris r3,r3,HID0_SLEEP@h
7589 - xoris r3,r3,HID0_SLEEP@h
7594 - /* sanitize MSR */
7596 - ori r3,r3,MSR_EE|MSR_IP
7597 - xori r3,r3,MSR_EE|MSR_IP
7603 - * Here is the resume code for older machines.
7604 * r1 has the physical address of SL_PC(sp).
7608 - /* Enable and then Flash inval the instruction cache */
7610 + /* Flash inval the instruction cache */
7612 - ori r3,r3, HID0_ICE|HID0_ICFI|HID0_DCE|HID0_DCI
7616 - xori r3,r3, HID0_ICFI|HID0_DCI
7617 + ori r3,r3, HID0_ICFI
7621 - /* Restore the remaining bits of the HID0 register. */
7623 + /* Restore the HID0 register. This turns on the L1 caches. */
7627 @@ -283,13 +239,6 @@
7628 lwz r4,SL_IBAT3+4(r1)
7631 - /* Flush all TLBs */
7633 -1: addic. r4, r4, -0x1000
7638 /* restore the MSR and turn on the MMU */
7655 diff -urN linux.orig/arch/ppc/kernel/smp.c linux/arch/ppc/kernel/smp.c
7656 --- linux.orig/arch/ppc/kernel/smp.c Sun Mar 25 18:31:49 2001
7657 +++ linux/arch/ppc/kernel/smp.c Thu Jul 11 16:28:25 2002
7659 * deal of code from the sparc and intel versions.
7661 * Support for PReP (Motorola MTX/MVME) SMP by Troy Benjegerdes
7662 - * (troy@blacklablinux.com, hozer@drgw.net)
7663 - * Support for PReP (Motorola MTX/MVME) and Macintosh G4 SMP
7664 - * by Troy Benjegerdes (hozer@drgw.net)
7665 + * (troy@microux.com, hozer@drgw.net)
7668 #include <linux/kernel.h>
7670 #include <asm/prom.h>
7671 #include <asm/gemini.h>
7672 #include <asm/residual.h>
7673 -#include <asm/time.h>
7674 -#include <asm/feature.h>
7677 #include "open_pic.h"
7679 int first_cpu_booted = 0;
7681 struct cpuinfo_PPC cpu_data[NR_CPUS];
7682 struct klock_info_struct klock_info = { KLOCK_CLEAR, 0 };
7683 volatile unsigned char active_kernel_processor = NO_PROC_ID; /* Processor holding kernel spinlock */
7686 +volatile unsigned long ipi_count;
7687 spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED;
7688 unsigned int prof_multiplier[NR_CPUS];
7689 unsigned int prof_counter[NR_CPUS];
7691 extern unsigned long *MotSave_SmpIar;
7692 extern unsigned char *MotSave_CpusState[2];
7694 -/* l2 cache stuff for dual G4 macs */
7695 -extern void core99_init_l2(void);
7697 /* register for interrupting the secondary processor on the powersurge */
7698 #define PSURGE_INTR ((volatile unsigned *)0xf80000c0)
7702 void smp_message_recv(int msg)
7704 - atomic_inc(&ipi_recv);
7713 -#ifdef CONFIG_POWERMAC
7715 * As it is now, if we're sending two message at the same time
7716 * we have race conditions on Pmac. The PowerSurge doesn't easily
7717 @@ -155,10 +148,10 @@
7721 -int psurge_smp_message[NR_CPUS];
7722 -void psurge_smp_message_recv(void)
7723 +int pmac_smp_message[NR_CPUS];
7724 +void pmac_smp_message_recv(void)
7726 - int msg = psurge_smp_message[smp_processor_id()];
7727 + int msg = pmac_smp_message[smp_processor_id()];
7729 /* clear interrupt */
7730 out_be32(PSURGE_INTR, ~0);
7732 smp_message_recv(msg);
7735 - psurge_smp_message[smp_processor_id()] = -1;
7736 + pmac_smp_message[smp_processor_id()] = -1;
7738 -#endif /* powermac */
7742 * 750's don't broadcast tlb invalidates so
7743 @@ -203,65 +196,49 @@
7744 smp_message_pass(MSG_ALL_BUT_SELF, MSG_STOP_CPU, 0, 0);
7747 -#ifdef CONFIG_POWERMAC
7748 -static void psurge_message_pass(int target, int msg, unsigned long data, int wait)
7749 +void smp_message_pass(int target, int msg, unsigned long data, int wait)
7754 - * IPI's on the Pmac are a hack but without reasonable
7755 - * IPI hardware SMP on Pmac is a hack.
7757 - * We assume here that the msg is not -1. If it is,
7758 - * the recipient won't know the message was destined
7761 - for ( i = 0; i <= smp_num_cpus ; i++ )
7762 - psurge_smp_message[i] = -1;
7766 - psurge_smp_message[smp_processor_id()] = msg;
7767 - /* fall through */
7768 - case MSG_ALL_BUT_SELF:
7769 - for ( i = 0 ; i < smp_num_cpus ; i++ )
7770 - if ( i != smp_processor_id () )
7771 - psurge_smp_message[i] = msg;
7774 - psurge_smp_message[target] = msg;
7777 - /* interrupt secondary processor */
7778 - out_be32(PSURGE_INTR, ~0);
7779 - out_be32(PSURGE_INTR, 0);
7781 - * Assume for now that the secondary doesn't send
7783 - * Could be fixed with 2.4 code from Paulus -- BenH
7785 - /* interrupt primary */
7786 - /**(volatile unsigned long *)(0xf3019000);*/
7788 -#endif /* powermac */
7790 -void smp_message_pass(int target, int msg, unsigned long data, int wait)
7792 - atomic_inc(&ipi_sent);
7794 if ( !(_machine & (_MACH_Pmac|_MACH_chrp|_MACH_prep|_MACH_gemini)) )
7798 -#ifdef CONFIG_POWERMAC
7800 - /* Hack, 2.4 does it cleanly */
7801 - if (OpenPIC == NULL) {
7802 - psurge_message_pass(target, msg, data, wait);
7804 + * IPI's on the Pmac are a hack but without reasonable
7805 + * IPI hardware SMP on Pmac is a hack.
7807 + * We assume here that the msg is not -1. If it is,
7808 + * the recipient won't know the message was destined
7811 + for ( i = 0; i <= smp_num_cpus ; i++ )
7812 + pmac_smp_message[i] = -1;
7816 + pmac_smp_message[smp_processor_id()] = msg;
7817 + /* fall through */
7818 + case MSG_ALL_BUT_SELF:
7819 + for ( i = 0 ; i < smp_num_cpus ; i++ )
7820 + if ( i != smp_processor_id () )
7821 + pmac_smp_message[i] = msg;
7824 - /* else fall through and do something sane --Troy */
7827 + pmac_smp_message[target] = msg;
7830 + /* interrupt secondary processor */
7831 + out_be32(PSURGE_INTR, ~0);
7832 + out_be32(PSURGE_INTR, 0);
7834 + * Assume for now that the secondary doesn't send
7837 + /* interrupt primary */
7838 + /**(volatile unsigned long *)(0xf3019000);*/
7843 @@ -285,52 +262,6 @@
7847 -#ifdef CONFIG_POWERMAC
7848 -static void pmac_core99_kick_cpu(int nr)
7850 - extern void __secondary_start_psurge(void);
7852 - unsigned long save_int;
7853 - unsigned long flags;
7854 - volatile unsigned long *vector
7855 - = ((volatile unsigned long *)(KERNELBASE+0x500));
7860 - __save_flags(flags);
7863 - /* Save EE vector */
7864 - save_int = *vector;
7866 - /* Setup fake EE vector that does
7867 - * b __secondary_start_psurge - KERNELBASE
7869 - *vector = 0x48000002 +
7870 - ((unsigned long)__secondary_start_psurge - KERNELBASE);
7872 - /* flush data cache and inval instruction cache */
7873 - flush_icache_range((unsigned long) vector, (unsigned long) vector + 4);
7875 - /* Put some life in our friend */
7876 - feature_core99_kick_cpu1();
7878 - /* FIXME: We wait a bit for the CPU to take the exception, I should
7879 - * instead wait for the entry code to set something for me. Well,
7880 - * ideally, all that crap will be done in prom.c and the CPU left
7881 - * in a RAM-based wait loop like CHRP.
7885 - /* Restore our exception vector */
7886 - *vector = save_int;
7887 - flush_icache_range((unsigned long) vector, (unsigned long) vector + 4);
7889 - __restore_flags(flags);
7891 -#endif /* powermac */
7893 void __init smp_boot_cpus(void)
7895 extern struct task_struct *current_set[NR_CPUS];
7896 @@ -367,21 +298,15 @@
7900 -#ifdef CONFIG_POWERMAC
7902 - /* assum e powersurge board - 2 processors -- Cort */
7903 - /* or a dual G4 -- Troy */
7904 + /* assume powersurge board - 2 processors -- Cort */
7908 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_CHRP)
7910 cpu_nr = ((openpic_read(&OpenPIC->Global.Feature_Reporting0)
7911 & OPENPIC_FEATURE_LAST_PROCESSOR_MASK) >>
7912 OPENPIC_FEATURE_LAST_PROCESSOR_SHIFT)+1;
7915 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_PREP)
7917 /* assume 2 for now == fix later -- Johnnie */
7919 @@ -389,13 +314,10 @@
7924 -#ifdef CONFIG_GEMINI
7926 cpu_nr = (readb(GEMINI_CPUSTAT) & GEMINI_CPU_COUNT_MASK)>>2;
7927 cpu_nr = (cpu_nr == 0) ? 4 : cpu_nr;
7931 printk("SMP not supported on this machine.\n");
7933 @@ -426,41 +348,30 @@
7937 -#ifdef CONFIG_POWERMAC
7939 - if (OpenPIC == NULL) {
7940 - /* setup entry point of secondary processor */
7941 - *(volatile unsigned long *)(0xf2800000) =
7942 - (unsigned long)__secondary_start_psurge-KERNELBASE;
7944 - /* interrupt secondary to begin executing code */
7945 - out_be32(PSURGE_INTR, ~0);
7946 - out_be32(PSURGE_INTR, 0);
7948 - pmac_core99_kick_cpu(i);
7949 + /* setup entry point of secondary processor */
7950 + *(volatile unsigned long *)(0xf2800000) =
7951 + (unsigned long)__secondary_start_psurge-KERNELBASE;
7953 + /* interrupt secondary to begin executing code */
7954 + out_be32(PSURGE_INTR, ~0);
7955 + out_be32(PSURGE_INTR, 0);
7958 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_CHRP)
7960 *(unsigned long *)KERNELBASE = i;
7961 asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory");
7964 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_PREP)
7966 *MotSave_SmpIar = (unsigned long)__secondary_start_psurge - KERNELBASE;
7967 *MotSave_CpusState[1] = CPU_GOOD;
7968 printk("CPU1 reset, waiting\n");
7971 -#ifdef CONFIG_GEMINI
7973 openpic_init_processor( 1<<i );
7974 openpic_init_processor( 0 );
7981 * wait to see if the cpu made a callin (is actually up).
7982 * use this value that I found through experimentation.
7988 + if ( _machine & (_MACH_gemini|_MACH_chrp|_MACH_prep) )
7989 do_openpic_setup_cpu();
7990 - else if ( _machine == _MACH_Pmac )
7991 + if ( _machine == _MACH_Pmac )
7993 /* reset the entry point so if we get another intr we won't
7994 * try to startup again */
7995 @@ -529,17 +440,10 @@
7996 * place to stick it for now.
8000 + if ( _machine & (_MACH_gemini|_MACH_chrp|_MACH_prep) )
8001 do_openpic_setup_cpu();
8002 -#ifdef CONFIG_POWERMAC
8003 - if ( _machine == _MACH_Pmac )
8007 -#ifdef CONFIG_GEMINI
8008 if ( _machine == _MACH_gemini )
8011 while(!smp_commenced)
8014 diff -urN linux.orig/arch/ppc/kernel/syscalls.c linux/arch/ppc/kernel/syscalls.c
8015 --- linux.orig/arch/ppc/kernel/syscalls.c Sun Mar 25 18:31:49 2001
8016 +++ linux/arch/ppc/kernel/syscalls.c Thu Jul 11 15:43:29 2002
8018 struct file * file = NULL;
8021 - down(¤t->mm->mmap_sem);
8023 if (!(flags & MAP_ANONYMOUS)) {
8024 if (fd >= NR_OPEN || !(file = current->files->fd[fd]))
8026 ret = do_mmap(file, addr, len, prot, flags, offset);
8029 - up(¤t->mm->mmap_sem);
8033 @@ -248,14 +246,9 @@
8035 asmlinkage int sys_uname(struct old_utsname * name)
8042 - err = copy_to_user(name, &system_utsname, sizeof (*name));
8044 - return err ? -EFAULT : 0;
8045 + if (name && !copy_to_user(name, &system_utsname, sizeof (*name)))
8050 asmlinkage int sys_olduname(struct oldold_utsname * name)
8052 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname)))
8056 error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN);
8057 error -= __put_user(0,name->sysname+__OLD_UTS_LEN);
8058 error -= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN);
8059 @@ -279,18 +271,6 @@
8060 error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
8061 error = __put_user(0,name->machine+__OLD_UTS_LEN);
8062 error = error ? -EFAULT : 0;
8070 - * Those are normally defined in arch/ppc/kernel/pci.c. But when CONFIG_PCI is
8071 - * not defined, this file is not linked at all, so here are the "empty" versions
8073 -asmlinkage int sys_pciconfig_read() { return -ENOSYS; }
8074 -asmlinkage int sys_pciconfig_write() { return -ENOSYS; }
8075 -asmlinkage long sys_pciconfig_iobase() { return -ENOSYS; }
8078 diff -urN linux.orig/arch/ppc/kernel/time.c linux/arch/ppc/kernel/time.c
8079 --- linux.orig/arch/ppc/kernel/time.c Sun Mar 25 18:31:49 2001
8080 +++ linux/arch/ppc/kernel/time.c Thu Jul 11 15:43:29 2002
8083 #include <asm/machdep.h>
8085 -#include <asm/time.h>
8088 void smp_local_timer_interrupt(struct pt_regs *);
8093 unsigned long cpu = smp_processor_id();
8099 @@ -106,13 +106,6 @@
8100 if ( !smp_processor_id() )
8104 - /* -- BenH -- I'm removing this for now since it can cause various
8105 - * troubles with local-time RTCs. Now that we have a
8106 - * /dev/rtc that uses ppc_md.set_rtc_time() on mac, it
8107 - * should be possible to program the RTC from userland
8111 * update the rtc when needed
8114 /* do it again in 60 s */
8115 last_rtc_update = xtime.tv_sec;
8121 @@ -192,10 +184,10 @@
8123 __initfunc(void time_init(void))
8125 - long time_offset = 0;
8127 if (ppc_md.time_init != NULL)
8128 - time_offset = ppc_md.time_init();
8130 + ppc_md.time_init();
8133 if ((_get_PVR() >> 16) == 1) {
8134 /* 601 processor: dec counts down by 128 every 128ns */
8135 @@ -208,12 +200,6 @@
8137 xtime.tv_sec = ppc_md.get_rtc_time();
8139 - if (time_offset) {
8140 - struct timezone tz;
8141 - tz.tz_minuteswest = time_offset/60;
8142 - tz.tz_dsttime = 0; /* Not handled correctly by the kernel anyway */
8143 - do_sys_settimeofday(NULL, &tz);
8146 set_dec(decrementer_count);
8147 /* allow updates right away */
8148 diff -urN linux.orig/arch/ppc/kernel/time.h linux/arch/ppc/kernel/time.h
8149 --- linux.orig/arch/ppc/kernel/time.h Thu Jan 1 01:00:00 1970
8150 +++ linux/arch/ppc/kernel/time.h Thu Jul 11 15:43:29 2002
8154 + * Common time prototypes and such for all ppc machines.
8156 + * Written by Cort Dougan (cort@cs.nmt.edu) to merge
8157 + * Paul Mackerras' version and mine for PReP and Pmac.
8160 +#include <linux/mc146818rtc.h>
8163 +extern unsigned decrementer_count;
8164 +extern unsigned count_period_num;
8165 +extern unsigned count_period_den;
8166 +extern unsigned long mktime(unsigned int, unsigned int, unsigned int,
8167 + unsigned int, unsigned int, unsigned int);
8168 +extern void to_tm(int tim, struct rtc_time * tm);
8169 +extern time_t last_rtc_update;
8171 +int via_calibrate_decr(void);
8173 +/* Accessor functions for the decrementer register. */
8174 +static __inline__ unsigned int get_dec(void)
8178 + asm volatile("mfspr %0,22" : "=r" (ret) :);
8182 +static __inline__ void set_dec(unsigned int val)
8184 + asm volatile("mtspr 22,%0" : : "r" (val));
8186 diff -urN linux.orig/arch/ppc/kernel/traps.c linux/arch/ppc/kernel/traps.c
8187 --- linux.orig/arch/ppc/kernel/traps.c Sun Mar 25 18:31:48 2001
8188 +++ linux/arch/ppc/kernel/traps.c Thu Jul 11 15:43:29 2002
8189 @@ -100,27 +100,26 @@
8193 - printk("Machine check in kernel mode. (regs at %p)\n", regs);
8194 - printk("Caused by (from srr1): ");
8195 - switch( regs->msr & 0x001F0000) {
8197 - printk("L2 data cache parity error\n");
8198 + printk("Machine check in kernel mode.\n");
8199 + printk("Caused by (from msr): ");
8200 + printk("regs %p ",regs);
8201 + switch( regs->msr & 0x0000F000)
8204 + printk("Machine check signal - probably due to mm fault\n"
8205 + "with mmu off\n");
8208 - printk("Machine check signal\n");
8209 - printk("(probably due to access of bad physical address\n");
8213 printk("Transfer error ack signal\n");
8217 printk("Data parity signal\n");
8221 printk("Address parity signal\n");
8224 - printk("Unknown values in srr1\n");
8225 + printk("Unknown values in msr\n");
8228 #if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
8229 @@ -156,52 +155,9 @@
8230 _exception(SIGTRAP, regs);
8233 -/* Illegal instruction emulation support. Originally written to
8234 - * provide the PVR to user applications using the mfspr rd, PVR.
8235 - * Return non-zero if we can't emulate, or EFAULT if the associated
8236 - * memory access caused an access fault. Return zero on success.
8238 - * There are a couple of ways to do this, either "decode" the instruction
8239 - * or directly match lots of bits. In this case, matching lots of
8240 - * bits is faster and easier.
8243 -#define INST_MFSPR_PVR 0x7c1f42a6
8244 -#define INST_MFSPR_PVR_MASK 0xfc1fffff
8247 -emulate_instruction(struct pt_regs *regs)
8254 - if (!user_mode(regs))
8258 - if (get_user(instword, (uint *)(regs->nip)))
8261 - /* Emulate the mfspr rD, PVR.
8264 - if ((instword & INST_MFSPR_PVR_MASK) == INST_MFSPR_PVR) {
8265 - rd = (instword >> 21) & 0x1f;
8266 - regs->gpr[rd] = _get_PVR();
8275 ProgramCheckException(struct pt_regs *regs)
8279 if (regs->msr & 0x100000) {
8280 /* IEEE FP exception */
8281 _exception(SIGFPE, regs);
8282 @@ -213,13 +169,7 @@
8284 _exception(SIGTRAP, regs);
8286 - /* Try to emulate it if we should. */
8287 - if ((errcode = emulate_instruction(regs))) {
8288 - if (errcode == EFAULT)
8289 - _exception(SIGBUS, regs);
8291 - _exception(SIGILL, regs);
8293 + _exception(SIGILL, regs);
8297 diff -urN linux.orig/arch/ppc/lib/string.S linux/arch/ppc/lib/string.S
8298 --- linux.orig/arch/ppc/lib/string.S Sun Mar 25 18:31:49 2001
8299 +++ linux/arch/ppc/lib/string.S Thu Jul 11 15:43:29 2002
8301 #include <asm/processor.h>
8302 #include <asm/errno.h>
8304 -CACHELINE_BYTES = 32
8305 -LG_CACHELINE_BYTES = 5
8306 -CACHELINE_MASK = 0x1f
8307 -CACHELINE_WORDS = 8
8316 -#if 0 /* Clever, but breaks fb stuff -- paulus */
8318 - * Use dcbz on the complete cache lines in the destination if
8319 - * we are setting to zero. This requires that the destination
8320 - * area is cacheable. -- paulus
8324 - clrlwi r7,r6,32-LG_CACHELINE_BYTES
8326 - srwi r9,r8,LG_CACHELINE_BYTES
8327 - addic. r9,r9,-1 /* total number of complete cachelines */
8329 - xori r0,r7,CACHELINE_MASK & ~3
8338 - addi r6,r6,CACHELINE_BYTES
8340 - clrlwi r5,r8,32-LG_CACHELINE_BYTES
8345 + rlwinm r0,r5,32-2,2,31
8349 @@ -140,94 +107,11 @@
8352 bgt backwards_memcpy
8354 + /* fall through */
8358 -#if 0 /* Clever, but will probably break fb stuff -- paulus */
8360 - * This version uses dcbz on the complete cache lines in the
8361 - * destination area to reduce memory traffic. This requires that
8362 - * the destination area is cacheable.
8363 - * We only use this version if the source and dest don't overlap.
8366 - add r7,r3,r5 /* test if the src & dst overlap */
8370 - crand 0,0,4 /* cr0.lt &= cr1.lt */
8371 - blt forwards_memcpy /* if regions overlap */
8376 - andi. r0,r0,CACHELINE_MASK /* # bytes to start of cache line */
8379 - cmplw 0,r5,r0 /* is this more than total to do? */
8380 - blt 63f /* if not much to do */
8381 - andi. r8,r0,3 /* get it word-aligned first */
8385 -70: lbz r9,4(r4) /* do some bytes */
8393 -72: lwzu r9,4(r4) /* do some words */
8397 -58: srwi. r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */
8398 - clrlwi r5,r5,32-LG_CACHELINE_BYTES
8439 - .global forwards_memcpy
8442 + rlwinm. r7,r5,32-3,3,31 /* r0 = r5 >> 3 */
8445 beq 2f /* if less than 8 bytes to do */
8446 @@ -334,167 +218,106 @@
8448 .globl __copy_tofrom_user
8454 - andi. r0,r0,CACHELINE_MASK /* # bytes to start of cache line */
8457 - cmplw 0,r5,r0 /* is this more than total to do? */
8458 - blt 63f /* if not much to do */
8459 - andi. r8,r0,3 /* get it word-aligned first */
8462 -70: lbz r9,4(r4) /* do some bytes */
8471 -72: lwzu r9,4(r4) /* do some words */
8475 -58: srwi. r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */
8476 - clrlwi r5,r5,32-LG_CACHELINE_BYTES
8484 -13: lwzu r10,16(r4)
8488 -17: stwu r10,16(r6)
8492 -23: lwzu r10,16(r4)
8496 -27: stwu r10,16(r6)
8512 + li r3,0 /* success return value */
8513 + beq 2f /* if less than 8 bytes to do */
8514 + andi. r0,r6,3 /* get dest word aligned */
8528 +3: cmpwi 0,r5,0 /* do 1 byte at a time for the remainder */
8537 +5: subfic r0,r0,4 /* copy bytes until we have the */
8538 + mtctr r0 /* destination 4-byte aligned */
8548 -/* read fault, initial single-byte copy */
8551 -/* write fault, initial single-byte copy */
8556 -/* read fault, initial word copy */
8559 -/* write fault, initial word copy */
8563 -/* read fault in 2nd half of cacheline loop */
8564 -106: addi r5,r5,-16
8565 -/* read fault in 1st half of cacheline loop */
8568 -/* write fault in 2nd half of cacheline loop */
8569 -107: addi r5,r5,-16
8570 -/* fault on dcbz (effectively a write fault) */
8571 -/* or write fault in 1st half of cacheline loop */
8573 -92: li r3,LG_CACHELINE_BYTES
8575 -/* read fault in final word loop */
8578 -/* write fault in final word loop */
8583 -/* read fault in final byte loop */
8586 -/* write fault in final byte loop */
8591 - * At this stage the number of bytes not copied is
8592 - * r5 + (ctr << r3), and r4 is 0 for read or 1 for write.
8601 +/* we come here on a fault in the 8-byte-at-a-time loop */
8602 +88: subi r4,r4,8 /* compensate for the lwzu */
8604 + rlwimi r5,r0,3,0,28 /* use the byte-at-a-time loop to */
8605 + b 3b /* copy up to the byte at fault */
8606 +/* here on a write fault in the single-word copy */
8609 +/* here on a read fault in the initial single-byte copy */
8614 -/* for read fault, clear out the destination: r3 bytes starting at 4(r6) */
8626 +/* here on a read fault in the final single-byte copy */
8629 +/* clear out the rest of the destination: r3 bytes starting at 4(r6) */
8653 +/* here on a write fault in the initial single-byte copy */
8657 +/* here on a write fault in the final single-byte copy */
8661 .section __ex_table,"a"
8710 + /*rlwinm r0,r4,32-2,2,31*/
8714 diff -urN linux.orig/arch/ppc/mm/extable.c linux/arch/ppc/mm/extable.c
8715 --- linux.orig/arch/ppc/mm/extable.c Sun Mar 25 18:31:48 2001
8716 +++ linux/arch/ppc/mm/extable.c Thu Jul 11 15:43:29 2002
8718 #include <linux/module.h>
8719 #include <asm/uaccess.h>
8721 -extern struct exception_table_entry __start___ex_table[];
8722 -extern struct exception_table_entry __stop___ex_table[];
8725 - * The exception table needs to be sorted because we use the macros
8726 - * which put things into the exception table in a variety of segments
8727 - * such as the prep, pmac, chrp, etc. segments as well as the init
8728 - * segment and the main kernel text segment.
8731 -sort_ex_table(struct exception_table_entry *start,
8732 - struct exception_table_entry *finish)
8734 - struct exception_table_entry el, *p, *q;
8736 - /* insertion sort */
8737 - for (p = start + 1; p < finish; ++p) {
8738 - /* start .. p-1 is sorted */
8739 - if (p[0].insn < p[-1].insn) {
8740 - /* move element p down to its right place */
8744 - /* el comes before q[-1], move q[-1] up one */
8747 - } while (q > start && el.insn < q[-1].insn);
8754 -sort_exception_table(void)
8756 - sort_ex_table(__start___ex_table, __stop___ex_table);
8758 +extern const struct exception_table_entry __start___ex_table[];
8759 +extern const struct exception_table_entry __stop___ex_table[];
8761 static inline unsigned long
8762 search_one_table(const struct exception_table_entry *first,
8767 -#ifndef CONFIG_MODULES
8768 +#if 1 /*ndef CONFIG_MODULES*/
8769 /* There is only the kernel to search. */
8770 ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr);
8771 if (ret) return ret;
8772 diff -urN linux.orig/arch/ppc/mm/fault.c linux/arch/ppc/mm/fault.c
8773 --- linux.orig/arch/ppc/mm/fault.c Sun Mar 25 18:31:48 2001
8774 +++ linux/arch/ppc/mm/fault.c Thu Jul 11 15:43:29 2002
8776 (error_code&0x80000000)?"I/O ":"",
8777 (regs->trap == 0x400)?"instr":"data"
8780 - if (regs->trap == 0x400)
8781 - error_code &= 0x48200000;
8784 #if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
8785 if (debugger_fault_handler && regs->trap == 0x300) {
8786 debugger_fault_handler(regs);
8787 diff -urN linux.orig/arch/ppc/mm/init.c linux/arch/ppc/mm/init.c
8788 --- linux.orig/arch/ppc/mm/init.c Sun Mar 25 18:31:48 2001
8789 +++ linux/arch/ppc/mm/init.c Thu Jul 11 15:43:30 2002
8790 @@ -416,12 +416,7 @@
8792 void iounmap(void *addr)
8794 - /* For support of dynamic hot swap on the cPCI bus this routine
8795 - is now necessary. This has been well tested on a Motorola
8796 - MPC750 (Mesquite) processor board. Johnnie Peters
8798 - if (addr > high_memory && (unsigned long) addr < ioremap_bot)
8799 - return vfree((void *) (PAGE_MASK & (unsigned long) addr));
8803 unsigned long iopa(unsigned long addr)
8804 @@ -933,21 +928,15 @@
8805 /* On the powerpc, no user access
8806 forces R/W kernel access */
8808 - map_page(v, p, f);
8814 #else /* CONFIG_8xx */
8815 - for (i = 0; i < phys_mem.n_regions; ++i) {
8816 - v = (ulong)__va(phys_mem.regions[i].address);
8817 - p = phys_mem.regions[i].address;
8818 - for (s = 0; s < phys_mem.regions[i].size; s += PAGE_SIZE) {
8819 + for (i = 0; i < phys_mem.n_regions; ++i) {
8820 + v = (ulong)__va(phys_mem.regions[i].address);
8821 + p = phys_mem.regions[i].address;
8822 + for (s = 0; s < phys_mem.regions[i].size; s += PAGE_SIZE) {
8823 /* On the MPC8xx, we want the page shared so we
8824 * don't get ASID compares on kernel space.
8826 - f = _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_SHARED;
8827 + f = _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_SHARED;
8829 /* I don't really need the rest of this code, but
8830 * I grabbed it because I think the line:
8831 @@ -957,14 +946,14 @@
8832 * the MPC8xx, the PAGE_DIRTY takes care of that
8833 * for us (along with the RW software state).
8835 - if ((char *) v < _stext || (char *) v >= etext)
8836 - f |= _PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE;
8837 + if ((char *) v < _stext || (char *) v >= etext)
8838 + f |= _PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE;
8839 +#endif /* CONFIG_8xx */
8845 -#endif /* CONFIG_8xx */
8849 /* This can get called from ioremap, so don't make it an initfunc, OK? */
8850 @@ -1044,9 +1033,6 @@
8854 -#ifdef CONFIG_BOOTX_TEXT
8855 -extern boot_infos_t *disp_bi;
8857 __initfunc(void MMU_init(void))
8860 @@ -1066,6 +1052,7 @@
8861 #endif /* CONFIG_GEMINI */
8863 end_of_DRAM = prep_find_end_of_memory();
8864 +*(unsigned long *)(KERNELBASE) = 0xdeadbeef;
8866 _SDR1 = __pa(Hash) | (Hash_mask >> 10);
8867 ioremap_base = 0xf8000000;
8868 @@ -1095,13 +1082,7 @@
8869 struct device_node *macio = find_devices("mac-io");
8870 if (macio && macio->n_addrs)
8871 base = macio->addrs[0].address;
8872 - /* Hrm... we have it at 0x80000000 on some machines
8873 - * and this is covered by the userland segment
8874 - * registers. Isn't that bad ? Well, the BAT takes
8875 - * precedence, but I don't like it. --BenH
8877 - if (base >= 0xf0000000)
8878 - setbat(0, base, base, 0x100000, IO_PAGE);
8879 + setbat(0, base, base, 0x100000, IO_PAGE);
8880 ioremap_base = 0xf0000000;
8883 @@ -1140,10 +1121,6 @@
8884 ioremap(0x80000000, 0x4000);
8885 ioremap(0x81000000, 0x4000);
8886 #endif /* CONFIG_8xx */
8887 -#ifdef CONFIG_BOOTX_TEXT
8888 - if (_machine == _MACH_Pmac)
8894 @@ -1275,8 +1252,8 @@
8895 #endif /* CONFIG_BLK_DEV_INITRD */
8898 - addr < (rtas_data + KERNELBASE) ||
8899 - addr >= (rtas_data + KERNELBASE + rtas_size))
8900 + addr < (rtas_data & PAGE_MASK) ||
8901 + addr >= (rtas_data+rtas_size))
8902 #endif /* CONFIG_8xx */
8905 @@ -1337,7 +1314,6 @@
8908 #endif /* CONFIG_MBX */
8912 * On systems with Open Firmware, collect information about
8913 @@ -1404,7 +1380,6 @@
8914 if (boot_infos == 0) {
8915 /* record which bits the prom is using */
8916 get_mem_prop("available", &phys_avail);
8917 - remove_mem_piece(&phys_avail, __max_memory, ~__max_memory, 0);
8918 prom_mem = phys_mem;
8919 for (i = 0; i < phys_avail.n_regions; ++i)
8920 remove_mem_piece(&prom_mem,
8921 diff -urN linux.orig/arch/ppc/pmac_defconfig linux/arch/ppc/pmac_defconfig
8922 --- linux.orig/arch/ppc/pmac_defconfig Sun Mar 25 18:31:50 2001
8923 +++ linux/arch/ppc/pmac_defconfig Thu Jul 11 15:43:30 2002
8925 CONFIG_NET_ETHERNET=y
8929 # CONFIG_NET_VENDOR_3COM is not set
8930 # CONFIG_LANCE is not set
8931 # CONFIG_NET_VENDOR_SMC is not set
8933 CONFIG_FB_PLATINUM=y
8934 CONFIG_FB_VALKYRIE=y
8939 # CONFIG_FB_S3TRIO is not set
8940 diff -urN linux.orig/arch/ppc/xmon/start.c linux/arch/ppc/xmon/start.c
8941 --- linux.orig/arch/ppc/xmon/start.c Sun Mar 25 18:31:50 2001
8942 +++ linux/arch/ppc/xmon/start.c Thu Jul 11 15:43:30 2002
8944 #include <asm/prom.h>
8945 #include <asm/bootx.h>
8946 #include <asm/pmu.h>
8947 -#include <asm/feature.h>
8949 static volatile unsigned char *sccc, *sccd;
8950 unsigned long TXRDY, RXRDY;
8951 extern void xmon_printf(const char *fmt, ...);
8952 +extern void map_bootx_text(void);
8953 extern void drawchar(char);
8954 extern void drawstring(const char *str);
8955 -static int xmon_expect(const char *str, unsigned int timeout);
8957 static int console = 0;
8958 static int use_screen = 0;
8959 -static int via_modem = 0;
8960 -static int xmon_use_sccb = 0;
8961 -static struct device_node *macio_node;
8963 -#define TB_SPEED 25000000
8965 -static inline unsigned int readtb(void)
8969 - asm volatile("mftb %0" : "=r" (ret) :);
8973 void buf_access(void)
8976 if ( _machine == _MACH_Pmac )
8978 struct device_node *np;
8979 + extern boot_infos_t *boot_infos;
8981 -#ifdef CONFIG_BOOTX_TEXT
8982 - extern boot_infos_t *disp_bi;
8984 - /* needs to be hacked if xmon_printk is to be used
8985 - from within find_via_pmu() */
8986 - if (!via_modem && disp_bi && find_via_pmu()) {
8987 +#ifdef CONFIG_BOOTX_TEXT
8988 + if (boot_infos != 0 && find_via_pmu()) {
8989 printk(KERN_INFO "xmon uses screen and keyboard\n");
9001 np = find_devices("mac-io");
9002 if (np && np->n_addrs) {
9004 - addr = np->addrs[0].address + 0x13020;
9005 + addr = np->addrs[0].address + 0x13000;
9006 + /* use the B channel on the iMac, A channel on others */
9007 + if (addr >= 0xf0000000)
9008 + addr += 0x20; /* use A channel */
9010 - base = (volatile unsigned char *)
9011 - ioremap(addr & PAGE_MASK, PAGE_SIZE);
9012 + base = (volatile unsigned char *) ioremap(addr & PAGE_MASK, PAGE_SIZE);
9013 sccc = base + (addr & ~PAGE_MASK);
9014 - sccd = sccc + 0x10;
9016 + sccd = sccc + (0xc1013030 - 0xc1013020);
9018 + sccd = sccc + (0xf3013030 - 0xf3013020);
9024 xmon_write(void *handle, void *ptr, int nb)
9030 #ifdef CONFIG_BOOTX_TEXT
9032 @@ -111,23 +101,19 @@
9034 if (!scc_initialized)
9037 for (i = 0; i < nb; ++i) {
9038 while ((*sccc & TXRDY) == 0)
9039 if (adb_hardware == ADB_VIAPMU)
9042 - if (c == '\n' && !ct) {
9053 + if ( console && (*p != '\r'))
9060 + xmon_write(handle, "\r", 1);
9064 @@ -213,30 +199,23 @@
9065 if (adb_hardware == ADB_VIAPMU)
9070 + if ( 0/*console*/ )
9071 + *p++ = ppc_md.kbd_getkeycode();
9080 -xmon_read_poll(void)
9082 - if ((*sccc & RXRDY) == 0) {
9083 - if (adb_hardware == ADB_VIAPMU)
9091 static unsigned char scc_inittab[] = {
9092 13, 0, /* set baud rate divisor */
9094 14, 1, /* baud rate gen enable, src=rtxc */
9095 11, 0x50, /* clocks = br gen */
9096 - 5, 0xea, /* tx 8 bits, assert DTR & RTS */
9097 - 4, 0x46, /* x16 clock, 1 stop */
9098 + 5, 0x6a, /* tx 8 bits, assert RTS */
9099 + 4, 0x44, /* x16 clock, 1 stop */
9100 3, 0xc1, /* rx enable, 8 bits */
9103 @@ -256,21 +235,6 @@
9107 - if (macio_node != 0) {
9110 - feature_set(macio_node, FEATURE_Serial_enable);
9112 - feature_set(macio_node, FEATURE_Modem_power);
9114 - while (readtb() - t0 < 3*TB_SPEED)
9118 - if (xmon_use_sccb) {
9122 for (i = 20000; i != 0; --i) {
9125 @@ -282,18 +246,6 @@
9128 scc_initialized = 1;
9131 - xmon_write(0, "ATE1V1\r", 7);
9132 - if (xmon_expect("OK", 5)) {
9133 - xmon_write(0, "ATA\r", 4);
9134 - if (xmon_expect("CONNECT", 40))
9137 - xmon_write(0, "+++", 3);
9138 - xmon_expect("OK", 3);
9144 @@ -366,35 +318,6 @@
9145 static char *lineptr;
9146 static int lineleft;
9148 -int xmon_expect(const char *str, unsigned int timeout)
9153 - timeout *= TB_SPEED;
9158 - c = xmon_read_poll();
9160 - if (readtb() - t0 > timeout) {
9161 - printk("timeout\n");
9169 - if (c != '\r' && lineptr < &line[sizeof(line) - 1])
9173 - } while (strstr(line, str) == NULL);
9180 @@ -467,15 +390,3 @@
9196 diff -urN linux.orig/arch/ppc/xmon/xmon.c linux/arch/ppc/xmon/xmon.c
9197 --- linux.orig/arch/ppc/xmon/xmon.c Sun Mar 25 18:31:50 2001
9198 +++ linux/arch/ppc/xmon/xmon.c Thu Jul 11 15:43:30 2002
9200 extern int setjmp(u_int *);
9201 extern void longjmp(u_int *, int);
9203 -extern void xmon_enter(void);
9204 -extern void xmon_leave(void);
9206 #define GETWORD(v) (((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3])
9208 static char *help_string = "\
9211 set_msr(msr & ~0x8000); /* disable interrupts */
9222 set_msr(msr); /* restore interrupt enable */
9225 diff -urN linux.orig/include/asm-ppc/irq-compat.h linux/include/asm-ppc/irq-compat.h
9226 --- linux.orig/include/asm-ppc/irq-compat.h Thu Jan 1 01:00:00 1970
9227 +++ linux/include/asm-ppc/irq-compat.h Thu Jul 11 15:43:30 2002
9229 +#include <asm/irq.h>
9231 +//#define NUM_8259_INTERRUPTS 16
9232 +//#define NUM_OPENPIC_INTERRUPTS 20
9233 +//#define is_8259_irq(n) ((n) < NUM_8259_INTERRUPTS)
9234 +#define openpic_to_irq(n) ((n)+NUM_8259_INTERRUPTS)
9235 +//#define irq_to_openpic(n) ((n)-NUM_8259_INTERRUPTS)
9236 +//#define IRQ_8259_CASCADE NUM_8259_INTERRUPTS
9237 diff -urN linux.orig/include/asm-ppc/ohare-compat.h linux/include/asm-ppc/ohare-compat.h
9238 --- linux.orig/include/asm-ppc/ohare-compat.h Thu Jan 1 01:00:00 1970
9239 +++ linux/include/asm-ppc/ohare-compat.h Thu Jul 11 15:43:30 2002
9241 +#define OH_BAY_RESET 2 /* a guess */
9242 +#define OH_IDE_ENABLE 0x20
9243 +#define OH_IDE_POWER 0x40 /* a guess */
9244 +#define OH_BAY_ENABLE 0x80
9245 +#define OH_IDE_RESET 0x100 /* 0-based, a guess */
9246 +#define OH_VIA_ENABLE 0x10000
9247 +#define OH_IDECD_POWER 0x800000
9248 diff -urN linux.orig/include/asm-ppc/page.h linux/include/asm-ppc/page.h
9249 --- linux.orig/include/asm-ppc/page.h Sun Mar 25 18:37:39 2001
9250 +++ linux/include/asm-ppc/page.h Thu Jul 11 15:43:30 2002
9252 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
9254 extern void clear_page(unsigned long page);
9255 -extern void copy_page(unsigned long to, unsigned long from);
9256 +#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
9258 /* map phys->virtual and virtual->phys for RAM pages */
9260 diff -urN linux.orig/include/asm-ppc/pf-compat.h linux/include/asm-ppc/pf-compat.h
9261 --- linux.orig/include/asm-ppc/pf-compat.h Thu Jan 1 01:00:00 1970
9262 +++ linux/include/asm-ppc/pf-compat.h Thu Jul 11 15:43:30 2002
9264 +#define PF_TRACESYS 0x00000020 /* tracing system calls */
9265 +#define PF_PTRACED 0x00000010 /* set if ptrace (0) has been called */