]> git.pld-linux.org Git - packages/kernel.git/blob - 2.2.21-ppc_9.patch
- obsolete
[packages/kernel.git] / 2.2.21-ppc_9.patch
1 diff -urN linux.orig/arch/ppc/boot/Makefile linux/arch/ppc/boot/Makefile
2 --- linux.orig/arch/ppc/boot/Makefile   Sun Mar 25 18:31:49 2001
3 +++ linux/arch/ppc/boot/Makefile        Thu Jul 11 15:43:29 2002
4 @@ -9,6 +9,7 @@
5  # Adapted for PowerPC by Gary Thomas
6  # modified by Cort (cort@cs.nmt.edu)
7  #
8 +#
9  .c.s:
10         $(CC) $(CFLAGS) -I$(HPATH) -S -o $*.s $<
11  .s.o:
12 @@ -69,7 +70,7 @@
13  zvmlinux.initrd: zvmlinux
14         $(LD) $(ZLINKFLAGS) -o zvmlinux.initrd.tmp $(OBJECTS)
15         $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
16 -               --add-section=initrd=../coffboot/ramdisk.image.gz \
17 +               --add-section=initrd=ramdisk.image.gz \
18                 --add-section=image=../coffboot/vmlinux.gz \
19                 zvmlinux.initrd.tmp zvmlinux.initrd
20         $(CC) $(CFLAGS) -DINITRD_OFFSET=`sh offset $(OBJDUMP) zvmlinux.initrd initrd` \
21 @@ -79,7 +80,7 @@
22                 -c -o misc.o misc.c
23         $(LD) $(ZLINKFLAGS) -o zvmlinux.initrd.tmp $(OBJECTS)
24         $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
25 -               --add-section=initrd=../coffboot/ramdisk.image.gz \
26 +               --add-section=initrd=ramdisk.image.gz \
27                 --add-section=image=../coffboot/vmlinux.gz \
28                 zvmlinux.initrd.tmp $@
29         rm zvmlinux.initrd.tmp
30 diff -urN linux.orig/arch/ppc/boot/vreset.c linux/arch/ppc/boot/vreset.c
31 --- linux.orig/arch/ppc/boot/vreset.c   Sun Mar 25 18:31:49 2001
32 +++ linux/arch/ppc/boot/vreset.c        Thu Jul 11 15:43:29 2002
33 @@ -15,7 +15,7 @@
34   * Adapted for IBM portables by:
35   *                                      Takeshi Ishimoto
36   * Multi-console support:
37 - *                                      Terje Malmedal <terje.malmedal@usit.uio.no>
38 + *
39   */
40  
41  #include "iso_font.h"
42 diff -urN linux.orig/arch/ppc/chrpboot/main.c linux/arch/ppc/chrpboot/main.c
43 --- linux.orig/arch/ppc/chrpboot/main.c Sun Mar 25 18:31:50 2001
44 +++ linux/arch/ppc/chrpboot/main.c      Thu Jul 11 15:43:29 2002
45 @@ -17,16 +17,15 @@
46  #define get_32be(x)    (*(unsigned *)(x))
47  
48  #define RAM_START      0x00000000
49 -#define RAM_END                (64<<20)
50 +#define RAM_END                (8<<20)
51  
52 -#define BOOT_START     ((unsigned long)_start)
53 -#define BOOT_END       ((unsigned long)(_end + 0xFFF) & ~0xFFF)
54 +#define RAM_FREE       ((unsigned long)(_end+0x1000)&~0xFFF)
55  #define PROG_START     0x00010000
56  
57  char *avail_ram;
58  char *end_avail;
59  
60 -extern char _start[], _end[];
61 +extern char _end[];
62  extern char image_data[];
63  extern int image_len;
64  extern char initrd_data[];
65 @@ -40,31 +39,26 @@
66      void *dst;
67      unsigned char *im;
68      unsigned initrd_start, initrd_size;
69 -
70 -    printf("chrpboot starting: loaded at 0x%x\n\r", _start);
71 +    extern char _start;
72 +    
73 +    printf("chrpboot starting: loaded at 0x%x\n\r", &_start);
74  
75      if (initrd_len) {
76         initrd_size = initrd_len;
77         initrd_start = (RAM_END - initrd_size) & ~0xFFF;
78         a1 = initrd_start;
79         a2 = initrd_size;
80 -       claim(initrd_start, RAM_END - initrd_start, 0);
81 -       printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n",
82 -              initrd_start, initrd_data, initrd_size);
83 +       printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n\r", initrd_start,
84 +              initrd_data,initrd_size);
85         memcpy((char *)initrd_start, initrd_data, initrd_size);
86 -    }
87 +       end_avail = (char *)initrd_start;
88 +    } else
89 +       end_avail = (char *) RAM_END;
90      im = image_data;
91      len = image_len;
92 -    /* try and claim our text/data in case of OF bugs */
93 -    claim(BOOT_START, BOOT_END - BOOT_START, 0);
94 -    /* claim 4MB starting at PROG_START */
95 -    claim(PROG_START, (4<<20) - PROG_START, 0);
96      dst = (void *) PROG_START;
97      if (im[0] == 0x1f && im[1] == 0x8b) {
98 -       /* claim 512kB for scratch space */
99 -       avail_ram = (char *) claim(0, 512 << 10, 0x10);
100 -       end_avail = avail_ram + (512 << 10);
101 -       printf("avail_ram = %x\n", avail_ram);
102 +       avail_ram = (char *)RAM_FREE;
103         printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len);
104         gunzip(dst, 0x400000, im, &len);
105         printf("done %u bytes\n\r", len);
106 diff -urN linux.orig/arch/ppc/chrpboot/misc.S linux/arch/ppc/chrpboot/misc.S
107 --- linux.orig/arch/ppc/chrpboot/misc.S Sun Mar 25 18:31:50 2001
108 +++ linux/arch/ppc/chrpboot/misc.S      Thu Jul 11 15:43:29 2002
109 @@ -9,7 +9,7 @@
110         .text
111  
112  /*
113 - * Use the BAT0 registers to map the 1st 8 or 64MB of RAM to 0x90000000.
114 + * Use the BAT0 registers to map the 1st 8MB of RAM to 0x90000000.
115   */
116         .globl  setup_bats
117  setup_bats:
118 @@ -21,7 +21,7 @@
119         ori     4,4,4                   /* set up BAT registers for 601 */
120         li      5,0x7f
121         b       5f
122 -4:     ori     4,4,0x7ff               /* set up BAT registers for 604 */
123 +4:     ori     4,4,0xff                /* set up BAT registers for 604 */
124         li      5,2
125         mtdbatu 3,4
126         mtdbatl 3,5
127 diff -urN linux.orig/arch/ppc/chrpboot/start.c linux/arch/ppc/chrpboot/start.c
128 --- linux.orig/arch/ppc/chrpboot/start.c        Sun Mar 25 18:31:50 2001
129 +++ linux/arch/ppc/chrpboot/start.c     Thu Jul 11 15:43:29 2002
130 @@ -131,29 +131,6 @@
131      return args.phandle;
132  }
133  
134 -void *
135 -claim(unsigned int virt, unsigned int size, unsigned int align)
136 -{
137 -    struct prom_args {
138 -       char *service;
139 -       int nargs;
140 -       int nret;
141 -       unsigned int virt;
142 -       unsigned int size;
143 -       unsigned int align;
144 -       void *ret;
145 -    } args;
146 -
147 -    args.service = "claim";
148 -    args.nargs = 3;
149 -    args.nret = 1;
150 -    args.virt = virt;
151 -    args.size = size;
152 -    args.align = align;
153 -    (*prom)(&args);
154 -    return args.ret;
155 -}
156 -
157  int
158  getprop(void *phandle, const char *name, void *buf, int buflen)
159  {
160 diff -urN linux.orig/arch/ppc/coffboot/Makefile linux/arch/ppc/coffboot/Makefile
161 --- linux.orig/arch/ppc/coffboot/Makefile       Sun Mar 25 18:31:49 2001
162 +++ linux/arch/ppc/coffboot/Makefile    Thu Jul 11 15:43:29 2002
163 @@ -9,13 +9,12 @@
164  LD     = $(CROSS_COMPILE)ld
165  CFLAGS = $(CPPFLAGS) -O -fno-builtin -I$(HPATH)
166  OBJCOPY = $(CROSS_COMPILE)objcopy
167 -OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
168 -COFF_LD_ARGS = -e _start -T ld.script -Ttext 500000 -Tdata 510000 -Bstatic
169 -CHRP_LD_ARGS = -Ttext 0x01000000
170 +OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment \
171 +       --add-section=image=vmlinux.gz
172 +LD_ARGS = -e _start -T ld.script -Ttext 500000 -Tdata 510000 -Bstatic
173  GZ = gzip -9
174  
175 -COFFOBJS = coffcrt0.o start.o coffmain.o misc.o string.o zlib.o image.o
176 -CHRPOBJS = crt0.o start.o chrpmain.o misc.o string.o zlib.o image.o
177 +OBJS = crt0.o start.o main.o misc.o string.o zlib.o
178  LIBS = $(TOPDIR)/lib/lib.a
179  
180  ifeq ($(CONFIG_PPC64),y)
181 @@ -34,81 +33,39 @@
182  hack-coff: hack-coff.c
183         $(HOSTCC) $(HOSTCFLAGS) -o hack-coff hack-coff.c
184  
185 -znetboot: vmlinux.coff zImage vmlinux.elf
186 -       cp vmlinux.coff $(TFTPIMAGE)
187 -       cp vmlinux.elf $(TFTPIMAGE).elf
188 -
189 -znetboot.initrd: vmlinux.coff.initrd vmlinux.elf.initrd
190 -       cp vmlinux.coff.initrd $(TFTPIMAGE)
191 -       cp vmlinux.elf.initrd $(TFTPIMAGE).elf
192 -
193  floppy: zImage
194  #      mount -t hfs /dev/fd0 /mnt
195  #      cp vmlinux.coff /mnt
196  #      umount /mnt
197  
198 -coffboot: $(COFFOBJS) no_initrd.o ld.script
199 -       $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) no_initrd.o $(LIBS)
200 -
201 -coffboot.initrd: $(COFFOBJS) initrd.o ld.script
202 -       $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) initrd.o $(LIBS)
203 +znetboot: vmlinux.coff
204 +       cp vmlinux.coff $(TFTPIMAGE)
205  
206 -piggyback: piggyback.c
207 -       $(HOSTCC) $(HOSTCFLAGS) -DKERNELBASE=$(KERNELBASE) -o piggyback piggyback.c
208 +znetboot.initrd: vmlinux.coff.initrd
209 +       cp vmlinux.coff.initrd $(TFTPIMAGE)
210  
211 -mknote: mknote.c
212 -       $(HOSTCC) $(HOSTCFLAGS) -o mknote mknote.c
213 +coffboot: $(OBJS) ld.script
214 +       $(LD) -o coffboot $(LD_ARGS) $(OBJS) $(LIBS)
215  
216 -image.o: piggyback vmlinux.gz
217 -       ./piggyback image < vmlinux.gz | $(AS) -o image.o
218 +zImage: vmlinux.coff
219  
220 -initrd.o: ramdisk.image.gz piggyback
221 -       ./piggyback initrd < ramdisk.image.gz | $(AS) -o initrd.o
222 +zImage.initrd: vmlinux.coff.initrd
223  
224 -vmlinux.coff: coffboot hack-coff
225 +vmlinux.coff: coffboot hack-coff vmlinux.gz
226         $(OBJCOPY) $(OBJCOPY_ARGS) coffboot $@
227         ./hack-coff $@
228         ln -sf vmlinux.coff zImage
229  
230 -vmlinux.coff.initrd: coffboot.initrd hack-coff
231 -       $(OBJCOPY) $(OBJCOPY_ARGS) coffboot.initrd $@
232 +vmlinux.coff.initrd: coffboot hack-coff vmlinux.gz ramdisk.image.gz
233 +       $(OBJCOPY) $(OBJCOPY_ARGS) --add-section=initrd=ramdisk.image.gz \
234 +               coffboot $@
235         ./hack-coff $@
236  
237 -vmlinux.elf: $(CHRPOBJS) no_initrd.o mknote
238 -       $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) no_initrd.o $(LIBS)
239 -       ./mknote > note
240 -       $(OBJCOPY) $@ $@ --add-section=.note=note -R .comment
241 -
242 -vmlinux.elf.initrd: $(CHRPOBJS) initrd.o mknote
243 -       $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) initrd.o $(LIBS)
244 -       ./mknote > note
245 -       $(OBJCOPY) $@ $@ --add-section=.note=note -R .comment
246 -
247 -micoffboot: dummy.o
248 -       $(LD) -o $@ $(COFF_LD_ARGS) dummy.o $(LIBS)
249 -
250 -miboot.image: micoffboot hack-coff vmlinux.gz
251 -       $(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=vmlinux.gz micoffboot $@
252 -       ./hack-coff $@
253 -
254 -miboot.image.initrd: micoffboot hack-coff vmlinux.gz ramdisk.image.gz
255 -       $(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=vmlinux.gz \
256 -       --add-section=initrd=ramdisk.image.gz micoffboot $@
257 -       ./hack-coff $@
258 -
259 -zImage: vmlinux.coff vmlinux.elf miboot.image
260 -
261 -zImage.initrd: vmlinux.coff.initrd vmlinux.elf.initrd miboot.image.initrd
262 -
263  else
264  znetboot: vmlinux.gz
265  
266  znetboot.initrd: vmlinux.gz
267  
268 -miboot.image: vmlinux.gz
269 -
270 -miboot.image.initrd: vmlinux.gz
271 -
272  coffboot: vmlinux.gz
273  
274  zImage: vmlinux.gz
275 @@ -129,7 +86,5 @@
276  
277  clean:
278         rm -f hack-coff coffboot zImage vmlinux.coff vmlinux.gz
279 -       rm -f mknote piggyback vmlinux.elf note
280 -       rm -f micoffboot miboot.image
281  
282  fastdep:
283 diff -urN linux.orig/arch/ppc/coffboot/chrpmain.c linux/arch/ppc/coffboot/chrpmain.c
284 --- linux.orig/arch/ppc/coffboot/chrpmain.c     Sun Mar 25 18:31:49 2001
285 +++ linux/arch/ppc/coffboot/chrpmain.c  Thu Jan  1 01:00:00 1970
286 @@ -1,252 +0,0 @@
287 -/*
288 - * Copyright (C) Paul Mackerras 1997.
289 - *
290 - * This program is free software; you can redistribute it and/or
291 - * modify it under the terms of the GNU General Public License
292 - * as published by the Free Software Foundation; either version
293 - * 2 of the License, or (at your option) any later version.
294 - */
295 -#include "nonstdio.h"
296 -#include "zlib.h"
297 -
298 -extern void *finddevice(const char *);
299 -extern int getprop(void *, const char *, void *, int);
300 -void gunzip(void *, int, unsigned char *, int *);
301 -void stop_imac_ethernet(void);
302 -void stop_imac_usb(void);
303 -
304 -#define get_16be(x)    (*(unsigned short *)(x))
305 -#define get_32be(x)    (*(unsigned *)(x))
306 -
307 -#define RAM_END                (16 << 20)
308 -
309 -#define PROG_START     0x00010000
310 -#define PROG_SIZE      0x003f0000
311 -
312 -#define SCRATCH_SIZE   (128 << 10)
313 -
314 -char *avail_ram;
315 -char *begin_avail, *end_avail;
316 -char *avail_high;
317 -unsigned int heap_use;
318 -unsigned int heap_max;
319 -
320 -extern char _end[];
321 -extern char image_data[];
322 -extern int image_len;
323 -extern char initrd_data[];
324 -extern int initrd_len;
325 -
326 -
327 -boot(int a1, int a2, void *prom)
328 -{
329 -    int ns, oh, i;
330 -    unsigned sa, len;
331 -    void *dst;
332 -    unsigned char *im;
333 -    unsigned initrd_start, initrd_size;
334 -    extern char _start;
335 -    
336 -    printf("chrpboot starting: loaded at 0x%x\n", &_start);
337 -    if (initrd_len) {
338 -       initrd_size = initrd_len;
339 -       initrd_start = (RAM_END - initrd_size) & ~0xFFF;
340 -       a1 = initrd_start;
341 -       a2 = initrd_size;
342 -       claim(initrd_start, RAM_END - initrd_start, 0);
343 -       printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n",
344 -              initrd_start, initrd_data, initrd_size);
345 -       memcpy((char *)initrd_start, initrd_data, initrd_size);
346 -    }
347 -    im = image_data;
348 -    len = image_len;
349 -    /* claim 3MB starting at PROG_START */
350 -    claim(PROG_START, PROG_SIZE, 0);
351 -    dst = (void *) PROG_START;
352 -    if (im[0] == 0x1f && im[1] == 0x8b) {
353 -       /* claim some memory for scratch space */
354 -       avail_ram = (char *) claim(0, SCRATCH_SIZE, 0x10);
355 -       begin_avail = avail_high = avail_ram;
356 -       end_avail = avail_ram + SCRATCH_SIZE;
357 -       printf("heap at 0x%x\n", avail_ram);
358 -       printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len);
359 -       gunzip(dst, PROG_SIZE, im, &len);
360 -       printf("done %u bytes\n", len);
361 -       printf("%u bytes of heap consumed, max in use %u\n",
362 -              avail_high - begin_avail, heap_max);
363 -    } else {
364 -       memmove(dst, im, len);
365 -    }
366 -
367 -    flush_cache(dst, len);
368 -#if 0
369 -    stop_imac_ethernet();
370 -    stop_imac_usb();
371 -#endif
372 -
373 -    sa = (unsigned long)PROG_START;
374 -    printf("start address = 0x%x\n", sa);
375 -
376 -    (*(void (*)())sa)(a1, a2, prom);
377 -
378 -    printf("returned?\n");
379 -
380 -    pause();
381 -}
382 -
383 -#if 0
384 -#define eieio()        asm volatile("eieio");
385 -
386 -void stop_imac_ethernet(void)
387 -{
388 -    void *macio, *enet;
389 -    unsigned int macio_addr[5], enet_reg[6];
390 -    int len;
391 -    volatile unsigned int *dbdma;
392 -
393 -    macio = finddevice("/pci/mac-io");
394 -    enet = finddevice("/pci/mac-io/ethernet");
395 -    if (macio == NULL || enet == NULL)
396 -       return;
397 -    len = getprop(macio, "assigned-addresses", macio_addr, sizeof(macio_addr));
398 -    if (len != sizeof(macio_addr))
399 -       return;
400 -    len = getprop(enet, "reg", enet_reg, sizeof(enet_reg));
401 -    if (len != sizeof(enet_reg))
402 -       return;
403 -    printf("macio base %x, dma at %x & %x\n",
404 -          macio_addr[2], enet_reg[2], enet_reg[4]);
405 -
406 -    /* hope this is mapped... */
407 -    dbdma = (volatile unsigned int *) (macio_addr[2] + enet_reg[2]);
408 -    *dbdma = 0x80;     /* clear the RUN bit */
409 -    eieio();
410 -    dbdma = (volatile unsigned int *) (macio_addr[2] + enet_reg[4]);
411 -    *dbdma = 0x80;     /* clear the RUN bit */
412 -    eieio();
413 -}
414 -
415 -void stop_imac_usb(void)
416 -{
417 -    void *usb;
418 -    unsigned int usb_addr[5];
419 -    int len;
420 -    volatile unsigned int *usb_ctrl;
421 -
422 -    usb = finddevice("/pci/usb");
423 -    if (usb == NULL)
424 -       return;
425 -    len = getprop(usb, "assigned-addresses", usb_addr, sizeof(usb_addr));
426 -    if (len != sizeof(usb_addr))
427 -       return;
428 -    printf("usb base %x\n", usb_addr[2]);
429 -
430 -    usb_ctrl = (volatile unsigned int *) (usb_addr[2] + 8);
431 -    *usb_ctrl = 0x01000000;    /* cpu_to_le32(1) */
432 -    eieio();
433 -}
434 -#endif
435 -
436 -struct memchunk {
437 -    unsigned int size;
438 -    struct memchunk *next;
439 -};
440 -
441 -static struct memchunk *freechunks;
442 -
443 -void *zalloc(void *x, unsigned items, unsigned size)
444 -{
445 -    void *p;
446 -    struct memchunk **mpp, *mp;
447 -
448 -    size *= items;
449 -    size = (size + 7) & -8;
450 -    heap_use += size;
451 -    if (heap_use > heap_max)
452 -       heap_max = heap_use;
453 -    for (mpp = &freechunks; (mp = *mpp) != 0; mpp = &mp->next) {
454 -       if (mp->size == size) {
455 -           *mpp = mp->next;
456 -           return mp;
457 -       }
458 -    }
459 -    p = avail_ram;
460 -    avail_ram += size;
461 -    if (avail_ram > avail_high)
462 -       avail_high = avail_ram;
463 -    if (avail_ram > end_avail) {
464 -       printf("oops... out of memory\n");
465 -       pause();
466 -    }
467 -    return p;
468 -}
469 -
470 -void zfree(void *x, void *addr, unsigned nb)
471 -{
472 -    struct memchunk *mp = addr;
473 -
474 -    nb = (nb + 7) & -8;
475 -    heap_use -= nb;
476 -    if (avail_ram == addr + nb) {
477 -       avail_ram = addr;
478 -       return;
479 -    }
480 -    mp->size = nb;
481 -    mp->next = freechunks;
482 -    freechunks = mp;
483 -}
484 -
485 -#define HEAD_CRC       2
486 -#define EXTRA_FIELD    4
487 -#define ORIG_NAME      8
488 -#define COMMENT                0x10
489 -#define RESERVED       0xe0
490 -
491 -#define DEFLATED       8
492 -
493 -void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
494 -{
495 -    z_stream s;
496 -    int r, i, flags;
497 -
498 -    /* skip header */
499 -    i = 10;
500 -    flags = src[3];
501 -    if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
502 -       printf("bad gzipped data\n");
503 -       exit();
504 -    }
505 -    if ((flags & EXTRA_FIELD) != 0)
506 -       i = 12 + src[10] + (src[11] << 8);
507 -    if ((flags & ORIG_NAME) != 0)
508 -       while (src[i++] != 0)
509 -           ;
510 -    if ((flags & COMMENT) != 0)
511 -       while (src[i++] != 0)
512 -           ;
513 -    if ((flags & HEAD_CRC) != 0)
514 -       i += 2;
515 -    if (i >= *lenp) {
516 -       printf("gunzip: ran out of data in header\n");
517 -       exit();
518 -    }
519 -
520 -    s.zalloc = zalloc;
521 -    s.zfree = zfree;
522 -    r = inflateInit2(&s, -MAX_WBITS);
523 -    if (r != Z_OK) {
524 -       printf("inflateInit2 returned %d\n", r);
525 -       exit();
526 -    }
527 -    s.next_in = src + i;
528 -    s.avail_in = *lenp - i;
529 -    s.next_out = dst;
530 -    s.avail_out = dstlen;
531 -    r = inflate(&s, Z_FINISH);
532 -    if (r != Z_OK && r != Z_STREAM_END) {
533 -       printf("inflate returned %d msg: %s\n", r, s.msg);
534 -       exit();
535 -    }
536 -    *lenp = s.next_out - (unsigned char *) dst;
537 -    inflateEnd(&s);
538 -}
539 diff -urN linux.orig/arch/ppc/coffboot/coffcrt0.S linux/arch/ppc/coffboot/coffcrt0.S
540 --- linux.orig/arch/ppc/coffboot/coffcrt0.S     Sun Mar 25 18:31:49 2001
541 +++ linux/arch/ppc/coffboot/coffcrt0.S  Thu Jan  1 01:00:00 1970
542 @@ -1,24 +0,0 @@
543 -/*
544 - * Copyright (C) Paul Mackerras 1997.
545 - *
546 - * This program is free software; you can redistribute it and/or
547 - * modify it under the terms of the GNU General Public License
548 - * as published by the Free Software Foundation; either version
549 - * 2 of the License, or (at your option) any later version.
550 - */
551 -       .text
552 -       .globl  _start
553 -_start:
554 -       .long   __start,0,0
555 -
556 -       .globl  __start
557 -__start:
558 -       lis     9,_start@h
559 -       lis     8,_etext@ha
560 -       addi    8,8,_etext@l
561 -1:     dcbf    0,9
562 -       icbi    0,9
563 -       addi    9,9,0x20
564 -       cmplwi  0,9,8
565 -       blt     1b
566 -       b       start
567 diff -urN linux.orig/arch/ppc/coffboot/coffmain.c linux/arch/ppc/coffboot/coffmain.c
568 --- linux.orig/arch/ppc/coffboot/coffmain.c     Sun Mar 25 18:31:49 2001
569 +++ linux/arch/ppc/coffboot/coffmain.c  Thu Jan  1 01:00:00 1970
570 @@ -1,157 +0,0 @@
571 -/*
572 - * Copyright (C) Paul Mackerras 1997.
573 - *
574 - * This program is free software; you can redistribute it and/or
575 - * modify it under the terms of the GNU General Public License
576 - * as published by the Free Software Foundation; either version
577 - * 2 of the License, or (at your option) any later version.
578 - */
579 -#include "nonstdio.h"
580 -#include "zlib.h"
581 -
582 -extern void *finddevice(const char *);
583 -extern int getprop(void *, const char *, void *, int);
584 -extern char *claim(unsigned, unsigned, unsigned);
585 -void gunzip(void *, int, unsigned char *, int *);
586 -
587 -#define get_16be(x)    (*(unsigned short *)(x))
588 -#define get_32be(x)    (*(unsigned *)(x))
589 -
590 -#define RAM_START      0xc0000000
591 -#define PROG_START     RAM_START
592 -#define RAM_END                (RAM_START + 0x800000)  /* only 8M mapped with BATs */
593 -
594 -char *avail_ram;
595 -char *end_avail;
596 -
597 -extern char _start[], _end[];
598 -extern char image_data[];
599 -extern int image_len;
600 -extern char initrd_data[];
601 -extern int initrd_len;
602 -
603 -
604 -boot(int a1, int a2, void *prom)
605 -{
606 -    int ns, oh, i;
607 -    unsigned sa, len;
608 -    void *dst;
609 -    unsigned char *im;
610 -    unsigned initrd_start, initrd_size;
611 -    
612 -    printf("coffboot starting: loaded at 0x%x\n", _start);
613 -    setup_bats(RAM_START);
614 -    if (initrd_len) {
615 -       initrd_size = initrd_len;
616 -       initrd_start = (RAM_END - initrd_size) & ~0xFFF;
617 -       a1 = initrd_start;
618 -       a2 = initrd_size;
619 -       claim(initrd_start - RAM_START, RAM_END - initrd_start, 0);
620 -       printf("initial ramdisk moving 0x%x <- 0x%x (%x bytes)\n",
621 -              initrd_start, initrd_data, initrd_size);
622 -       memcpy((char *)initrd_start, initrd_data, initrd_size);
623 -    }
624 -    im = image_data;
625 -    len = image_len;
626 -    /* claim 3MB starting at 0 */
627 -    claim(0, 3 << 20, 0);
628 -    dst = (void *) RAM_START;
629 -    if (im[0] == 0x1f && im[1] == 0x8b) {
630 -       /* claim 512kB for scratch space */
631 -       avail_ram = claim(0, 512 << 10, 0x10) + RAM_START;
632 -       end_avail = avail_ram + (512 << 10);
633 -       printf("avail_ram = %x\n", avail_ram);
634 -       printf("gunzipping (0x%x <- 0x%x:0x%0x)...", dst, im, im+len);
635 -       gunzip(dst, 3 << 20, im, &len);
636 -       printf("done %u bytes\n", len);
637 -    } else {
638 -       memmove(dst, im, len);
639 -    }
640 -
641 -    flush_cache(dst, len);
642 -    
643 -    sa = (unsigned long)PROG_START;
644 -    printf("start address = 0x%x\n", sa);
645 -
646 -#if 0
647 -    pause();
648 -#endif
649 -    (*(void (*)())sa)(a1, a2, prom);
650 -
651 -    printf("returned?\n");
652 -
653 -    pause();
654 -}
655 -
656 -void *zalloc(void *x, unsigned items, unsigned size)
657 -{
658 -    void *p = avail_ram;
659 -
660 -    size *= items;
661 -    size = (size + 7) & -8;
662 -    avail_ram += size;
663 -    if (avail_ram > end_avail) {
664 -       printf("oops... out of memory\n");
665 -       pause();
666 -    }
667 -    return p;
668 -}
669 -
670 -void zfree(void *x, void *addr, unsigned nb)
671 -{
672 -}
673 -
674 -#define HEAD_CRC       2
675 -#define EXTRA_FIELD    4
676 -#define ORIG_NAME      8
677 -#define COMMENT                0x10
678 -#define RESERVED       0xe0
679 -
680 -#define DEFLATED       8
681 -
682 -void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
683 -{
684 -    z_stream s;
685 -    int r, i, flags;
686 -
687 -    /* skip header */
688 -    i = 10;
689 -    flags = src[3];
690 -    if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
691 -       printf("bad gzipped data\n");
692 -       exit();
693 -    }
694 -    if ((flags & EXTRA_FIELD) != 0)
695 -       i = 12 + src[10] + (src[11] << 8);
696 -    if ((flags & ORIG_NAME) != 0)
697 -       while (src[i++] != 0)
698 -           ;
699 -    if ((flags & COMMENT) != 0)
700 -       while (src[i++] != 0)
701 -           ;
702 -    if ((flags & HEAD_CRC) != 0)
703 -       i += 2;
704 -    if (i >= *lenp) {
705 -       printf("gunzip: ran out of data in header\n");
706 -       exit();
707 -    }
708 -
709 -    s.zalloc = zalloc;
710 -    s.zfree = zfree;
711 -    r = inflateInit2(&s, -MAX_WBITS);
712 -    if (r != Z_OK) {
713 -       printf("inflateInit2 returned %d\n", r);
714 -       exit();
715 -    }
716 -    s.next_in = src + i;
717 -    s.avail_in = *lenp - i;
718 -    s.next_out = dst;
719 -    s.avail_out = dstlen;
720 -    r = inflate(&s, Z_FINISH);
721 -    if (r != Z_OK && r != Z_STREAM_END) {
722 -       printf("inflate returned %d msg: %s\n", r, s.msg);
723 -       exit();
724 -    }
725 -    *lenp = s.next_out - (unsigned char *) dst;
726 -    inflateEnd(&s);
727 -}
728 diff -urN linux.orig/arch/ppc/coffboot/crt0.S linux/arch/ppc/coffboot/crt0.S
729 --- linux.orig/arch/ppc/coffboot/crt0.S Sun Mar 25 18:31:49 2001
730 +++ linux/arch/ppc/coffboot/crt0.S      Thu Jul 11 15:43:29 2002
731 @@ -9,6 +9,10 @@
732         .text
733         .globl  _start
734  _start:
735 +       .long   __start,0,0
736 +
737 +       .globl  __start
738 +__start:
739         lis     9,_start@h
740         lis     8,_etext@ha
741         addi    8,8,_etext@l
742 diff -urN linux.orig/arch/ppc/coffboot/dummy.c linux/arch/ppc/coffboot/dummy.c
743 --- linux.orig/arch/ppc/coffboot/dummy.c        Sun Mar 25 18:31:49 2001
744 +++ linux/arch/ppc/coffboot/dummy.c     Thu Jan  1 01:00:00 1970
745 @@ -1,4 +0,0 @@
746 -int main(void)
747 -{
748 -       return 0;
749 -}
750 diff -urN linux.orig/arch/ppc/coffboot/misc.S linux/arch/ppc/coffboot/misc.S
751 --- linux.orig/arch/ppc/coffboot/misc.S Sun Mar 25 18:31:49 2001
752 +++ linux/arch/ppc/coffboot/misc.S      Thu Jul 11 15:43:29 2002
753 @@ -14,26 +14,23 @@
754   */
755         .globl  setup_bats
756  setup_bats:
757 -       mfpvr   5
758 -       rlwinm  5,5,16,16,31            /* r3 = 1 for 601, 4 for 604 */
759 -       cmpi    0,5,1
760 -       li      0,0
761 +       mr      4,3
762 +       mfpvr   3
763 +       rlwinm  3,3,16,16,31            /* r3 = 1 for 601, 4 for 604 */
764 +       cmpi    0,3,1
765         bne     4f
766 -       mtibatl 3,0                     /* invalidate BAT first */
767 -       ori     3,3,4                   /* set up BAT registers for 601 */
768 -       li      4,0x7f
769 -       mtibatu 3,3
770 -       mtibatl 3,4
771 -       b       5f
772 -4:     mtdbatu 3,0                     /* invalidate BATs first */
773 -       mtibatu 3,0
774 -       ori     3,3,0xff                /* set up BAT registers for 604 */
775 -       li      4,2
776 -       mtdbatl 3,4
777 -       mtdbatu 3,3
778 -       mtibatl 3,4
779 -       mtibatu 3,3
780 -5:     sync
781 +       ori     4,4,4                   /* set up BAT registers for 601 */
782 +       li      5,0x7f
783 +       mtibatu 3,4
784 +       mtibatl 3,5
785 +       isync
786 +       blr
787 +4:     ori     4,4,0xfe                /* set up BAT registers for 604 */
788 +       li      5,2
789 +       mtdbatl 3,5
790 +       mtdbatu 3,4
791 +       mtibatl 3,5
792 +       mtibatu 3,4
793         isync
794         blr
795  
796 diff -urN linux.orig/arch/ppc/coffboot/mknote.c linux/arch/ppc/coffboot/mknote.c
797 --- linux.orig/arch/ppc/coffboot/mknote.c       Sun Mar 25 18:31:49 2001
798 +++ linux/arch/ppc/coffboot/mknote.c    Thu Jan  1 01:00:00 1970
799 @@ -1,43 +0,0 @@
800 -/*
801 - * Copyright (C) Cort Dougan 1999.
802 - *
803 - * This program is free software; you can redistribute it and/or
804 - * modify it under the terms of the GNU General Public License
805 - * as published by the Free Software Foundation; either version
806 - * 2 of the License, or (at your option) any later version.
807 - *
808 - * Generate a note section as per the CHRP specification.
809 - *
810 - */
811 -
812 -#include <stdio.h>
813 -
814 -#define PL(x) printf("%c%c%c%c", ((x)>>24)&0xff, ((x)>>16)&0xff, ((x)>>8)&0xff, (x)&0xff );
815 -
816 -int main(void)
817 -{
818 -/* header */
819 -       /* namesz */
820 -       PL(strlen("PowerPC")+1);
821 -       /* descrsz */
822 -       PL(6*4);
823 -       /* type */
824 -       PL(0x1275);
825 -       /* name */
826 -       printf("PowerPC"); printf("%c", 0);
827 -       
828 -/* descriptor */
829 -       /* real-mode */
830 -       PL(0xffffffff);
831 -       /* real-base */
832 -       PL(0x00c00000);
833 -       /* real-size */
834 -       PL(0xffffffff);
835 -       /* virt-base */
836 -       PL(0xffffffff);
837 -       /* virt-size */
838 -       PL(0xffffffff);
839 -       /* load-base */
840 -       PL(0x4000);
841 -       return 0;
842 -}
843 diff -urN linux.orig/arch/ppc/coffboot/no_initrd.c linux/arch/ppc/coffboot/no_initrd.c
844 --- linux.orig/arch/ppc/coffboot/no_initrd.c    Sun Mar 25 18:31:49 2001
845 +++ linux/arch/ppc/coffboot/no_initrd.c Thu Jan  1 01:00:00 1970
846 @@ -1,2 +0,0 @@
847 -char initrd_data[1];
848 -int initrd_len = 0;
849 diff -urN linux.orig/arch/ppc/coffboot/piggyback.c linux/arch/ppc/coffboot/piggyback.c
850 --- linux.orig/arch/ppc/coffboot/piggyback.c    Sun Mar 25 18:31:49 2001
851 +++ linux/arch/ppc/coffboot/piggyback.c Thu Jan  1 01:00:00 1970
852 @@ -1,65 +0,0 @@
853 -#include <stdio.h>
854 -
855 -extern long ce_exec_config[];
856 -
857 -main(int argc, char *argv[])
858 -{
859 -       int i, cnt, pos, len;
860 -       unsigned int cksum, val;
861 -       unsigned char *lp;
862 -       unsigned char buf[8192];
863 -       if (argc != 2)
864 -       {
865 -               fprintf(stderr, "usage: %s name <in-file >out-file\n",
866 -                       argv[0]);
867 -               exit(1);
868 -       }
869 -       fprintf(stdout, "#\n");
870 -       fprintf(stdout, "# Miscellaneous data structures:\n");
871 -       fprintf(stdout, "# WARNING - this file is automatically generated!\n");
872 -       fprintf(stdout, "#\n");
873 -       fprintf(stdout, "\n");
874 -       fprintf(stdout, "\t.data\n");
875 -       fprintf(stdout, "\t.globl %s_data\n", argv[1]);
876 -       fprintf(stdout, "%s_data:\n", argv[1]);
877 -       pos = 0;
878 -       cksum = 0;
879 -       while ((len = read(0, buf, sizeof(buf))) > 0)
880 -       {
881 -               cnt = 0;
882 -               lp = (unsigned char *)buf;
883 -               len = (len + 3) & ~3;  /* Round up to longwords */
884 -               for (i = 0;  i < len;  i += 4)
885 -               {
886 -                       if (cnt == 0)
887 -                       {
888 -                               fprintf(stdout, "\t.long\t");
889 -                       }
890 -                       fprintf(stdout, "0x%02X%02X%02X%02X", lp[0], lp[1], lp[2], lp[3]);
891 -                       val = *(unsigned long *)lp;
892 -                       cksum ^= val;
893 -                       lp += 4;
894 -                       if (++cnt == 4)
895 -                       {
896 -                               cnt = 0;
897 -                               fprintf(stdout, " # %x \n", pos+i-12);
898 -                               fflush(stdout);
899 -                       } else
900 -                       {
901 -                               fprintf(stdout, ",");
902 -                       }
903 -               }
904 -               if (cnt)
905 -               {
906 -                       fprintf(stdout, "0\n");
907 -               }
908 -               pos += len;
909 -       }
910 -       fprintf(stdout, "\t.globl %s_len\n", argv[1]);
911 -       fprintf(stdout, "%s_len:\t.long\t0x%x\n", argv[1], pos);
912 -       fflush(stdout);
913 -       fclose(stdout);
914 -       fprintf(stderr, "cksum = %x\n", cksum);
915 -       exit(0);
916 -}
917 -
918 diff -urN linux.orig/arch/ppc/coffboot/start.c linux/arch/ppc/coffboot/start.c
919 --- linux.orig/arch/ppc/coffboot/start.c        Sun Mar 25 18:31:49 2001
920 +++ linux/arch/ppc/coffboot/start.c     Thu Jul 11 15:43:29 2002
921 @@ -33,7 +33,7 @@
922      if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
923         exit();
924  
925 -    boot(a1, a2, promptr);
926 +    coffboot(a1, a2, promptr);
927      for (;;)
928         exit();
929  }
930 @@ -62,25 +62,6 @@
931      return args.actual;
932  }
933  
934 -int writestring(void *f, char *ptr, int nb)
935 -{
936 -       int w = 0, i;
937 -       char *ret = "\r";
938 -
939 -       for (i = 0; i < nb; ++i) {
940 -               if (ptr[i] == '\n') {
941 -                       if (i > w) {
942 -                               write(f, ptr + w, i - w);
943 -                               w = i;
944 -                       }
945 -                       write(f, ret, 1);
946 -               }
947 -       }
948 -       if (w < nb)
949 -               write(f, ptr + w, nb - w);
950 -       return nb;
951 -}
952 -
953  int
954  read(void *handle, void *ptr, int nb)
955  {
956 @@ -149,29 +130,6 @@
957      return args.phandle;
958  }
959  
960 -void *
961 -claim(unsigned int virt, unsigned int size, unsigned int align)
962 -{
963 -    struct prom_args {
964 -       char *service;
965 -       int nargs;
966 -       int nret;
967 -       unsigned int virt;
968 -       unsigned int size;
969 -       unsigned int align;
970 -       void *ret;
971 -    } args;
972 -
973 -    args.service = "claim";
974 -    args.nargs = 3;
975 -    args.nret = 1;
976 -    args.virt = virt;
977 -    args.size = size;
978 -    args.align = align;
979 -    (*prom)(&args);
980 -    return args.ret;
981 -}
982 -
983  int
984  getprop(void *phandle, const char *name, void *buf, int buflen)
985  {
986 @@ -203,7 +161,9 @@
987  {
988      char ch = c;
989  
990 -    return writestring(f, &ch, 1) == 1? c: -1;
991 +    if (c == '\n')
992 +       putc('\r', f);
993 +    return write(f, &ch, 1) == 1? c: -1;
994  }
995  
996  int
997 @@ -217,7 +177,7 @@
998  {
999      int n = strlen(str);
1000  
1001 -    return writestring(f, str, n) == n? 0: -1;
1002 +    return write(f, str, n) == n? 0: -1;
1003  }
1004  
1005  int
1006 @@ -230,7 +190,7 @@
1007         case 1:
1008             return ch;
1009         case -1:
1010 -           printk("read(stdin) returned -1\n");
1011 +           printk("read(stdin) returned -1\r\n");
1012             return -1;
1013         }
1014      }
1015 @@ -304,7 +264,7 @@
1016         va_start(args, fmt);
1017         n = vsprintf(sprint_buf, fmt, args);
1018         va_end(args);
1019 -       writestring(stdout, sprint_buf, n);
1020 +       write(stdout, sprint_buf, n);
1021  }
1022  
1023  int
1024 @@ -316,6 +276,6 @@
1025         va_start(args, fmt);
1026         n = vsprintf(sprint_buf, fmt, args);
1027         va_end(args);
1028 -       writestring(stdout, sprint_buf, n);
1029 +       write(stdout, sprint_buf, n);
1030         return n;
1031  }
1032 diff -urN linux.orig/arch/ppc/common_defconfig linux/arch/ppc/common_defconfig
1033 --- linux.orig/arch/ppc/common_defconfig        Sun Mar 25 18:31:50 2001
1034 +++ linux/arch/ppc/common_defconfig     Thu Jul 11 15:43:29 2002
1035 @@ -1,5 +1,5 @@
1036  #
1037 -# Automatically generated make config: don't edit
1038 +# Automatically generated by make menuconfig: don't edit
1039  #
1040  
1041  #
1042 @@ -16,7 +16,6 @@
1043  # CONFIG_GEMINI is not set
1044  # CONFIG_MBX is not set
1045  # CONFIG_SMP is not set
1046 -CONFIG_ALTIVEC=y
1047  CONFIG_6xx=y
1048  
1049  #
1050 @@ -24,7 +23,7 @@
1051  #
1052  CONFIG_EXPERIMENTAL=y
1053  CONFIG_MODULES=y
1054 -# CONFIG_MODVERSIONS is not set
1055 +CONFIG_MODVERSIONS=y
1056  CONFIG_KMOD=y
1057  CONFIG_PCI=y
1058  # CONFIG_PCI_QUIRKS is not set
1059 @@ -35,17 +34,17 @@
1060  # CONFIG_BSD_PROCESS_ACCT is not set
1061  CONFIG_BINFMT_ELF=y
1062  CONFIG_KERNEL_ELF=y
1063 -CONFIG_BINFMT_MISC=y
1064 +# CONFIG_BINFMT_MISC is not set
1065  # CONFIG_BINFMT_JAVA is not set
1066 -CONFIG_PARPORT=m
1067 -# CONFIG_PARPORT_PC is not set
1068 +# CONFIG_PARPORT is not set
1069  CONFIG_VGA_CONSOLE=y
1070  CONFIG_FB=y
1071 +CONFIG_FB_COMPAT_XPMAC=y
1072  CONFIG_PMAC_PBOOK=y
1073  CONFIG_MAC_KEYBOARD=y
1074  CONFIG_MAC_FLOPPY=y
1075  CONFIG_MAC_SERIAL=y
1076 -# CONFIG_PPC_RTC is not set
1077 +# CONFIG_SERIAL_CONSOLE is not set
1078  CONFIG_ADBMOUSE=y
1079  CONFIG_PROC_DEVICETREE=y
1080  # CONFIG_TOTALMP is not set
1081 @@ -63,10 +62,6 @@
1082  #
1083  CONFIG_BLK_DEV_FD=y
1084  CONFIG_BLK_DEV_IDE=y
1085 -
1086 -#
1087 -# Please see Documentation/ide.txt for help/info on IDE drives
1088 -#
1089  # CONFIG_BLK_DEV_HD_IDE is not set
1090  CONFIG_BLK_DEV_IDEDISK=y
1091  CONFIG_BLK_DEV_IDECD=y
1092 @@ -75,35 +70,21 @@
1093  # CONFIG_BLK_DEV_IDESCSI is not set
1094  # CONFIG_BLK_DEV_CMD640 is not set
1095  # CONFIG_BLK_DEV_RZ1000 is not set
1096 -CONFIG_BLK_DEV_IDEPCI=y
1097 -CONFIG_BLK_DEV_IDEDMA=y
1098 -# CONFIG_BLK_DEV_OFFBOARD is not set
1099 -CONFIG_IDEDMA_AUTO=y
1100 -# CONFIG_BLK_DEV_OPTI621 is not set
1101 -# CONFIG_BLK_DEV_TRM290 is not set
1102 -# CONFIG_BLK_DEV_NS87415 is not set
1103 -# CONFIG_BLK_DEV_VIA82C586 is not set
1104 -CONFIG_BLK_DEV_CMD646=y
1105 -# CONFIG_BLK_DEV_CS5530 is not set
1106 -# CONFIG_BLK_DEV_SL82C105 is not set
1107 +# CONFIG_BLK_DEV_IDEPCI is not set
1108 +CONFIG_BLK_DEV_SL82C105=y
1109  CONFIG_BLK_DEV_IDE_PMAC=y
1110  CONFIG_BLK_DEV_IDEDMA_PMAC=y
1111  CONFIG_BLK_DEV_IDEDMA=y
1112  CONFIG_PMAC_IDEDMA_AUTO=y
1113  # CONFIG_IDE_CHIPSETS is not set
1114 -
1115 -#
1116 -# Additional Block Devices
1117 -#
1118  CONFIG_BLK_DEV_LOOP=y
1119  # CONFIG_BLK_DEV_NBD is not set
1120  # CONFIG_BLK_DEV_MD is not set
1121  CONFIG_BLK_DEV_RAM=y
1122 -CONFIG_BLK_DEV_RAM_SIZE=4096
1123  CONFIG_BLK_DEV_INITRD=y
1124  # CONFIG_BLK_DEV_XD is not set
1125  # CONFIG_BLK_DEV_DAC960 is not set
1126 -CONFIG_PARIDE_PARPORT=m
1127 +CONFIG_PARIDE_PARPORT=y
1128  # CONFIG_PARIDE is not set
1129  # CONFIG_BLK_CPQ_DA is not set
1130  # CONFIG_BLK_DEV_HD is not set
1131 @@ -115,44 +96,22 @@
1132  CONFIG_NETLINK=y
1133  # CONFIG_RTNETLINK is not set
1134  # CONFIG_NETLINK_DEV is not set
1135 -CONFIG_FIREWALL=y
1136 +# CONFIG_FIREWALL is not set
1137  # CONFIG_FILTER is not set
1138  CONFIG_UNIX=y
1139  CONFIG_INET=y
1140  CONFIG_IP_MULTICAST=y
1141  # CONFIG_IP_ADVANCED_ROUTER is not set
1142  # CONFIG_IP_PNP is not set
1143 -CONFIG_IP_FIREWALL=y
1144 -# CONFIG_IP_FIREWALL_NETLINK is not set
1145 -CONFIG_IP_TRANSPARENT_PROXY=y
1146 -CONFIG_IP_MASQUERADE=y
1147 -
1148 -#
1149 -# Protocol-specific masquerading support will be built as modules.
1150 -#
1151 -# CONFIG_IP_MASQUERADE_ICMP is not set
1152 -
1153 -#
1154 -# Protocol-specific masquerading support will be built as modules.
1155 -#
1156 -# CONFIG_IP_MASQUERADE_MOD is not set
1157  # CONFIG_IP_ROUTER is not set
1158  # CONFIG_NET_IPIP is not set
1159  # CONFIG_NET_IPGRE is not set
1160  # CONFIG_IP_MROUTE is not set
1161  CONFIG_IP_ALIAS=y
1162  CONFIG_SYN_COOKIES=y
1163 -
1164 -#
1165 -# (it is safe to leave these untouched)
1166 -#
1167  CONFIG_INET_RARP=y
1168  CONFIG_SKB_LARGE=y
1169  # CONFIG_IPV6 is not set
1170 -
1171 -#
1172 -#  
1173 -#
1174  # CONFIG_IPX is not set
1175  CONFIG_ATALK=m
1176  # CONFIG_X25 is not set
1177 @@ -174,19 +133,11 @@
1178  # SCSI support
1179  #
1180  CONFIG_SCSI=y
1181 -
1182 -#
1183 -# SCSI support type (disk, tape, CD-ROM)
1184 -#
1185  CONFIG_BLK_DEV_SD=y
1186  CONFIG_CHR_DEV_ST=y
1187  CONFIG_BLK_DEV_SR=y
1188  CONFIG_BLK_DEV_SR_VENDOR=y
1189 -# CONFIG_CHR_DEV_SG is not set
1190 -
1191 -#
1192 -# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
1193 -#
1194 +CONFIG_CHR_DEV_SG=y
1195  # CONFIG_SCSI_MULTI_LUN is not set
1196  CONFIG_SCSI_CONSTANTS=y
1197  # CONFIG_SCSI_LOGGING is not set
1198 @@ -194,7 +145,6 @@
1199  #
1200  # SCSI low-level drivers
1201  #
1202 -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
1203  # CONFIG_SCSI_7000FASST is not set
1204  # CONFIG_SCSI_ACARD is not set
1205  # CONFIG_SCSI_AHA152X is not set
1206 @@ -220,13 +170,11 @@
1207  # CONFIG_SCSI_GENERIC_NCR5380 is not set
1208  # CONFIG_SCSI_INITIO is not set
1209  # CONFIG_SCSI_INIA100 is not set
1210 -# CONFIG_SCSI_PPA is not set
1211 -# CONFIG_SCSI_IMM is not set
1212  # CONFIG_SCSI_NCR53C406A is not set
1213  # CONFIG_SCSI_SYM53C416 is not set
1214  # CONFIG_SCSI_SIM710 is not set
1215  # CONFIG_SCSI_NCR53C7xx is not set
1216 -CONFIG_SCSI_NCR53C8XX=y
1217 +# CONFIG_SCSI_NCR53C8XX is not set
1218  CONFIG_SCSI_SYM53C8XX=y
1219  CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS=8
1220  CONFIG_SCSI_NCR53C8XX_MAX_TAGS=32
1221 @@ -234,7 +182,7 @@
1222  # CONFIG_SCSI_NCR53C8XX_PROFILE is not set
1223  # CONFIG_SCSI_NCR53C8XX_IOMAPPED is not set
1224  # CONFIG_SCSI_NCR53C8XX_PQS_PDS is not set
1225 -CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT=y
1226 +# CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT is not set
1227  # CONFIG_SCSI_PAS16 is not set
1228  # CONFIG_SCSI_PCI2000 is not set
1229  # CONFIG_SCSI_PCI2220I is not set
1230 @@ -262,7 +210,6 @@
1231  #
1232  # CONFIG_ARCNET is not set
1233  # CONFIG_DUMMY is not set
1234 -# CONFIG_BONDING is not set
1235  # CONFIG_EQUALIZER is not set
1236  # CONFIG_ETHERTAP is not set
1237  # CONFIG_NET_SB1000 is not set
1238 @@ -272,25 +219,24 @@
1239  #
1240  CONFIG_NET_ETHERNET=y
1241  CONFIG_MACE=y
1242 -# CONFIG_MACE_AAUI_PORT is not set
1243  CONFIG_BMAC=y
1244 -CONFIG_GMAC=y
1245  # CONFIG_NCR885E is not set
1246  # CONFIG_NET_VENDOR_3COM is not set
1247  # CONFIG_LANCE is not set
1248  # CONFIG_NET_VENDOR_SMC is not set
1249  # CONFIG_NET_VENDOR_RACAL is not set
1250  # CONFIG_RTL8139 is not set
1251 +# CONFIG_YELLOWFIN is not set
1252  # CONFIG_NET_ISA is not set
1253  CONFIG_NET_EISA=y
1254  CONFIG_PCNET32=y
1255 +# CONFIG_ACENIC is not set
1256  # CONFIG_AC3200 is not set
1257  # CONFIG_APRICOT is not set
1258  # CONFIG_CS89x0 is not set
1259  # CONFIG_DM9102 is not set
1260  CONFIG_DE4X5=y
1261  # CONFIG_DEC_ELCP is not set
1262 -# CONFIG_DEC_ELCP_OLD is not set
1263  # CONFIG_DGRS is not set
1264  # CONFIG_EEXPRESS_PRO100 is not set
1265  # CONFIG_LNE390 is not set
1266 @@ -303,14 +249,6 @@
1267  # CONFIG_EPIC100 is not set
1268  # CONFIG_ZNET is not set
1269  # CONFIG_NET_POCKET is not set
1270 -
1271 -#
1272 -# Ethernet (1000 Mbit)
1273 -#
1274 -# CONFIG_ACENIC is not set
1275 -# CONFIG_HAMACHI is not set
1276 -# CONFIG_YELLOWFIN is not set
1277 -# CONFIG_SK98LIN is not set
1278  # CONFIG_FDDI is not set
1279  # CONFIG_HIPPI is not set
1280  
1281 @@ -320,12 +258,7 @@
1282  # CONFIG_LTPC is not set
1283  # CONFIG_COPS is not set
1284  # CONFIG_IPDDP is not set
1285 -# CONFIG_PLIP is not set
1286  CONFIG_PPP=y
1287 -
1288 -#
1289 -# CCP compressors for PPP are only built as modules.
1290 -#
1291  # CONFIG_SLIP is not set
1292  # CONFIG_NET_RADIO is not set
1293  
1294 @@ -343,10 +276,7 @@
1295  # CONFIG_HOSTESS_SV11 is not set
1296  # CONFIG_COSA is not set
1297  # CONFIG_SEALEVEL_4021 is not set
1298 -# CONFIG_SYNCLINK_SYNCPPP is not set
1299 -# CONFIG_LANMEDIA is not set
1300  # CONFIG_COMX is not set
1301 -# CONFIG_HDLC is not set
1302  # CONFIG_DLCI is not set
1303  # CONFIG_SBNI is not set
1304  
1305 @@ -356,11 +286,6 @@
1306  # CONFIG_HAMRADIO is not set
1307  
1308  #
1309 -# IrDA (infrared) support
1310 -#
1311 -# CONFIG_IRDA is not set
1312 -
1313 -#
1314  # ISDN subsystem
1315  #
1316  # CONFIG_ISDN is not set
1317 @@ -375,7 +300,6 @@
1318  #
1319  CONFIG_DUMMY_CONSOLE=y
1320  # CONFIG_FB_PM2 is not set
1321 -CONFIG_FB_ATY=y
1322  CONFIG_FB_OF=y
1323  CONFIG_FB_CONTROL=y
1324  CONFIG_FB_PLATINUM=y
1325 @@ -383,12 +307,12 @@
1326  CONFIG_FB_IMSTT=y
1327  CONFIG_FB_CT65550=y
1328  # CONFIG_FB_S3TRIO is not set
1329 -CONFIG_FB_COMPAT_XPMAC=y
1330  CONFIG_FB_MATROX=y
1331 -CONFIG_FB_MATROX_MILLENIUM=y
1332 +# CONFIG_FB_MATROX_MILLENIUM is not set
1333  CONFIG_FB_MATROX_MYSTIQUE=y
1334  CONFIG_FB_MATROX_G100=y
1335 -CONFIG_FB_MATROX_MULTIHEAD=y
1336 +# CONFIG_FB_MATROX_MULTIHEAD is not set
1337 +CONFIG_FB_ATY=y
1338  # CONFIG_FB_VIRTUAL is not set
1339  # CONFIG_FBCON_ADVANCED is not set
1340  CONFIG_FBCON_CFB8=y
1341 @@ -415,7 +339,6 @@
1342  # CONFIG_SERIAL_NONSTANDARD is not set
1343  CONFIG_UNIX98_PTYS=y
1344  CONFIG_UNIX98_PTY_COUNT=256
1345 -# CONFIG_PRINTER is not set
1346  CONFIG_MOUSE=y
1347  
1348  #
1349 @@ -427,11 +350,6 @@
1350  CONFIG_PSMOUSE=y
1351  # CONFIG_82C710_MOUSE is not set
1352  # CONFIG_PC110_PAD is not set
1353 -
1354 -#
1355 -# Joysticks
1356 -#
1357 -# CONFIG_JOYSTICK is not set
1358  # CONFIG_QIC02_TAPE is not set
1359  # CONFIG_WATCHDOG is not set
1360  CONFIG_NVRAM=y
1361 @@ -441,16 +359,20 @@
1362  # Video For Linux
1363  #
1364  # CONFIG_VIDEO_DEV is not set
1365 +
1366 +#
1367 +# Joystick support
1368 +#
1369 +# CONFIG_JOYSTICK is not set
1370  # CONFIG_DTLK is not set
1371  
1372  #
1373  # Ftape, the floppy tape device driver
1374  #
1375  # CONFIG_FTAPE is not set
1376 -# CONFIG_TOSHIBA is not set
1377  
1378  #
1379 -# Support for USB
1380 +# USB drivers - not for the faint of heart
1381  #
1382  # CONFIG_USB is not set
1383  
1384 @@ -462,10 +384,10 @@
1385  # CONFIG_ADFS_FS is not set
1386  # CONFIG_AFFS_FS is not set
1387  CONFIG_HFS_FS=y
1388 -CONFIG_FAT_FS=m
1389 -CONFIG_MSDOS_FS=m
1390 +CONFIG_FAT_FS=y
1391 +CONFIG_MSDOS_FS=y
1392  # CONFIG_UMSDOS_FS is not set
1393 -CONFIG_VFAT_FS=m
1394 +CONFIG_VFAT_FS=y
1395  CONFIG_ISO9660_FS=y
1396  # CONFIG_JOLIET is not set
1397  # CONFIG_MINIX_FS is not set
1398 @@ -505,7 +427,6 @@
1399  #
1400  # Native Language Support
1401  #
1402 -CONFIG_NLS_DEFAULT="cp437"
1403  CONFIG_NLS_CODEPAGE_437=y
1404  # CONFIG_NLS_CODEPAGE_737 is not set
1405  # CONFIG_NLS_CODEPAGE_775 is not set
1406 @@ -522,10 +443,6 @@
1407  # CONFIG_NLS_CODEPAGE_866 is not set
1408  # CONFIG_NLS_CODEPAGE_869 is not set
1409  # CONFIG_NLS_CODEPAGE_874 is not set
1410 -# CONFIG_NLS_CODEPAGE_932 is not set
1411 -# CONFIG_NLS_CODEPAGE_936 is not set
1412 -# CONFIG_NLS_CODEPAGE_949 is not set
1413 -# CONFIG_NLS_CODEPAGE_950 is not set
1414  # CONFIG_NLS_ISO8859_1 is not set
1415  # CONFIG_NLS_ISO8859_2 is not set
1416  # CONFIG_NLS_ISO8859_3 is not set
1417 @@ -536,17 +453,55 @@
1418  # CONFIG_NLS_ISO8859_8 is not set
1419  # CONFIG_NLS_ISO8859_9 is not set
1420  # CONFIG_NLS_ISO8859_14 is not set
1421 -CONFIG_NLS_ISO8859_15=y
1422 +# CONFIG_NLS_ISO8859_15 is not set
1423  # CONFIG_NLS_KOI8_R is not set
1424  
1425  #
1426  # Sound
1427  #
1428 -# CONFIG_SOUND is not set
1429 +CONFIG_SOUND=y
1430 +CONFIG_DMASOUND=y
1431 +# CONFIG_SOUND_CMPCI is not set
1432 +# CONFIG_SOUND_ES1370 is not set
1433 +# CONFIG_SOUND_ES1371 is not set
1434 +# CONFIG_SOUND_MAESTRO is not set
1435 +# CONFIG_SOUND_ESSSOLO1 is not set
1436 +# CONFIG_SOUND_SONICVIBES is not set
1437 +# CONFIG_SOUND_MSNDCLAS is not set
1438 +# CONFIG_SOUND_MSNDPIN is not set
1439 +CONFIG_SOUND_OSS=y
1440 +# CONFIG_SOUND_DMAP is not set
1441 +# CONFIG_SOUND_PAS is not set
1442 +# CONFIG_SOUND_SB is not set
1443 +# CONFIG_SOUND_GUS is not set
1444 +# CONFIG_SOUND_MPU401 is not set
1445 +# CONFIG_SOUND_PSS is not set
1446 +# CONFIG_SOUND_MSS is not set
1447 +# CONFIG_SOUND_SSCAPE is not set
1448 +# CONFIG_SOUND_TRIX is not set
1449 +# CONFIG_SOUND_VIA82CXXX is not set
1450 +# CONFIG_SOUND_MAD16 is not set
1451 +# CONFIG_SOUND_WAVEFRONT is not set
1452 +CONFIG_SOUND_CS4232=m
1453 +# CONFIG_SOUND_OPL3SA2 is not set
1454 +# CONFIG_SOUND_MAUI is not set
1455 +# CONFIG_SOUND_SGALAXY is not set
1456 +# CONFIG_SOUND_AD1816 is not set
1457 +# CONFIG_SOUND_OPL3SA1 is not set
1458 +# CONFIG_SOUND_SOFTOSS is not set
1459 +# CONFIG_SOUND_YM3812 is not set
1460 +# CONFIG_SOUND_VMIDI is not set
1461 +# CONFIG_SOUND_UART6850 is not set
1462 +# CONFIG_SOUND_NM256 is not set
1463 +
1464 +#
1465 +# Additional low level sound drivers
1466 +#
1467 +# CONFIG_LOWLEVEL_SOUND is not set
1468  
1469  #
1470  # Kernel hacking
1471  #
1472 -CONFIG_MAGIC_SYSRQ=y
1473 +# CONFIG_MAGIC_SYSRQ is not set
1474  # CONFIG_KGDB is not set
1475  # CONFIG_XMON is not set
1476 diff -urN linux.orig/arch/ppc/config.in linux/arch/ppc/config.in
1477 --- linux.orig/arch/ppc/config.in       Fri Nov  2 17:39:05 2001
1478 +++ linux/arch/ppc/config.in    Thu Jul 11 15:43:29 2002
1479 @@ -22,10 +22,6 @@
1480  
1481  bool 'Symmetric multi-processing support' CONFIG_SMP
1482  
1483 -if [ "$CONFIG_6xx" = "y" ]; then
1484 -  bool 'Altivec (G4) support' CONFIG_ALTIVEC
1485 -fi
1486 -
1487  if [ "$CONFIG_ALL_PPC" != "y" ]; then
1488    define_bool CONFIG_MACH_SPECIFIC y
1489  fi
1490 diff -urN linux.orig/arch/ppc/defconfig linux/arch/ppc/defconfig
1491 --- linux.orig/arch/ppc/defconfig       Sun Mar 25 18:31:49 2001
1492 +++ linux/arch/ppc/defconfig    Thu Jul 11 15:43:29 2002
1493 @@ -1,5 +1,5 @@
1494  #
1495 -# Automatically generated make config: don't edit
1496 +# Automatically generated by make menuconfig: don't edit
1497  #
1498  
1499  #
1500 @@ -7,16 +7,15 @@
1501  #
1502  CONFIG_PPC=y
1503  CONFIG_6xx=y
1504 -# CONFIG_PPC64 is not set
1505  # CONFIG_8xx is not set
1506 -CONFIG_PMAC=y
1507 +# CONFIG_PMAC is not set
1508  # CONFIG_PREP is not set
1509  # CONFIG_CHRP is not set
1510 -# CONFIG_ALL_PPC is not set
1511 +CONFIG_ALL_PPC=y
1512  # CONFIG_APUS is not set
1513 +# CONFIG_GEMINI is not set
1514  # CONFIG_MBX is not set
1515  # CONFIG_SMP is not set
1516 -CONFIG_MACH_SPECIFIC=y
1517  CONFIG_6xx=y
1518  
1519  #
1520 @@ -24,7 +23,7 @@
1521  #
1522  CONFIG_EXPERIMENTAL=y
1523  CONFIG_MODULES=y
1524 -# CONFIG_MODVERSIONS is not set
1525 +CONFIG_MODVERSIONS=y
1526  CONFIG_KMOD=y
1527  CONFIG_PCI=y
1528  # CONFIG_PCI_QUIRKS is not set
1529 @@ -35,11 +34,10 @@
1530  # CONFIG_BSD_PROCESS_ACCT is not set
1531  CONFIG_BINFMT_ELF=y
1532  CONFIG_KERNEL_ELF=y
1533 -CONFIG_BINFMT_MISC=m
1534 +# CONFIG_BINFMT_MISC is not set
1535  # CONFIG_BINFMT_JAVA is not set
1536 -CONFIG_PARPORT=m
1537 -# CONFIG_PARPORT_PC is not set
1538 -# CONFIG_VGA_CONSOLE is not set
1539 +# CONFIG_PARPORT is not set
1540 +CONFIG_VGA_CONSOLE=y
1541  CONFIG_FB=y
1542  CONFIG_FB_COMPAT_XPMAC=y
1543  CONFIG_PMAC_PBOOK=y
1544 @@ -52,6 +50,7 @@
1545  # CONFIG_TOTALMP is not set
1546  CONFIG_BOOTX_TEXT=y
1547  # CONFIG_MOTOROLA_HOTSWAP is not set
1548 +# CONFIG_CMDLINE_BOOL is not set
1549  
1550  #
1551  # Plug and Play support
1552 @@ -61,12 +60,8 @@
1553  #
1554  # Block devices
1555  #
1556 -# CONFIG_BLK_DEV_FD is not set
1557 +CONFIG_BLK_DEV_FD=y
1558  CONFIG_BLK_DEV_IDE=y
1559 -
1560 -#
1561 -# Please see Documentation/ide.txt for help/info on IDE drives
1562 -#
1563  # CONFIG_BLK_DEV_HD_IDE is not set
1564  CONFIG_BLK_DEV_IDEDISK=y
1565  CONFIG_BLK_DEV_IDECD=y
1566 @@ -75,25 +70,13 @@
1567  # CONFIG_BLK_DEV_IDESCSI is not set
1568  # CONFIG_BLK_DEV_CMD640 is not set
1569  # CONFIG_BLK_DEV_RZ1000 is not set
1570 -CONFIG_BLK_DEV_IDEPCI=y
1571 -CONFIG_BLK_DEV_IDEDMA=y
1572 -# CONFIG_BLK_DEV_OFFBOARD is not set
1573 -CONFIG_IDEDMA_AUTO=y
1574 -# CONFIG_BLK_DEV_OPTI621 is not set
1575 -# CONFIG_BLK_DEV_TRM290 is not set
1576 -# CONFIG_BLK_DEV_NS87415 is not set
1577 -# CONFIG_BLK_DEV_VIA82C586 is not set
1578 -CONFIG_BLK_DEV_CMD646=y
1579 -# CONFIG_BLK_DEV_SL82C105 is not set
1580 +# CONFIG_BLK_DEV_IDEPCI is not set
1581 +CONFIG_BLK_DEV_SL82C105=y
1582  CONFIG_BLK_DEV_IDE_PMAC=y
1583  CONFIG_BLK_DEV_IDEDMA_PMAC=y
1584  CONFIG_BLK_DEV_IDEDMA=y
1585  CONFIG_PMAC_IDEDMA_AUTO=y
1586  # CONFIG_IDE_CHIPSETS is not set
1587 -
1588 -#
1589 -# Additional Block Devices
1590 -#
1591  CONFIG_BLK_DEV_LOOP=y
1592  # CONFIG_BLK_DEV_NBD is not set
1593  # CONFIG_BLK_DEV_MD is not set
1594 @@ -101,7 +84,7 @@
1595  CONFIG_BLK_DEV_INITRD=y
1596  # CONFIG_BLK_DEV_XD is not set
1597  # CONFIG_BLK_DEV_DAC960 is not set
1598 -CONFIG_PARIDE_PARPORT=m
1599 +CONFIG_PARIDE_PARPORT=y
1600  # CONFIG_PARIDE is not set
1601  # CONFIG_BLK_CPQ_DA is not set
1602  # CONFIG_BLK_DEV_HD is not set
1603 @@ -125,18 +108,10 @@
1604  # CONFIG_NET_IPGRE is not set
1605  # CONFIG_IP_MROUTE is not set
1606  CONFIG_IP_ALIAS=y
1607 -# CONFIG_SYN_COOKIES is not set
1608 -
1609 -#
1610 -# (it is safe to leave these untouched)
1611 -#
1612 +CONFIG_SYN_COOKIES=y
1613  CONFIG_INET_RARP=y
1614  CONFIG_SKB_LARGE=y
1615  # CONFIG_IPV6 is not set
1616 -
1617 -#
1618 -#  
1619 -#
1620  # CONFIG_IPX is not set
1621  CONFIG_ATALK=m
1622  # CONFIG_X25 is not set
1623 @@ -158,19 +133,11 @@
1624  # SCSI support
1625  #
1626  CONFIG_SCSI=y
1627 -
1628 -#
1629 -# SCSI support type (disk, tape, CD-ROM)
1630 -#
1631  CONFIG_BLK_DEV_SD=y
1632  CONFIG_CHR_DEV_ST=y
1633  CONFIG_BLK_DEV_SR=y
1634  CONFIG_BLK_DEV_SR_VENDOR=y
1635 -# CONFIG_CHR_DEV_SG is not set
1636 -
1637 -#
1638 -# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
1639 -#
1640 +CONFIG_CHR_DEV_SG=y
1641  # CONFIG_SCSI_MULTI_LUN is not set
1642  CONFIG_SCSI_CONSTANTS=y
1643  # CONFIG_SCSI_LOGGING is not set
1644 @@ -188,6 +155,7 @@
1645  CONFIG_AIC7XXX_CMDS_PER_DEVICE=8
1646  CONFIG_AIC7XXX_PROC_STATS=y
1647  CONFIG_AIC7XXX_RESET_DELAY=15
1648 +# CONFIG_SCSI_IPS is not set
1649  # CONFIG_SCSI_ADVANSYS is not set
1650  # CONFIG_SCSI_IN2000 is not set
1651  # CONFIG_SCSI_AM53C974 is not set
1652 @@ -202,12 +170,11 @@
1653  # CONFIG_SCSI_GENERIC_NCR5380 is not set
1654  # CONFIG_SCSI_INITIO is not set
1655  # CONFIG_SCSI_INIA100 is not set
1656 -# CONFIG_SCSI_PPA is not set
1657 -# CONFIG_SCSI_IMM is not set
1658  # CONFIG_SCSI_NCR53C406A is not set
1659  # CONFIG_SCSI_SYM53C416 is not set
1660 +# CONFIG_SCSI_SIM710 is not set
1661  # CONFIG_SCSI_NCR53C7xx is not set
1662 -CONFIG_SCSI_NCR53C8XX=y
1663 +# CONFIG_SCSI_NCR53C8XX is not set
1664  CONFIG_SCSI_SYM53C8XX=y
1665  CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS=8
1666  CONFIG_SCSI_NCR53C8XX_MAX_TAGS=32
1667 @@ -215,7 +182,7 @@
1668  # CONFIG_SCSI_NCR53C8XX_PROFILE is not set
1669  # CONFIG_SCSI_NCR53C8XX_IOMAPPED is not set
1670  # CONFIG_SCSI_NCR53C8XX_PQS_PDS is not set
1671 -CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT=y
1672 +# CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT is not set
1673  # CONFIG_SCSI_PAS16 is not set
1674  # CONFIG_SCSI_PCI2000 is not set
1675  # CONFIG_SCSI_PCI2220I is not set
1676 @@ -253,21 +220,21 @@
1677  CONFIG_NET_ETHERNET=y
1678  CONFIG_MACE=y
1679  CONFIG_BMAC=y
1680 -CONFIG_GMAC=y
1681 +# CONFIG_NCR885E is not set
1682  # CONFIG_NET_VENDOR_3COM is not set
1683  # CONFIG_LANCE is not set
1684  # CONFIG_NET_VENDOR_SMC is not set
1685  # CONFIG_NET_VENDOR_RACAL is not set
1686  # CONFIG_RTL8139 is not set
1687 -# CONFIG_SIS900 is not set
1688  # CONFIG_YELLOWFIN is not set
1689  # CONFIG_NET_ISA is not set
1690  CONFIG_NET_EISA=y
1691 -# CONFIG_PCNET32 is not set
1692 +CONFIG_PCNET32=y
1693  # CONFIG_ACENIC is not set
1694  # CONFIG_AC3200 is not set
1695  # CONFIG_APRICOT is not set
1696  # CONFIG_CS89x0 is not set
1697 +# CONFIG_DM9102 is not set
1698  CONFIG_DE4X5=y
1699  # CONFIG_DEC_ELCP is not set
1700  # CONFIG_DGRS is not set
1701 @@ -277,6 +244,7 @@
1702  # CONFIG_NE2K_PCI is not set
1703  # CONFIG_TLAN is not set
1704  # CONFIG_VIA_RHINE is not set
1705 +# CONFIG_SIS900 is not set
1706  # CONFIG_ES3210 is not set
1707  # CONFIG_EPIC100 is not set
1708  # CONFIG_ZNET is not set
1709 @@ -290,12 +258,7 @@
1710  # CONFIG_LTPC is not set
1711  # CONFIG_COPS is not set
1712  # CONFIG_IPDDP is not set
1713 -# CONFIG_PLIP is not set
1714  CONFIG_PPP=y
1715 -
1716 -#
1717 -# CCP compressors for PPP are only built as modules.
1718 -#
1719  # CONFIG_SLIP is not set
1720  # CONFIG_NET_RADIO is not set
1721  
1722 @@ -313,7 +276,9 @@
1723  # CONFIG_HOSTESS_SV11 is not set
1724  # CONFIG_COSA is not set
1725  # CONFIG_SEALEVEL_4021 is not set
1726 +# CONFIG_COMX is not set
1727  # CONFIG_DLCI is not set
1728 +# CONFIG_SBNI is not set
1729  
1730  #
1731  # Amateur Radio support
1732 @@ -339,12 +304,14 @@
1733  CONFIG_FB_CONTROL=y
1734  CONFIG_FB_PLATINUM=y
1735  CONFIG_FB_VALKYRIE=y
1736 -CONFIG_FB_ATY=y
1737 -CONFIG_FB_ATY128=y
1738  CONFIG_FB_IMSTT=y
1739  CONFIG_FB_CT65550=y
1740  # CONFIG_FB_S3TRIO is not set
1741 -# CONFIG_FB_MATROX is not set
1742 +CONFIG_FB_MATROX=y
1743 +# CONFIG_FB_MATROX_MILLENIUM is not set
1744 +CONFIG_FB_MATROX_MYSTIQUE=y
1745 +CONFIG_FB_MATROX_G100=y
1746 +# CONFIG_FB_MATROX_MULTIHEAD is not set
1747  CONFIG_FB_ATY=y
1748  # CONFIG_FB_VIRTUAL is not set
1749  # CONFIG_FBCON_ADVANCED is not set
1750 @@ -367,13 +334,22 @@
1751  #
1752  CONFIG_VT=y
1753  CONFIG_VT_CONSOLE=y
1754 -# CONFIG_SERIAL is not set
1755 +CONFIG_SERIAL=m
1756  # CONFIG_SERIAL_EXTENDED is not set
1757  # CONFIG_SERIAL_NONSTANDARD is not set
1758  CONFIG_UNIX98_PTYS=y
1759  CONFIG_UNIX98_PTY_COUNT=256
1760 -# CONFIG_PRINTER is not set
1761 -# CONFIG_MOUSE is not set
1762 +CONFIG_MOUSE=y
1763 +
1764 +#
1765 +# Mice
1766 +#
1767 +# CONFIG_ATIXL_BUSMOUSE is not set
1768 +# CONFIG_BUSMOUSE is not set
1769 +# CONFIG_MS_BUSMOUSE is not set
1770 +CONFIG_PSMOUSE=y
1771 +# CONFIG_82C710_MOUSE is not set
1772 +# CONFIG_PC110_PAD is not set
1773  # CONFIG_QIC02_TAPE is not set
1774  # CONFIG_WATCHDOG is not set
1775  CONFIG_NVRAM=y
1776 @@ -408,10 +384,10 @@
1777  # CONFIG_ADFS_FS is not set
1778  # CONFIG_AFFS_FS is not set
1779  CONFIG_HFS_FS=y
1780 -CONFIG_FAT_FS=m
1781 -CONFIG_MSDOS_FS=m
1782 +CONFIG_FAT_FS=y
1783 +CONFIG_MSDOS_FS=y
1784  # CONFIG_UMSDOS_FS is not set
1785 -CONFIG_VFAT_FS=m
1786 +CONFIG_VFAT_FS=y
1787  CONFIG_ISO9660_FS=y
1788  # CONFIG_JOLIET is not set
1789  # CONFIG_MINIX_FS is not set
1790 @@ -477,7 +453,7 @@
1791  # CONFIG_NLS_ISO8859_8 is not set
1792  # CONFIG_NLS_ISO8859_9 is not set
1793  # CONFIG_NLS_ISO8859_14 is not set
1794 -CONFIG_NLS_ISO8859_15=y
1795 +# CONFIG_NLS_ISO8859_15 is not set
1796  # CONFIG_NLS_KOI8_R is not set
1797  
1798  #
1799 @@ -485,13 +461,43 @@
1800  #
1801  CONFIG_SOUND=y
1802  CONFIG_DMASOUND=y
1803 +# CONFIG_SOUND_CMPCI is not set
1804  # CONFIG_SOUND_ES1370 is not set
1805  # CONFIG_SOUND_ES1371 is not set
1806 +# CONFIG_SOUND_MAESTRO is not set
1807  # CONFIG_SOUND_ESSSOLO1 is not set
1808  # CONFIG_SOUND_SONICVIBES is not set
1809  # CONFIG_SOUND_MSNDCLAS is not set
1810  # CONFIG_SOUND_MSNDPIN is not set
1811 -# CONFIG_SOUND_OSS is not set
1812 +CONFIG_SOUND_OSS=y
1813 +# CONFIG_SOUND_DMAP is not set
1814 +# CONFIG_SOUND_PAS is not set
1815 +# CONFIG_SOUND_SB is not set
1816 +# CONFIG_SOUND_GUS is not set
1817 +# CONFIG_SOUND_MPU401 is not set
1818 +# CONFIG_SOUND_PSS is not set
1819 +# CONFIG_SOUND_MSS is not set
1820 +# CONFIG_SOUND_SSCAPE is not set
1821 +# CONFIG_SOUND_TRIX is not set
1822 +# CONFIG_SOUND_VIA82CXXX is not set
1823 +# CONFIG_SOUND_MAD16 is not set
1824 +# CONFIG_SOUND_WAVEFRONT is not set
1825 +CONFIG_SOUND_CS4232=m
1826 +# CONFIG_SOUND_OPL3SA2 is not set
1827 +# CONFIG_SOUND_MAUI is not set
1828 +# CONFIG_SOUND_SGALAXY is not set
1829 +# CONFIG_SOUND_AD1816 is not set
1830 +# CONFIG_SOUND_OPL3SA1 is not set
1831 +# CONFIG_SOUND_SOFTOSS is not set
1832 +# CONFIG_SOUND_YM3812 is not set
1833 +# CONFIG_SOUND_VMIDI is not set
1834 +# CONFIG_SOUND_UART6850 is not set
1835 +# CONFIG_SOUND_NM256 is not set
1836 +
1837 +#
1838 +# Additional low level sound drivers
1839 +#
1840 +# CONFIG_LOWLEVEL_SOUND is not set
1841  
1842  #
1843  # Kernel hacking
1844 diff -urN linux.orig/arch/ppc/kernel/Makefile linux/arch/ppc/kernel/Makefile
1845 --- linux.orig/arch/ppc/kernel/Makefile Sun Mar 25 18:31:48 2001
1846 +++ linux/arch/ppc/kernel/Makefile      Thu Jul 11 15:43:29 2002
1847 @@ -7,13 +7,8 @@
1848  #
1849  # Note 2! The CFLAGS definitions are now in the main makefile...
1850  
1851 -# Once a gas that groks -mvec is generally available, we'll use it...
1852  .S.o:
1853 -#ifdef CONFIG_ALTIVEC
1854 -#      $(CC) $(CFLAGS) -D__ASSEMBLY__ -Wa,-mvec -c $< -o $*.o
1855 -#else
1856         $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $*.o
1857 -#endif
1858  
1859  O_TARGET := kernel.o
1860  OX_OBJS := ppc_ksyms.o setup.o
1861 @@ -36,40 +31,20 @@
1862  
1863  ifeq ($(CONFIG_MBX),y)
1864  O_OBJS += mbx_setup.o mbx_pci.o softemu8xx.o i8259.o ppc8xx_pic.o
1865 -endif
1866 +else
1867  ifeq ($(CONFIG_APUS),y)
1868  O_OBJS += apus_setup.o prom.o openpic.o
1869 +else
1870 +ifneq ($(CONFIG_MBX),y)
1871 +O_OBJS += prep_time.o pmac_time.o chrp_time.o \
1872 +         pmac_setup.o pmac_support.o \
1873 +         prep_pci.o pmac_pci.o chrp_pci.o \
1874 +         residual.o prom.o openpic.o feature.o \
1875 +         prep_nvram.o open_pic.o i8259.o pmac_pic.o indirect_pci.o \
1876 +         gemini_pci.o gemini_prom.o gemini_setup.o
1877 +OX_OBJS += chrp_setup.o prep_setup.o
1878 +endif
1879  endif
1880 -
1881 -PMAC_OBJS = pmac_time.o pmac_setup.o pmac_support.o pmac_pci.o pmac_pic.o \
1882 -       feature.o openpic.o open_pic.o prom.o
1883 -CHRP_OBJS = $(PMAC_OBJS) chrp_time.o chrp_pci.o i8259.o indirect_pci.o
1884 -CHRPX_OBJS = chrp_setup.o
1885 -PREP_OBJS = prep_time.o prep_pci.o residual.o prep_nvram.o i8259.o \
1886 -       indirect_pci.o openpic.o open_pic.o prom.o
1887 -PREPX_OBJS = prep_setup.o
1888 -
1889 -ifeq ($(CONFIG_ALL_PPC),y)
1890 -O_OBJS += $(sort $(PMAC_OBJS) $(PREP_OBJS) $(CHRP_OBJS))
1891 -OX_OBJS += $(PMACX_OBJS) $(PREPX_OBJS) $(CHRPX_OBJS)
1892 -endif
1893 -ifeq ($(CONFIG_PMAC),y)
1894 -O_OBJS += $(PMAC_OBJS)
1895 -OX_OBJS += $(PMACX_OBJS)
1896 -endif
1897 -ifeq ($(CONFIG_PREP),y)
1898 -O_OBJS += $(PREP_OBJS)
1899 -OX_OBJS += $(PREPX_OBJS)
1900 -endif
1901 -ifeq ($(CONFIG_CHRP),y)
1902 -O_OBJS += $(CHRP_OBJS)
1903 -OX_OBJS += $(CHRPX_OBJS)
1904 -endif
1905 -
1906 -GEMINI_OBJS = $(PREP_OBJS) gemini_pci.o gemini_prom.o gemini_setup.o
1907 -ifeq ($(CONFIG_GEMINI),y)
1908 -O_OBJS += $(GEMINI_OBJS)
1909 -OX_OBJS += $(PREPX_OBJS)
1910  endif
1911  
1912  ifdef CONFIG_SMP
1913 @@ -87,15 +62,14 @@
1914                 $(TOPDIR)/include/asm/ptrace.h
1915         $(CC) ${CFLAGS} -S mk_defs.c
1916         cp ppc_defs.head ppc_defs.h
1917 -       chmod 755 ppc_defs.h
1918 -       grep '^#define' mk_defs.s >> ppc_defs.h
1919 +       grep '^#define' mk_defs.s >>ppc_defs.h
1920         rm mk_defs.s
1921  
1922  find_name : find_name.c
1923         $(HOSTCC) -o find_name find_name.c
1924  
1925  checks: checks.c
1926 -       $(HOSTCC) ${CFLAGS} -D__KERNEL__ -I../../../include -o checks checks.c
1927 +       $(HOSTCC) ${CFLAGS} -D__KERNEL__ -o checks checks.c
1928         ./checks
1929  
1930  include $(TOPDIR)/Rules.make
1931 diff -urN linux.orig/arch/ppc/kernel/apus_setup.c linux/arch/ppc/kernel/apus_setup.c
1932 --- linux.orig/arch/ppc/kernel/apus_setup.c     Sun Mar 25 18:31:49 2001
1933 +++ linux/arch/ppc/kernel/apus_setup.c  Thu Jul 11 15:43:29 2002
1934 @@ -42,7 +42,7 @@
1935  #include <asm/machdep.h>
1936  #include <asm/ide.h>
1937  
1938 -#include <asm/time.h>
1939 +#include "time.h"
1940  #include "local_irq.h"
1941  
1942  unsigned long apus_get_rtc_time(void);
1943 @@ -624,7 +624,7 @@
1944         ppc_md.kbd_unexpected_up = NULL;
1945         ppc_md.kbd_leds          = NULL;
1946         ppc_md.kbd_init_hw       = NULL;
1947 -       ppc_md.sysrq_xlate       = NULL;
1948 +       ppc_md.kbd_sysrq_xlate   = NULL;
1949  
1950  #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
1951          ppc_ide_md.insw = apus_ide_insw;
1952 diff -urN linux.orig/arch/ppc/kernel/checks.c linux/arch/ppc/kernel/checks.c
1953 --- linux.orig/arch/ppc/kernel/checks.c Sun Mar 25 18:31:48 2001
1954 +++ linux/arch/ppc/kernel/checks.c      Thu Jul 11 15:43:29 2002
1955 @@ -1,4 +1,3 @@
1956 -#include <linux/config.h>
1957  #include <linux/errno.h>
1958  #include <linux/sched.h>
1959  #include <linux/kernel.h>
1960 diff -urN linux.orig/arch/ppc/kernel/chrp_pci.c linux/arch/ppc/kernel/chrp_pci.c
1961 --- linux.orig/arch/ppc/kernel/chrp_pci.c       Sun Mar 25 18:31:48 2001
1962 +++ linux/arch/ppc/kernel/chrp_pci.c    Thu Jul 11 15:43:29 2002
1963 @@ -12,6 +12,7 @@
1964  #include <asm/io.h>
1965  #include <asm/pgtable.h>
1966  #include <asm/irq.h>
1967 +#include <asm/irq-compat.h>
1968  #include <asm/hydra.h>
1969  #include <asm/prom.h>
1970  #include <asm/gg2.h>
1971 @@ -19,7 +20,6 @@
1972  #include <asm/machdep.h>
1973  
1974  #include "pci.h"
1975 -#include "open_pic.h"
1976  
1977  /* LongTrail */
1978  #define pci_config_addr(bus, dev, offset) \
1979 @@ -287,7 +287,7 @@
1980         for( dev=pci_devices ; dev; dev=dev->next )
1981         {
1982                 if ( dev->irq )
1983 -                       dev->irq = dev->irq + open_pic.irq_offset;
1984 +                       dev->irq = openpic_to_irq( dev->irq );
1985                 /* these need to be absolute addrs for OF and Matrox FB -- Cort */
1986                 if ( dev->vendor == PCI_VENDOR_ID_MATROX )
1987                 {
1988 diff -urN linux.orig/arch/ppc/kernel/chrp_setup.c linux/arch/ppc/kernel/chrp_setup.c
1989 --- linux.orig/arch/ppc/kernel/chrp_setup.c     Sun Mar 25 18:31:49 2001
1990 +++ linux/arch/ppc/kernel/chrp_setup.c  Thu Jul 11 16:22:09 2002
1991 @@ -33,7 +33,6 @@
1992  #include <linux/pci.h>
1993  #include <linux/openpic.h>
1994  #include <linux/version.h>
1995 -#include <linux/delay.h>
1996  
1997  #include <asm/mmu.h>
1998  #include <asm/processor.h>
1999 @@ -46,11 +45,12 @@
2000  #include <asm/dma.h>
2001  #include <asm/machdep.h>
2002  #include <asm/irq.h>
2003 +#include <asm/irq-compat.h>
2004  #include <asm/adb.h>
2005  #include <asm/hydra.h>
2006  #include <asm/keyboard.h>
2007  
2008 -#include <asm/time.h>
2009 +#include "time.h"
2010  #include "local_irq.h"
2011  #include "i8259.h"
2012  #include "open_pic.h"
2013 @@ -69,7 +69,7 @@
2014  int chrp_set_rtc_time(unsigned long nowtime);
2015  unsigned long rtas_event_scan_rate = 0, rtas_event_scan_ct = 0;
2016  void chrp_calibrate_decr(void);
2017 -long chrp_time_init(void);
2018 +void chrp_time_init(void);
2019  
2020  void chrp_setup_pci_ptrs(void);
2021  
2022 @@ -359,6 +359,81 @@
2023         }
2024  }
2025  
2026 +void
2027 +chrp_do_IRQ(struct pt_regs *regs,
2028 +           int            cpu,
2029 +            int            isfake)
2030 +{
2031 +        int irq;
2032 +        unsigned long bits = 0;
2033 +        int openpic_eoi_done = 0;
2034 +
2035 +#ifdef __SMP__
2036 +        {
2037 +                unsigned int loops = 1000000;
2038 +                while (test_bit(0, &global_irq_lock)) {
2039 +                        if (smp_processor_id() == global_irq_holder) {
2040 +                                printk("uh oh, interrupt while we hold global irq lock!\n");
2041 +#ifdef CONFIG_XMON
2042 +                                xmon(0);
2043 +#endif
2044 +                                break;
2045 +                        }
2046 +                        if (loops-- == 0) {
2047 +                                printk("do_IRQ waiting for irq lock (holder=%d)\n", global_irq_holder);
2048 +#ifdef CONFIG_XMON
2049 +                                xmon(0);
2050 +#endif
2051 +                        }
2052 +                }
2053 +        }
2054 +#endif /* __SMP__ */
2055 +       
2056 +        irq = openpic_irq(smp_processor_id());
2057 +        if (irq == IRQ_8259_CASCADE)
2058 +        {
2059 +                /*
2060 +                 * This magic address generates a PCI IACK cycle.
2061 +                 *
2062 +                 * This should go in the above mask/ack code soon. -- Cort
2063 +                 */
2064 +               if ( chrp_int_ack_special )
2065 +                       irq = *chrp_int_ack_special;
2066 +               else
2067 +                       irq = i8259_irq(0);
2068 +                /*
2069 +                 * Acknowledge as soon as possible to allow i8259
2070 +                 * interrupt nesting                         */
2071 +                openpic_eoi(smp_processor_id());
2072 +                openpic_eoi_done = 1;
2073 +        }
2074 +        if (irq == OPENPIC_VEC_SPURIOUS)
2075 +        {
2076 +                /*
2077 +                 * Spurious interrupts should never be
2078 +                 * acknowledged
2079 +                 */
2080 +                ppc_spurious_interrupts++;
2081 +                openpic_eoi_done = 1;
2082 +               goto out;
2083 +        }
2084 +        bits = 1UL << irq;
2085 +
2086 +        if (irq < 0)
2087 +        {
2088 +                printk(KERN_DEBUG "Bogus interrupt %d from PC = %lx\n",
2089 +                       irq, regs->nip);
2090 +                ppc_spurious_interrupts++;
2091 +        }
2092 +       else
2093 +        {
2094 +               ppc_irq_dispatch_handler( regs, irq );
2095 +       }
2096 +out:
2097 +        if (!openpic_eoi_done)
2098 +                openpic_eoi(smp_processor_id());
2099 +}
2100 +
2101  __initfunc(void
2102            chrp_init_IRQ(void))
2103  {
2104 @@ -373,7 +448,7 @@
2105                         (*(unsigned long *)get_property(np,
2106                                                         "8259-interrupt-acknowledge", NULL));
2107         }
2108 -       open_pic.irq_offset = NUM_8259_INTERRUPTS;
2109 +       open_pic.irq_offset = 16;
2110         for ( i = 16 ; i < NR_IRQS ; i++ )
2111                 irq_desc[i].ctl = &open_pic;
2112         openpic_init(1);
2113 @@ -381,7 +456,7 @@
2114                 irq_desc[i].ctl = &i8259_pic;
2115         i8259_init();
2116  #ifdef CONFIG_XMON
2117 -       request_irq(HYDRA_INT_ADB_NMI+open_pic.irq_offset,
2118 +       request_irq(openpic_to_irq(HYDRA_INT_ADB_NMI),
2119                     xmon_irq, 0, "NMI", 0);
2120  #endif /* CONFIG_XMON */
2121  #ifdef __SMP__
2122 @@ -570,7 +645,7 @@
2123         ppc_md.get_cpuinfo    = chrp_get_cpuinfo;
2124         ppc_md.irq_cannonicalize = chrp_irq_cannonicalize;
2125         ppc_md.init_IRQ       = chrp_init_IRQ;
2126 -       ppc_md.do_IRQ         = open_pic_do_IRQ;
2127 +       ppc_md.do_IRQ         = chrp_do_IRQ;
2128                 
2129         ppc_md.init           = chrp_init2;
2130  
2131 @@ -612,8 +687,3 @@
2132         while ( *s )
2133                 call_rtas( "display-character", 1, 1, NULL, *s++ );
2134  }
2135 -
2136 -void chrp_indicator(int x)
2137 -{
2138 -       call_rtas("set-indicator", 3, 1, NULL, 6, 0, x);
2139 -}
2140 diff -urN linux.orig/arch/ppc/kernel/chrp_time.c linux/arch/ppc/kernel/chrp_time.c
2141 --- linux.orig/arch/ppc/kernel/chrp_time.c      Sun Mar 25 18:31:49 2001
2142 +++ linux/arch/ppc/kernel/chrp_time.c   Thu Jul 11 15:43:29 2002
2143 @@ -25,25 +25,24 @@
2144  #include <asm/processor.h>
2145  #include <asm/nvram.h>
2146  #include <asm/prom.h>
2147 -#include <asm/time.h>
2148 +#include "time.h"
2149  
2150  static int nvram_as1 = NVRAM_AS1;
2151  static int nvram_as0 = NVRAM_AS0;
2152  static int nvram_data = NVRAM_DATA;
2153  
2154 -__initfunc(long chrp_time_init(void))
2155 +__initfunc(void chrp_time_init(void))
2156  {
2157         struct device_node *rtcs;
2158         int base;
2159  
2160         rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
2161         if (rtcs == NULL || rtcs->addrs == NULL)
2162 -               return 0;
2163 +               return;
2164         base = rtcs->addrs[0].address;
2165         nvram_as1 = 0;
2166         nvram_as0 = base;
2167         nvram_data = base + 1;
2168 -       return 0;
2169  }
2170  
2171  int chrp_cmos_clock_read(int addr)
2172 diff -urN linux.orig/arch/ppc/kernel/gemini_setup.c linux/arch/ppc/kernel/gemini_setup.c
2173 --- linux.orig/arch/ppc/kernel/gemini_setup.c   Sun Mar 25 18:31:49 2001
2174 +++ linux/arch/ppc/kernel/gemini_setup.c        Thu Jul 11 15:45:25 2002
2175 @@ -21,7 +21,6 @@
2176  #include <linux/blk.h>
2177  #include <linux/console.h>
2178  #include <linux/openpic.h>
2179 -#include <linux/delay.h>
2180  
2181  #include <asm/system.h>
2182  #include <asm/pgtable.h>
2183 @@ -30,9 +29,8 @@
2184  #include <asm/io.h>
2185  #include <asm/m48t35.h>
2186  #include <asm/gemini.h>
2187 -#include <asm/processor.h>
2188  
2189 -#include <asm/time.h>
2190 +#include "time.h"
2191  #include "local_irq.h"
2192  #include "open_pic.h"
2193  
2194 @@ -168,6 +166,8 @@
2195         ioremap( GEMINI_MPIC_ADDR, sizeof( struct OpenPIC ));
2196  }
2197  
2198 +
2199 +extern unsigned long loops_per_jiffy;
2200  extern int root_mountflags;
2201  extern char cmd_line[];
2202  
2203 @@ -258,6 +258,14 @@
2204         return clock;
2205  }
2206  
2207 +
2208 +#define L2CR_PIPE_LATEWR   (0x01800000)   /* late-write SRAM */
2209 +#define L2CR_L2CTL         (0x00100000)   /* RAM control */
2210 +#define L2CR_INST_DISABLE  (0x00400000)   /* disable for insn's */
2211 +#define L2CR_L2I           (0x00200000)   /* global invalidate */
2212 +#define L2CR_L2E           (0x80000000)   /* enable */
2213 +#define L2CR_L2WT          (0x00080000)   /* write-through */
2214 +
2215  void __init gemini_init_l2(void)
2216  {
2217         unsigned char reg;
2218 @@ -331,7 +339,8 @@
2219                         cache |= L2CR_L2WT;
2220  #endif
2221                 cache |= L2CR_PIPE_LATEWR|L2CR_L2CTL|L2CR_INST_DISABLE;
2222 -               _set_L2CR(cache|L2CR_L2E);
2223 +               _set_L2CR(0);
2224 +               _set_L2CR(cache|L2CR_L2I|L2CR_L2E);
2225         }
2226  }
2227  
2228 @@ -381,7 +390,7 @@
2229  #define gemini_rtc_write(val,x)  (writeb((val),(GEMINI_RTC+(x))))
2230  
2231  /* ensure that the RTC is up and running */
2232 -long __init gemini_time_init(void)
2233 +void __init gemini_time_init(void)
2234  {
2235         unsigned char reg;
2236  
2237 @@ -392,7 +401,6 @@
2238                 gemini_rtc_write((reg & ~(M48T35_RTC_STOPPED)), M48T35_RTC_CONTROL);
2239                 gemini_rtc_write((reg | M48T35_RTC_SET), M48T35_RTC_CONTROL);
2240         }
2241 -       return 0;
2242  }
2243  
2244  #undef DEBUG_RTC
2245 diff -urN linux.orig/arch/ppc/kernel/head.S linux/arch/ppc/kernel/head.S
2246 --- linux.orig/arch/ppc/kernel/head.S   Fri Nov  2 17:39:05 2001
2247 +++ linux/arch/ppc/kernel/head.S        Thu Jul 11 15:43:29 2002
2248 @@ -13,7 +13,6 @@
2249   *    Copyright (C) 1996 Paul Mackerras.
2250   *  MPC8xx modifications Copyright (C) 1997 Dan Malek (dmalek@jlc.net).
2251   *  Amiga/APUS changes by Jesper Skov (jskov@cygnus.co.uk).
2252 - *  AltiVec additions by Kumar Gala (kumar.gala@motorola.com).
2253   *
2254   *  This file contains the low-level support and setup for the
2255   *  PowerPC platform, including trap and interrupt dispatch.
2256 @@ -23,10 +22,6 @@
2257   *  modify it under the terms of the GNU General Public License
2258   *  as published by the Free Software Foundation; either version
2259   *  2 of the License, or (at your option) any later version.
2260 - *
2261 - *  2000-04-10.
2262 - *  Add sys_rt_sigreturn in DoSyscall Handler.
2263 - *  Giovanna Ambrosini (ambrosini@lightning.ch).
2264   *     
2265   */
2266  
2267 @@ -87,28 +82,6 @@
2268  #define REST_16FPRS(n, base)   REST_8FPRS(n, base); REST_8FPRS(n+8, base)
2269  #define REST_32FPRS(n, base)   REST_16FPRS(n, base); REST_16FPRS(n+16, base)
2270  
2271 -/*
2272 - * Once a version of gas that understands the AltiVec instructions
2273 - * is freely available, we can do this the normal way...  - paulus
2274 - */
2275 -#define LVX(r,a,b)     .long   (31<<26)+((r)<<21)+((a)<<16)+((b)<<11)+(103<<1)
2276 -#define STVX(r,a,b)    .long   (31<<26)+((r)<<21)+((a)<<16)+((b)<<11)+(231<<1)
2277 -#define MFVSCR(r)      .long   (4<<26)+((r)<<11)+(770<<1)
2278 -#define MTVSCR(r)      .long   (4<<26)+((r)<<11)+(802<<1)
2279 -
2280 -#define SAVE_VR(n,b,base)      li b,TSS_VR0+(16*(n)); STVX(n,b,base)
2281 -#define SAVE_2VR(n,b,base)     SAVE_VR(n,b,base); SAVE_VR(n+1,b,base) 
2282 -#define SAVE_4VR(n,b,base)     SAVE_2VR(n,b,base); SAVE_2VR(n+2,b,base) 
2283 -#define SAVE_8VR(n,b,base)     SAVE_4VR(n,b,base); SAVE_4VR(n+4,b,base) 
2284 -#define SAVE_16VR(n,b,base)    SAVE_8VR(n,b,base); SAVE_8VR(n+8,b,base)
2285 -#define SAVE_32VR(n,b,base)    SAVE_16VR(n,b,base); SAVE_16VR(n+16,b,base)
2286 -#define REST_VR(n,b,base)      li b,TSS_VR0+(16*(n)); LVX(n,b,base)
2287 -#define REST_2VR(n,b,base)     REST_VR(n,b,base); REST_VR(n+1,b,base) 
2288 -#define REST_4VR(n,b,base)     REST_2VR(n,b,base); REST_2VR(n+2,b,base) 
2289 -#define REST_8VR(n,b,base)     REST_4VR(n,b,base); REST_4VR(n+4,b,base) 
2290 -#define REST_16VR(n,b,base)    REST_8VR(n,b,base); REST_8VR(n+8,b,base) 
2291 -#define REST_32VR(n,b,base)    REST_16VR(n,b,base); REST_16VR(n+16,b,base)
2292 -
2293  #define SYNC \
2294         sync; \
2295         isync
2296 @@ -262,15 +235,66 @@
2297  __secondary_start:
2298  /* Switch MMU off, clear BATs and flush TLB */
2299         bl      mmu_off
2300 -mmu_off_return:
2301         bl      clear_bats
2302         bl      flush_tlbs
2303 -       bl      setup_init_bats
2304 -#ifndef CONFIG_APUS
2305 -#ifdef CONFIG_BOOTX_TEXT
2306 -       bl      setup_disp_bat
2307 -#endif
2308 +
2309 +/* Use the first pair of BAT registers to map the 1st 16MB
2310 + * of RAM to KERNELBASE.  From this point on we can't safely
2311 + * call OF any more.
2312 + */
2313 +       lis     r11,KERNELBASE@h
2314 +       mfspr   r9,PVR
2315 +       rlwinm  r9,r9,16,16,31          /* r9 = 1 for 601, 4 for 604 */
2316 +       cmpi    0,r9,1
2317 +       bne     4f
2318 +       ori     r11,r11,4               /* set up BAT registers for 601 */
2319 +       li      r8,0x7f                 /* valid, block length = 8MB */
2320 +       oris    r9,r11,0x800000@h       /* set up BAT reg for 2nd 8M */
2321 +       oris    r10,r8,0x800000@h       /* set up BAT reg for 2nd 8M */
2322 +       mtspr   IBAT0U,r11              /* N.B. 601 has valid bit in */
2323 +       mtspr   IBAT0L,r8               /* lower BAT register */
2324 +       mtspr   IBAT1U,r9
2325 +       mtspr   IBAT1L,r10
2326 +       b       5f
2327 +4:
2328 +#ifdef CONFIG_APUS
2329 +       ori     r11,r11,BL_8M<<2|0x2    /* set up an 8MB mapping */
2330 +       ori     r11,r11,0xfe            /* set up an 8MB mapping */
2331 +       lis     r8,CYBERBASEp@h
2332 +       lwz     r8,0(r8)
2333 +       addis   r8,r8,KERNELBASE@h
2334 +       addi    r8,r8,2
2335 +#else  
2336 +       ori     r11,r11,BL_256M<<2|0x2  /* set up BAT registers for 604 */
2337 +       li      r8,2                    /* R/W access */
2338 +       /*
2339 +        * If the MMU is off clear the bats.  See clear_bat() -- Cort
2340 +        */
2341 +#ifndef CONFIG_GEMINI  
2342 +       /* 
2343 +        * allow secondary cpus to get at all of ram in early bootup
2344 +        * since their init_task may be up there -- Cort
2345 +        */
2346 +       oris    r18,r8,0x10000000@h
2347 +       oris    r21,r11,(KERNELBASE+0x10000000)@h
2348 +       mtspr   DBAT1L,r18              /* N.B. 6xx (not 601) have valid */
2349 +       mtspr   DBAT1U,r21              /* bit in upper BAT register */
2350 +       mtspr   IBAT1L,r18
2351 +       mtspr   IBAT1U,r21
2352 +       
2353 +       oris    r18,r8,0x20000000@h
2354 +       oris    r21,r11,(KERNELBASE+0x20000000)@h
2355 +       mtspr   DBAT2L,r18              /* N.B. 6xx (not 601) have valid */
2356 +       mtspr   DBAT2U,r21              /* bit in upper BAT register */
2357 +       mtspr   IBAT2L,r18
2358 +       mtspr   IBAT2U,r21
2359 +#endif /* ndef CONFIG_GEMINI */        
2360  #endif
2361 +       mtspr   DBAT0L,r8               /* N.B. 6xx (not 601) have valid */
2362 +       mtspr   DBAT0U,r11              /* bit in upper BAT register */
2363 +       mtspr   IBAT0L,r8
2364 +       mtspr   IBAT0U,r11
2365 +5:     isync
2366  #ifdef CONFIG_APUS
2367         /* Unfortunately the APUS specific instructions bloat the
2368          * code so it cannot fit in the 0x100 bytes available. We have
2369 @@ -396,15 +420,6 @@
2370  #endif /* CONFIG_8xx */
2371         b       turn_on_mmu
2372  
2373 -/* Hack for sleep on Core99 machines
2374 - */
2375 -#ifdef CONFIG_POWERMAC
2376 -       . = 0x80
2377 -SleepVector:
2378 -       .long   0
2379 -       .long   0       
2380 -#endif /* CONFIG_POWERMAC */
2381 -
2382  /*
2383   * GCC sometimes accesses words at negative offsets from the stack
2384   * pointer, although the SysV ABI says it shouldn't.  To cope with
2385 @@ -477,7 +492,7 @@
2386  #endif /* CONFIG_GEMINI */
2387  #else
2388         STD_EXCEPTION(0x100, Reset, UnknownException)
2389 -#endif
2390 +#endif 
2391  
2392  /* Machine check */
2393         STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
2394 @@ -636,26 +651,7 @@
2395         STD_EXCEPTION(0xd00, SingleStep, SingleStepException)
2396  
2397         STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
2398 -
2399 -#ifndef CONFIG_ALTIVEC
2400         STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
2401 -#else
2402 -/*
2403 - * The Altivec unavailable trap is at 0x0f20.  Foo.
2404 - * We effectively remap it to 0x3000.
2405 - */
2406 -       . = 0xf00
2407 -       b       Trap_0f
2408 -trap_0f_cont:
2409 -       addi    r3,r1,STACK_FRAME_OVERHEAD
2410 -       li      r20,MSR_KERNEL
2411 -       bl      transfer_to_handler
2412 -       .long   UnknownException
2413 -       .long   int_return
2414 -
2415 -       . = 0xf20
2416 -       b       AltiVecUnavailable
2417 -#endif /* CONFIG_ALTIVEC */
2418  
2419  #ifndef CONFIG_8xx
2420  /*
2421 @@ -1173,24 +1169,9 @@
2422         STD_EXCEPTION(0x2f00, Trap_2f, UnknownException)
2423  
2424         . = 0x3000
2425 -#ifdef CONFIG_ALTIVEC
2426 -AltiVecUnavailable:
2427 -       EXCEPTION_PROLOG
2428 -       bne     load_up_altivec         /* if from user, just load it up */
2429 -       li      r20,MSR_KERNEL
2430 -       bl      transfer_to_handler     /* if from kernel, take a trap */
2431 -       .long   KernelAltiVec
2432 -       .long   int_return
2433 -
2434 -/* here are the bits of trap 0xf00 which got displaced */
2435 -Trap_0f:
2436 -       EXCEPTION_PROLOG
2437 -       b       trap_0f_cont
2438 -#endif /* CONFIG_ALTIVEC */
2439 -
2440 -#else /* CONFIG_8xx */
2441 +#else
2442         . = 0x2000
2443 -#endif /* CONFIG_8xx */
2444 +#endif
2445  
2446  /*
2447   * This code finishes saving the registers to the exception frame
2448 @@ -1345,7 +1326,11 @@
2449         /* Construct the high word of the PPC-style PTE */
2450         mfsrin  r5,r3                   /* get segment reg for segment */
2451         rlwinm  r5,r5,7,1,24            /* put VSID in 0x7fffff80 bits */
2452 +       
2453 +#ifndef __SMP__                                /* do this later for SMP */
2454         oris    r5,r5,0x8000            /* set V (valid) bit */
2455 +#endif
2456 +       
2457         rlwimi  r5,r3,10,26,31          /* put in API (abbrev page index) */
2458         /* Get the address of the primary PTE group in the hash table */
2459         .globl  hash_page_patch_A
2460 @@ -1457,7 +1442,6 @@
2461   */
2462  found_empty:
2463  found_slot:
2464 -       clrlwi  r5,r5,1         /* clear valid bit (0x80000000) */
2465         stw     r5,0(r3)        /* clear V (valid) bit in PTE */
2466         sync
2467         tlbsync
2468 @@ -1509,7 +1493,6 @@
2469         REST_GPR(20, r21)
2470         REST_2GPRS(22, r21)
2471         lwz     r21,GPR21(r21)
2472 -       sync
2473         rfi
2474         
2475  #ifdef __SMP__
2476 @@ -1649,145 +1632,24 @@
2477  #endif /* __SMP__ */
2478         blr
2479  
2480 -#ifdef CONFIG_ALTIVEC
2481 -/* Note that the AltiVec support is closely modeled after the FP
2482 - * support.  Changes to one are likely to be applicable to the
2483 - * other!  */
2484 -load_up_altivec:
2485 -/*
2486 - * Disable AltiVec for the task which had AltiVec previously,
2487 - * and save its AltiVec registers in its thread_struct.
2488 - * Enables AltiVec for use in the kernel on return.
2489 - * On SMP we know the AltiVec units are free, since we give it up every
2490 - * switch.  -- Kumar
2491 - */
2492 -       mfmsr   r5
2493 -       oris    r5,r5,MSR_VEC@h
2494 -       SYNC
2495 -       mtmsr   r5                      /* enable use of AltiVec now */
2496 -       SYNC
2497 -/*
2498 - * For SMP, we don't do lazy AltiVec switching because it just gets too
2499 - * horrendously complex, especially when a task switches from one CPU
2500 - * to another.  Instead we call giveup_altivec in switch_to.
2501 - */
2502 -#ifndef __SMP__
2503 -#ifndef CONFIG_APUS
2504 -       lis     r6,-KERNELBASE@h
2505 -#else
2506 -       lis     r6,CYBERBASEp@h
2507 -       lwz     r6,0(r6)
2508 -#endif
2509 -       addis   r3,r6,last_task_used_altivec@ha
2510 -       lwz     r4,last_task_used_altivec@l(r3)
2511 -       cmpi    0,r4,0
2512 -       beq     1f
2513 -       add     r4,r4,r6
2514 -       addi    r4,r4,TSS       /* want TSS of last_task_used_altivec */
2515 -       SAVE_32VR(0,r20,r4)
2516 -       MFVSCR(vr0)
2517 -       li      r20,TSS_VSCR
2518 -       STVX(vr0,r20,r4)
2519 -       lwz     r5,PT_REGS(r4)
2520 -       add     r5,r5,r6
2521 -       lwz     r4,_MSR-STACK_FRAME_OVERHEAD(r5)
2522 -       lis     r20,MSR_VEC@h
2523 -       andc    r4,r4,r20       /* disable altivec for previous task */
2524 -       stw     r4,_MSR-STACK_FRAME_OVERHEAD(r5)
2525 -1:
2526 -#endif /* __SMP__ */
2527 -       /* enable use of AltiVec after return */
2528 -       oris    r23,r23,MSR_VEC@h
2529 -       mfspr   r5,SPRG3                /* current task's TSS (phys) */
2530 -       li      r20,TSS_VSCR
2531 -       LVX(vr0,r20,r5)
2532 -       MTVSCR(vr0)
2533 -       REST_32VR(0,r20,r5)
2534 -#ifndef __SMP__
2535 -       subi    r4,r5,TSS
2536 -       sub     r4,r4,r6
2537 -       stw     r4,last_task_used_altivec@l(r3)
2538 -#endif /* __SMP__ */
2539 -       /* restore registers and return */
2540 -       lwz     r3,_CCR(r21)
2541 -       lwz     r4,_LINK(r21)
2542 -       mtcrf   0xff,r3
2543 -       mtlr    r4
2544 -       REST_GPR(1, r21)
2545 -       REST_4GPRS(3, r21)
2546 -       /* we haven't used ctr or xer */
2547 -       mtspr   SRR1,r23
2548 -       mtspr   SRR0,r22
2549 -       REST_GPR(20, r21)
2550 -       REST_2GPRS(22, r21)
2551 -       lwz     r21,GPR21(r21)
2552 -       SYNC
2553 -       rfi
2554 -
2555 -/*
2556 - * AltiVec unavailable trap from kernel - print a message, but let
2557 - * the task use AltiVec in the kernel until it returns to user mode.
2558 - */
2559 -KernelAltiVec:
2560 -       lwz     r3,_MSR(r1)
2561 -       oris    r3,r3,MSR_VEC@h
2562 -       stw     r3,_MSR(r1)     /* enable use of AltiVec after return */
2563 -       lis     r3,87f@h
2564 -       ori     r3,r3,87f@l
2565 -       mr      r4,r2           /* current */
2566 -       lwz     r5,_NIP(r1)
2567 -       bl      printk
2568 -       b       int_return
2569 -87:    .string "AltiVec used in kernel  (task=%p, pc=%x)  \n"
2570 -       .align  4
2571 -
2572 -/*
2573 - * giveup_altivec(tsk)
2574 - * Disable AltiVec for the task given as the argument,
2575 - * and save the AltiVec registers in its thread_struct.
2576 - * Enables AltiVec for use in the kernel on return.
2577 - */
2578 -
2579 -       .globl  giveup_altivec
2580 -giveup_altivec:
2581 -       mfmsr   r5
2582 -       oris    r5,r5,MSR_VEC@h
2583 -       SYNC
2584 -       mtmsr   r5                      /* enable use of AltiVec now */
2585 -       SYNC
2586 -       cmpi    0,r3,0
2587 -       beqlr-                          /* if no previous owner, done */
2588 -       addi    r3,r3,TSS               /* want TSS of task */
2589 -       lwz     r5,PT_REGS(r3)
2590 -       cmpi    0,r5,0
2591 -       SAVE_32VR(0, r4, r3)
2592 -       MFVSCR(vr0)
2593 -       li      r4,TSS_VSCR
2594 -       STVX(vr0, r4, r3)
2595 -       beq     1f
2596 -       lwz     r4,_MSR-STACK_FRAME_OVERHEAD(r5)
2597 -       lis     r3,MSR_VEC@h
2598 -       andc    r4,r4,r3                /* disable AltiVec for previous task */
2599 -       stw     r4,_MSR-STACK_FRAME_OVERHEAD(r5)
2600 -1:
2601 -#ifndef __SMP__
2602 -       li      r5,0
2603 -       lis     r4,last_task_used_altivec@ha
2604 -       stw     r5,last_task_used_altivec@l(r4)
2605 -#endif /* __SMP__ */
2606 +#else  /* CONFIG_8xx */
2607 +       .globl  giveup_fpu
2608 +giveup_fpu:
2609         blr
2610 -#endif /* CONFIG_ALTIVEC */
2611 +#endif /* CONFIG_8xx */
2612  
2613  mmu_off:
2614 -       addi    r4, r3, mmu_off_return - _start
2615 +       addi    r4, r3, __secondary_start - _start
2616         mfmsr   r3
2617         andi.   r0,r3,MSR_DR|MSR_IR             /* MMU enabled? */
2618 -       beqlr
2619 -       andc    r3,r3,r0
2620 +       beq     1f
2621 +       ori     r3,r3,MSR_DR|MSR_IR
2622 +       xori    r3,r3,MSR_DR|MSR_IR
2623         mtspr   SRR0,r4
2624         mtspr   SRR1,r3
2625 -       SYNC
2626 +       sync
2627         rfi
2628 +1:     blr
2629  
2630  /*
2631   * This code is jumped to from the startup code to copy
2632 @@ -1798,6 +1660,10 @@
2633         addi    r9,r9,0x6f58            /* translate source addr */
2634         cmpw    r31,r9                  /* (we have to on chrp) */
2635         beq     7f
2636 +#if 0 // still needed ? breaks on me if I don't disable this
2637 +       rlwinm  r4,r4,0,8,31            /* translate source address */
2638 +       add     r4,r4,r3                /* to region mapped with BATs */
2639 +#endif 
2640  7:     addis   r9,r26,klimit@ha        /* fetch klimit */
2641         lwz     r25,klimit@l(r9)
2642         addis   r25,r25,-KERNELBASE@h
2643 @@ -1845,12 +1711,6 @@
2644         . = 0x4000
2645  #endif
2646  
2647 -#else  /* CONFIG_8xx */
2648 -       .globl  giveup_fpu
2649 -giveup_fpu:
2650 -       blr
2651 -#endif /* CONFIG_8xx */
2652 -
2653  turn_on_mmu:
2654         mfmsr   r0
2655         ori     r1,r0,MSR_DR|MSR_IR
2656 @@ -1913,7 +1773,7 @@
2657         mfspr   r9,PVR
2658         rlwinm  r9,r9,16,16,31
2659         cmpi    0,r9,1
2660 -       beq     6f                      /* not needed for 601 */
2661 +       beq     4f                      /* not needed for 601 */
2662         mfspr   r11,HID0
2663         andi.   r0,r11,HID0_DCE
2664         ori     r11,r11,HID0_ICE|HID0_DCE
2665 @@ -1930,24 +1790,14 @@
2666         cmpi    0,r9,4                  /* check for 604 */
2667         cmpi    1,r9,9                  /* or 604e */
2668         cmpi    2,r9,10                 /* or mach5 */
2669 -       cmpi    3,r9,8                  /* check for 750 (G3) */
2670 -       cmpi    4,r9,12                 /* or 7400 (G4) */
2671         cror    2,2,6
2672         cror    2,2,10
2673         bne     4f
2674         ori     r11,r11,HID0_SIED|HID0_BHTE /* for 604[e], enable */
2675         bne     2,5f
2676         ori     r11,r11,HID0_BTCD
2677 -       b       5f
2678 -4:
2679 -       cror    14,14,18
2680 -       bne     3,6f
2681 -       ori     r11,r11,HID0_SGE|HID0_BHTE|HID0_BTIC|HID0_ABE /* for g3/g4, enable */
2682 -       rlwinm  r11,r11,0,23,21         /* clear HID0_SPD */
2683 -       li      r3,0
2684 -       mtspr   ICTC,r3
2685  5:     mtspr   HID0,r11                /* superscalar exec & br history tbl */
2686 -6:
2687 +4:
2688  #endif /* CONFIG_8xx */
2689  #ifdef __SMP__
2690         /* if we're the second cpu stack and r2 are different
2691 @@ -2028,10 +1878,10 @@
2692         li      r3,MSR_KERNEL & ~(MSR_IR|MSR_DR)
2693         mtspr   SRR0,r4
2694         mtspr   SRR1,r3
2695 -       SYNC
2696         rfi
2697  /* Load up the kernel context */
2698  2:
2699 +       SYNC                    /* Force all PTE updates to finish */
2700         tlbia                   /* Clear all TLB entries */
2701         sync                    /* wait for tlbia/tlbie to finish */
2702  #ifdef __SMP__
2703 @@ -2088,7 +1938,6 @@
2704  #endif /* __SMP__ */
2705         mtspr   SRR0,r3
2706         mtspr   SRR1,r4
2707 -       SYNC
2708         rfi                     /* enable MMU and jump to start_kernel */
2709  
2710  /*
2711 @@ -2126,11 +1975,9 @@
2712  1:
2713  #endif /* SHOW_SYSCALLS */
2714         cmpi    0,r0,0x7777     /* Special case for 'sys_sigreturn' */
2715 -        cmpi    1,r0,0x6666     /* Special case for 'sys_rt_sigreturn' */
2716         beq-    10f
2717 -        beq-    cr1,16f
2718 -       lwz     r10,TASK_PTRACE(r2)
2719 -       andi.   r10,r10,PT_TRACESYS
2720 +       lwz     r10,TASK_FLAGS(r2)
2721 +       andi.   r10,r10,PF_TRACESYS
2722         bne-    50f
2723         cmpli   0,r0,NR_syscalls
2724         bge-    66f
2725 @@ -2175,12 +2022,6 @@
2726  /* sys_sigreturn */
2727  10:    addi    r3,r1,STACK_FRAME_OVERHEAD
2728         bl      sys_sigreturn
2729 -        cmpi    0,r3,0          /* Check for restarted system call */
2730 -        bge     int_return
2731 -        b       20b
2732 -/* sys_rt_sigreturn */
2733 -16:     addi    r3,r1,STACK_FRAME_OVERHEAD
2734 -        bl      sys_rt_sigreturn
2735         cmpi    0,r3,0          /* Check for restarted system call */
2736         bge     int_return
2737         b       20b
2738 @@ -2273,9 +2114,6 @@
2739         mflr    r20             /* Return to switch caller */
2740         mfmsr   r22
2741         li      r0,MSR_FP       /* Disable floating-point */
2742 -#ifdef CONFIG_ALTIVEC
2743 -       oris    r0,r0,MSR_VEC@h
2744 -#endif /* CONFIG_ALTIVEC */
2745         andc    r22,r22,r0
2746         stw     r20,_NIP(r1)
2747         stw     r22,_MSR(r1)
2748 @@ -2589,38 +2427,6 @@
2749         blr
2750  
2751  /*
2752 - * Copy a whole page.  We use the dcbz instruction on the destination
2753 - * to reduce memory traffic (it eliminates the unnecessary reads of
2754 - * the destination into cache).  This requires that the destination
2755 - * is cacheable.
2756 - */
2757 -_GLOBAL(copy_page)
2758 -       li      r0,4096/CACHE_LINE_SIZE
2759 -       mtctr   r0
2760 -       addi    r3,r3,-4
2761 -       addi    r4,r4,-4
2762 -       li      r5,4
2763 -1:     dcbz    r5,r3
2764 -       lwz     r6,4(r4)
2765 -       lwz     r7,8(r4)
2766 -       lwz     r8,12(r4)
2767 -       lwzu    r9,16(r4)
2768 -       stw     r6,4(r3)
2769 -       stw     r7,8(r3)
2770 -       stw     r8,12(r3)
2771 -       stwu    r9,16(r3)
2772 -       lwz     r6,4(r4)
2773 -       lwz     r7,8(r4)
2774 -       lwz     r8,12(r4)
2775 -       lwzu    r9,16(r4)
2776 -       stw     r6,4(r3)
2777 -       stw     r7,8(r3)
2778 -       stw     r8,12(r3)
2779 -       stwu    r9,16(r3)
2780 -       bdnz    1b
2781 -       blr
2782 -
2783 -/*
2784   * Flush entries from the hash table with VSIDs in the range
2785   * given.
2786   */
2787 @@ -2798,6 +2604,7 @@
2788         stw     r0,20(r1)
2789         lis     r4,rtas_data@ha
2790         lwz     r4,rtas_data@l(r4)
2791 +       addis   r4,r4,-KERNELBASE@h
2792         lis     r6,1f@ha        /* physical return address for rtas */
2793         addi    r6,r6,1f@l
2794         addis   r6,r6,-KERNELBASE@h
2795 @@ -2817,7 +2624,6 @@
2796         mtspr   SPRG2,r7
2797         mtspr   SRR0,r8
2798         mtspr   SRR1,r9
2799 -       SYNC
2800         rfi
2801  1:     addis   r9,r1,-KERNELBASE@h
2802         lwz     r8,20(r9)       /* get return address */
2803 @@ -2826,7 +2632,6 @@
2804         mtspr   SPRG2,r0
2805         mtspr   SRR0,r8
2806         mtspr   SRR1,r9
2807 -       SYNC
2808         rfi                     /* return to caller */
2809  #endif /* CONFIG_8xx */
2810  
2811 @@ -2851,6 +2656,30 @@
2812         mtlr    r4
2813         blr
2814  #endif /* CONFIG_8xx */
2815 +       
2816 +/*
2817 + * We put a few things here that have to be page-aligned.
2818 + * This stuff goes at the beginning of the data segment,
2819 + * which is page-aligned.
2820 + */
2821 +       .data
2822 +       .globl  sdata
2823 +sdata:
2824 +       .globl  empty_zero_page
2825 +empty_zero_page:
2826 +       .space  4096
2827 +
2828 +       .globl  swapper_pg_dir
2829 +swapper_pg_dir:
2830 +       .space  4096    
2831 +
2832 +/*
2833 + * This space gets a copy of optional info passed to us by the bootstrap
2834 + * Used to pass parameters into the kernel like root=/dev/sda1, etc.
2835 + */    
2836 +       .globl  cmd_line
2837 +cmd_line:
2838 +       .space  512
2839  
2840  /* 
2841   * An undocumented "feature" of 604e requires that the v bit
2842 @@ -2895,117 +2724,4 @@
2843         blt     1b
2844         sync
2845         blr
2846 -
2847 -/* Use the first pair of BAT registers to map the 1st 16MB
2848 - * of RAM to KERNELBASE.  From this point on we can't safely
2849 - * call OF any more.
2850 - */
2851 -setup_init_bats:
2852 -       lis     r11,KERNELBASE@h
2853 -       mfspr   r9,PVR
2854 -       rlwinm  r9,r9,16,16,31          /* r9 = 1 for 601, 4 for 604 */
2855 -       cmpi    0,r9,1
2856 -       bne     4f
2857 -       ori     r11,r11,4               /* set up BAT registers for 601 */
2858 -       li      r8,0x7f                 /* valid, block length = 8MB */
2859 -       oris    r9,r11,0x800000@h       /* set up BAT reg for 2nd 8M */
2860 -       oris    r10,r8,0x800000@h       /* set up BAT reg for 2nd 8M */
2861 -       mtspr   IBAT0U,r11              /* N.B. 601 has valid bit in */
2862 -       mtspr   IBAT0L,r8               /* lower BAT register */
2863 -       mtspr   IBAT1U,r9
2864 -       mtspr   IBAT1L,r10
2865 -       b       5f
2866 -4:
2867 -#ifdef CONFIG_APUS
2868 -       ori     r11,r11,BL_8M<<2|0x2    /* set up an 8MB mapping */
2869 -       ori     r11,r11,0xfe            /* set up an 8MB mapping */
2870 -       lis     r8,CYBERBASEp@h
2871 -       lwz     r8,0(r8)
2872 -       addis   r8,r8,KERNELBASE@h
2873 -       addi    r8,r8,2
2874 -#else  
2875 -       ori     r11,r11,BL_256M<<2|0x2  /* set up BAT registers for 604 */
2876 -       li      r8,2                    /* R/W access */
2877 -       /*
2878 -        * If the MMU is off clear the bats.  See clear_bat() -- Cort
2879 -        */
2880 -#ifndef CONFIG_GEMINI  
2881 -       /* 
2882 -        * allow secondary cpus to get at all of ram in early bootup
2883 -        * since their init_task may be up there -- Cort
2884 -        */
2885 -       oris    r18,r8,0x10000000@h
2886 -       oris    r21,r11,(KERNELBASE+0x10000000)@h
2887 -       mtspr   DBAT1L,r18              /* N.B. 6xx (not 601) have valid */
2888 -       mtspr   DBAT1U,r21              /* bit in upper BAT register */
2889 -       mtspr   IBAT1L,r18
2890 -       mtspr   IBAT1U,r21
2891         
2892 -       oris    r18,r8,0x20000000@h
2893 -       oris    r21,r11,(KERNELBASE+0x20000000)@h
2894 -       mtspr   DBAT2L,r18              /* N.B. 6xx (not 601) have valid */
2895 -       mtspr   DBAT2U,r21              /* bit in upper BAT register */
2896 -       mtspr   IBAT2L,r18
2897 -       mtspr   IBAT2U,r21
2898 -#endif /* ndef CONFIG_GEMINI */        
2899 -#endif
2900 -       mtspr   DBAT0L,r8               /* N.B. 6xx (not 601) have valid */
2901 -       mtspr   DBAT0U,r11              /* bit in upper BAT register */
2902 -       mtspr   IBAT0L,r8
2903 -       mtspr   IBAT0U,r11
2904 -5:     isync
2905 -       blr
2906 -       
2907 -#ifdef CONFIG_BOOTX_TEXT
2908 -setup_disp_bat:
2909 -       /*
2910 -        * setup the display bat prepared for us in prom.c
2911 -        */
2912 -       mflr    r8
2913 -       bl      reloc_offset
2914 -       mtlr    r8
2915 -       lis     r8, disp_BATL@h
2916 -       ori     r8, r8, disp_BATL@l
2917 -       add     r8, r3, r8
2918 -       lwz     r8, 0(r8)
2919 -       lis     r11, disp_BATU@h
2920 -       ori     r11, r11, disp_BATU@l
2921 -       add     r11, r3, r11
2922 -       lwz     r11, 0(r11)
2923 -       mtspr   IBAT3L,r8
2924 -       mtspr   IBAT3U,r11
2925 -       mfspr   r9,PVR
2926 -       rlwinm  r9,r9,16,16,31          /* r9 = 1 for 601, 4 for 604 */
2927 -       cmpi    0,r9,1
2928 -       beq     1f
2929 -       mtspr   DBAT3L,r8
2930 -       mtspr   DBAT3U,r11
2931 -1:             
2932 -       blr
2933 -#endif
2934 -       
2935 -/*
2936 - * We put a few things here that have to be page-aligned.
2937 - * This stuff goes at the beginning of the data segment,
2938 - * which is page-aligned.
2939 - */
2940 -       .data
2941 -       .globl  sdata
2942 -sdata:
2943 -       .globl  empty_zero_page
2944 -empty_zero_page:
2945 -       .space  4096
2946 -
2947 -       .globl  swapper_pg_dir
2948 -swapper_pg_dir:
2949 -       .space  4096    
2950 -
2951 -/*
2952 - * This space gets a copy of optional info passed to us by the bootstrap
2953 - * Used to pass parameters into the kernel like root=/dev/sda1, etc.
2954 - */    
2955 -       .globl  cmd_line
2956 -cmd_line:
2957 -       .space  512
2958 -
2959 -
2960 diff -urN linux.orig/arch/ppc/kernel/irq.c linux/arch/ppc/kernel/irq.c
2961 --- linux.orig/arch/ppc/kernel/irq.c    Sun Mar 25 18:31:48 2001
2962 +++ linux/arch/ppc/kernel/irq.c Thu Jul 11 15:43:29 2002
2963 @@ -61,9 +61,7 @@
2964  
2965  #include "local_irq.h"
2966  
2967 -extern atomic_t ipi_recv;
2968 -extern atomic_t ipi_sent;
2969 -void enable_irq(unsigned int irq_nr);
2970 +extern volatile unsigned long ipi_count;
2971  void enable_irq(unsigned int irq_nr);
2972  void disable_irq(unsigned int irq_nr);
2973  
2974 @@ -139,21 +137,20 @@
2975         if (!handler)
2976         {
2977                 /* Free */
2978 -               p = &irq_desc[irq].action;
2979 -               while ((action = *p) != NULL && action->dev_id != dev_id)
2980 -                       p = &action->next;
2981 -               if (action == NULL)
2982 -                       return -ENOENT;
2983 -
2984 -               /* Found it - now free it */
2985 -               save_flags(flags);
2986 -               cli();
2987 -               *p = action->next;
2988 -               if (irq_desc[irq].action == NULL)
2989 -                       disable_irq(irq);
2990 -               restore_flags(flags);
2991 -               irq_kfree(action);
2992 -               return 0;
2993 +               for (p = &irq_desc[irq].action; (action = *p) != NULL; p = &action->next)
2994 +               {
2995 +                       if (action->dev_id == dev_id)
2996 +                       {
2997 +                               /* Found it - now free it */
2998 +                               save_flags(flags);
2999 +                               cli();
3000 +                               *p = action->next;
3001 +                               restore_flags(flags);
3002 +                               irq_kfree(action);
3003 +                               return 0;
3004 +                       }
3005 +               }
3006 +               return -ENOENT;
3007         }
3008         
3009         action = (struct irqaction *)
3010 @@ -244,10 +241,8 @@
3011         }
3012  #ifdef __SMP__
3013         /* should this be per processor send/receive? */
3014 -       /* should this be per processor send/receive? */
3015 -       len += sprintf(buf+len, "IPI: (recv/sent) %10lu/%lu\n",
3016 -                       atomic_read(&ipi_recv), atomic_read(&ipi_sent));
3017 -#endif /* __SMP__ */           
3018 +       len += sprintf(buf+len, "IPI: %10lu\n", ipi_count);
3019 +#endif         
3020         len += sprintf(buf+len, "BAD: %10u\n", ppc_spurious_interrupts);
3021         return len;
3022  }
3023 @@ -322,14 +317,10 @@
3024  atomic_t global_bh_count;
3025  atomic_t global_bh_lock;
3026  
3027 -extern unsigned long *_get_SP(void);
3028 -
3029  static void show(char * str)
3030  {
3031 -#if 0
3032         int i;
3033         unsigned long *stack;
3034 -#endif
3035         int cpu = smp_processor_id();
3036  
3037         printk("\n%s, CPU %d:\n", str, cpu);
3038 @@ -341,10 +332,6 @@
3039                atomic_read(&global_bh_count),
3040                ppc_local_bh_count[0],
3041                ppc_local_bh_count[1]);
3042 -#if 1
3043 -       printk(" CPU: %d last CPU: %d\n", current->processor,current->last_processor);
3044 -       print_backtrace (_get_SP());
3045 -#else
3046         stack = (unsigned long *) &str;
3047         for (i = 40; i ; i--) {
3048                 unsigned long x = *++stack;
3049 @@ -352,7 +339,6 @@
3050                         printk("<[%08lx]> ", x);
3051                 }
3052         }
3053 -#endif
3054  }
3055  
3056  static inline void wait_on_bh(void)
3057 diff -urN linux.orig/arch/ppc/kernel/local_irq.h linux/arch/ppc/kernel/local_irq.h
3058 --- linux.orig/arch/ppc/kernel/local_irq.h      Sun Mar 25 18:31:49 2001
3059 +++ linux/arch/ppc/kernel/local_irq.h   Thu Jul 11 15:43:29 2002
3060 @@ -26,7 +26,6 @@
3061  struct irqdesc {
3062         struct irqaction *action;
3063         struct hw_interrupt_type *ctl;
3064 -       int level;
3065  };
3066  
3067  extern struct irqdesc irq_desc[NR_IRQS];
3068 diff -urN linux.orig/arch/ppc/kernel/mbx_pci.c linux/arch/ppc/kernel/mbx_pci.c
3069 --- linux.orig/arch/ppc/kernel/mbx_pci.c        Sun Mar 25 18:31:49 2001
3070 +++ linux/arch/ppc/kernel/mbx_pci.c     Thu Jul 11 15:43:29 2002
3071 @@ -17,9 +17,7 @@
3072  
3073  #include <asm/io.h>
3074  #include <asm/mbx.h>
3075 -#include <asm/machdep.h>
3076  
3077 -#include "pci.h"
3078  
3079  /*
3080   * This blows......The MBX uses the Tundra QSpan PCI bridge.  When
3081 diff -urN linux.orig/arch/ppc/kernel/mbx_setup.c linux/arch/ppc/kernel/mbx_setup.c
3082 --- linux.orig/arch/ppc/kernel/mbx_setup.c      Sun Mar 25 18:31:49 2001
3083 +++ linux/arch/ppc/kernel/mbx_setup.c   Thu Jul 11 15:43:29 2002
3084 @@ -31,7 +31,6 @@
3085  #include <linux/init.h>
3086  #include <linux/blk.h>
3087  #include <linux/ioport.h>
3088 -#include <linux/delay.h>
3089  
3090  #include <asm/mmu.h>
3091  #include <asm/processor.h>
3092 @@ -41,25 +40,14 @@
3093  #include <asm/ide.h>
3094  #include <asm/mbx.h>
3095  #include <asm/machdep.h>
3096 -#include <asm/keyboard.h>
3097 -#include <asm/8xx_immap.h>
3098 -#include <asm/time.h>
3099  
3100 +#include "time.h"
3101  #include "local_irq.h"
3102  
3103  static int mbx_set_rtc_time(unsigned long time);
3104  unsigned long mbx_get_rtc_time(void);
3105  void mbx_calibrate_decr(void);
3106  
3107 -extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
3108 -extern int pckbd_getkeycode(unsigned int scancode);
3109 -extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
3110 -                          char raw_mode);
3111 -extern char pckbd_unexpected_up(unsigned char keycode);
3112 -extern void pckbd_leds(unsigned char leds);
3113 -extern void pckbd_init_hw(void);
3114 -extern unsigned char pckbd_sysrq_xlate[128];
3115 -
3116  extern int mackbd_setkeycode(unsigned int scancode, unsigned int keycode);
3117  extern int mackbd_getkeycode(unsigned int scancode);
3118  extern int mackbd_translate(unsigned char scancode, unsigned char *keycode,
3119 @@ -68,6 +56,8 @@
3120  extern void mackbd_leds(unsigned char leds);
3121  extern void mackbd_init_hw(void);
3122  
3123 +extern unsigned long loops_per_jiffy;
3124 +
3125  unsigned long empty_zero_page[1024];
3126  
3127  #ifdef CONFIG_BLK_DEV_RAM
3128 @@ -463,7 +453,7 @@
3129         ppc_md.kbd_leds          = pckbd_leds;
3130         ppc_md.kbd_init_hw       = pckbd_init_hw;
3131  #ifdef CONFIG_MAGIC_SYSRQ
3132 -       ppc_md.sysrq_xlate       = pckbd_sysrq_xlate;
3133 +       ppc_md.kbd_sysrq_xlate   = pckbd_sysrq_xlate;
3134         SYSRQ_KEY                = 0x54;
3135  #endif
3136  
3137 diff -urN linux.orig/arch/ppc/kernel/misc.S linux/arch/ppc/kernel/misc.S
3138 --- linux.orig/arch/ppc/kernel/misc.S   Sun Mar 25 18:37:30 2001
3139 +++ linux/arch/ppc/kernel/misc.S        Thu Jul 11 15:43:29 2002
3140 @@ -125,33 +125,12 @@
3141   * Flush MMU TLB
3142   */
3143  _GLOBAL(_tlbia)
3144 -#if defined(CONFIG_SMP)
3145 -       mfmsr   r10
3146 -       sync
3147 -       rlwinm  r0,r10,0,17,15          /* clear bit 16 (MSR_EE) */
3148 -       mtmsr   r0
3149 -       SYNC
3150 -       lis     r9,hash_table_lock@h
3151 -       ori     r9,r9,hash_table_lock@l
3152 -       lwz     r8,PROCESSOR(r2)
3153 -       oris    r8,r8,10
3154 -10:    lwarx   r7,0,r9
3155 -       cmpi    0,r7,0
3156 -       bne-    10b
3157 -       stwcx.  r8,0,r9
3158 -       bne-    10b
3159 -       eieio
3160 -#endif /* CONFIG_SMP */
3161         sync
3162         tlbia
3163         sync
3164  #ifdef __SMP__
3165         tlbsync
3166         sync
3167 -       li      r0,0
3168 -       stw     r0,0(r9)                /* clear hash_table_lock */
3169 -       mtmsr   r10
3170 -       SYNC
3171  #endif
3172         blr     
3173  
3174 @@ -159,32 +138,11 @@
3175   * Flush MMU TLB for a particular address
3176   */
3177  _GLOBAL(_tlbie)
3178 -#if defined(CONFIG_SMP)
3179 -       mfmsr   r10
3180 -       sync
3181 -       rlwinm  r0,r10,0,17,15          /* clear bit 16 (MSR_EE) */
3182 -       mtmsr   r0
3183 -       SYNC
3184 -       lis     r9,hash_table_lock@h
3185 -       ori     r9,r9,hash_table_lock@l
3186 -       lwz     r8,PROCESSOR(r2)
3187 -       oris    r8,r8,11
3188 -10:    lwarx   r7,0,r9
3189 -       cmpi    0,r7,0
3190 -       bne-    10b
3191 -       stwcx.  r8,0,r9
3192 -       bne-    10b
3193 -       eieio
3194 -#endif /* CONFIG_SMP */
3195         tlbie   r3
3196         sync
3197 -#ifdef CONFIG_SMP
3198 +#ifdef __SMP__
3199         tlbsync
3200         sync
3201 -       li      r0,0
3202 -       stw     r0,0(r9)                /* clear hash_table_lock */
3203 -       mtmsr   r10
3204 -       SYNC
3205  #endif
3206         blr
3207  
3208 @@ -317,8 +275,10 @@
3209         stwcx.  r5,0,r3         /* Update with new value */
3210         bne-    10b             /* Retry if "reservation" (i.e. lock) lost */
3211         SMP_MB
3212 -       cntlzw  r3,r5
3213 -       srwi    r3,r3,5
3214 +       cmpi    0,r5,0          /* Return 'true' IFF 0 */
3215 +       li      r3,1
3216 +       beqlr
3217 +       li      r3,0
3218         blr
3219  _GLOBAL(atomic_clear_mask)
3220         SMP_WMB                 /* wmb() */
3221 @@ -354,10 +314,8 @@
3222   * The *_ns versions don't do byte-swapping.
3223   */
3224  _GLOBAL(_insb)
3225 -       cmpwi   0,r5,0
3226         mtctr   r5
3227         subi    r4,r4,1
3228 -       blelr-
3229  00:    lbz     r5,0(r3)
3230         eieio
3231         stbu    r5,1(r4)
3232 @@ -365,10 +323,8 @@
3233         blr
3234  
3235  _GLOBAL(_outsb)
3236 -       cmpwi   0,r5,0
3237         mtctr   r5
3238         subi    r4,r4,1
3239 -       blelr-
3240  00:    lbzu    r5,1(r4)
3241         stb     r5,0(r3)
3242         eieio
3243 @@ -376,10 +332,8 @@
3244         blr     
3245  
3246  _GLOBAL(_insw)
3247 -       cmpwi   0,r5,0
3248         mtctr   r5
3249         subi    r4,r4,2
3250 -       blelr-
3251  00:    lhbrx   r5,0,r3
3252         eieio
3253         sthu    r5,2(r4)
3254 @@ -387,10 +341,8 @@
3255         blr
3256  
3257  _GLOBAL(_outsw)
3258 -       cmpwi   0,r5,0
3259         mtctr   r5
3260         subi    r4,r4,2
3261 -       blelr-
3262  00:    lhzu    r5,2(r4)
3263         eieio
3264         sthbrx  r5,0,r3 
3265 @@ -398,10 +350,8 @@
3266         blr     
3267  
3268  _GLOBAL(_insl)
3269 -       cmpwi   0,r5,0
3270         mtctr   r5
3271         subi    r4,r4,4
3272 -       blelr-
3273  00:    lwbrx   r5,0,r3
3274         eieio
3275         stwu    r5,4(r4)
3276 @@ -409,10 +359,8 @@
3277         blr
3278  
3279  _GLOBAL(_outsl)
3280 -       cmpwi   0,r5,0
3281         mtctr   r5
3282         subi    r4,r4,4
3283 -       blelr-
3284  00:    lwzu    r5,4(r4)
3285         stwbrx  r5,0,r3
3286         eieio
3287 @@ -421,10 +369,8 @@
3288  
3289  _GLOBAL(ide_insw)
3290  _GLOBAL(_insw_ns)
3291 -       cmpwi   0,r5,0
3292         mtctr   r5
3293         subi    r4,r4,2
3294 -       blelr-
3295  00:    lhz     r5,0(r3)
3296         eieio
3297         sthu    r5,2(r4)
3298 @@ -433,10 +379,8 @@
3299  
3300  _GLOBAL(ide_outsw)
3301  _GLOBAL(_outsw_ns)
3302 -       cmpwi   0,r5,0
3303         mtctr   r5
3304         subi    r4,r4,2
3305 -       blelr-
3306  00:    lhzu    r5,2(r4)
3307         sth     r5,0(r3)
3308         eieio
3309 @@ -444,10 +388,8 @@
3310         blr     
3311  
3312  _GLOBAL(_insl_ns)
3313 -       cmpwi   0,r5,0
3314         mtctr   r5
3315         subi    r4,r4,4
3316 -       blelr-
3317  00:    lwz     r5,0(r3)
3318         eieio
3319         stwu    r5,4(r4)
3320 @@ -455,10 +397,8 @@
3321         blr
3322  
3323  _GLOBAL(_outsl_ns)
3324 -       cmpwi   0,r5,0
3325         mtctr   r5
3326         subi    r4,r4,4
3327 -       blelr-
3328  00:    lwzu    r5,4(r4)
3329         stw     r5,0(r3)
3330         eieio
3331 @@ -466,59 +406,48 @@
3332         blr     
3333  
3334  /*
3335 - * Extended precision shifts.
3336 - * 
3337 - * Updated to be valid for shift counts from 0 to 63 inclusive.
3338 - * -- Gabriel
3339 + * Extended precision shifts
3340   *
3341   * R3/R4 has 64 bit value
3342   * R5    has shift count
3343   * result in R3/R4
3344   *
3345 - *  ashrdi3: arithmetic right shift (sign propagation)     
3346 - *  lshrdi3: logical right shift       
3347 - *  ashldi3: left shift
3348 + *  ashrdi3:     XXXYYY/ZZZAAA -> SSSXXX/YYYZZZ
3349 + *  ashldi3:     XXXYYY/ZZZAAA -> YYYZZZ/AAA000
3350 + *  lshrdi3:     XXXYYY/ZZZAAA -> 000XXX/YYYZZZ
3351   */
3352  _GLOBAL(__ashrdi3)
3353 -       subfic  r6,r5,32        
3354 -       srw     r4,r4,r5        # LSW = count > 31 ? 0 : LSW >> count
3355 -       addi    r7,r5,32        # could be xori, or addi with -32
3356 -       slw     r6,r3,r6        # t1 = count > 31 ? 0 : MSW << (32-count)
3357 -       rlwinm  r8,r7,0,32      # t3 = (count < 32) ? 32 : 0
3358 -       sraw    r7,r3,r7        # t2 = MSW >> (count-32)
3359 -       or      r4,r4,r6        # LSW |= t1
3360 -       slw     r7,r7,r8        # t2 = (count < 32) ? 0 : t2
3361 -       sraw    r3,r3,r5        # MSW = MSW >> count
3362 -       or      r4,r4,r7        # LSW |= t2
3363 +       li      r6,32
3364 +       sub     r6,r6,r5
3365 +       slw     r7,r3,r6        /* isolate YYY */
3366 +       srw     r4,r4,r5        /* isolate ZZZ */
3367 +       or      r4,r4,r7        /* YYYZZZ */
3368 +       sraw    r3,r3,r5        /* SSSXXX */
3369         blr
3370  
3371  _GLOBAL(__ashldi3)
3372 -       subfic  r6,r5,32        
3373 -       slw     r3,r3,r5        # MSW = count > 31 ? 0 : MSW << count
3374 -       addi    r7,r5,32        # could be xori, or addi with -32
3375 -       srw     r6,r4,r6        # t1 = count > 31 ? 0 : LSW >> (32-count)
3376 -       slw     r7,r4,r7        # t2 = count < 32 ? 0 : LSW << (count-32)
3377 -       or      r3,r3,r6        # MSW |= t1
3378 -       slw     r4,r4,r5        # LSW = LSW << count
3379 -       or      r3,r3,r7        # MSW |= t2
3380 +       li      r6,32
3381 +       sub     r6,r6,r5
3382 +       srw     r7,r4,r6        /* isolate ZZZ */
3383 +       slw     r4,r4,r5        /* AAA000 */
3384 +       slw     r3,r3,r5        /* YYY--- */
3385 +       or      r3,r3,r7        /* YYYZZZ */
3386         blr
3387  
3388  _GLOBAL(__lshrdi3)
3389 -       subfic  r6,r5,32        
3390 -       srw     r4,r4,r5        # LSW = count > 31 ? 0 : LSW >> count
3391 -       addi    r7,r5,32        # could be xori, or addi with -32
3392 -       slw     r6,r3,r6        # t1 = count > 31 ? 0 : MSW << (32-count)
3393 -       srw     r7,r3,r7        # t2 = count < 32 ? 0 : MSW >> (count-32)
3394 -       or      r4,r4,r6        # LSW |= t1
3395 -       srw     r3,r3,r5        # MSW = MSW >> count
3396 -       or      r4,r4,r7        # LSW |= t2 
3397 +       li      r6,32
3398 +       sub     r6,r6,r5
3399 +       slw     r7,r3,r6        /* isolate YYY */
3400 +       srw     r4,r4,r5        /* isolate ZZZ */
3401 +       or      r4,r4,r7        /* YYYZZZ */
3402 +       srw     r3,r3,r5        /* 000XXX */
3403         blr
3404  
3405  _GLOBAL(abs)
3406 -       srawi   r4,r3,31
3407 -       xor     r3,r3,r4
3408 -       sub     r3,r3,r4
3409 -       blr
3410 +       cmpi    0,r3,0
3411 +       bge     10f
3412 +       neg     r3,r3
3413 +10:    blr
3414  
3415  _GLOBAL(_get_SP)
3416         mr      r3,r1           /* Close enough */
3417 @@ -563,14 +492,6 @@
3418         isync /* Handle erratas in some cases */
3419         blr
3420  
3421 -_GLOBAL(_get_ICTC)
3422 -       mfspr   r3,ICTC
3423 -       blr
3424 -
3425 -_GLOBAL(_set_ICTC)
3426 -       mtspr   ICTC,r3
3427 -       blr
3428 -
3429  /*
3430         L2CR functions
3431         Copyright Â© 1997-1998 by PowerLogix R & D, Inc.
3432 @@ -592,17 +513,6 @@
3433  /*
3434         Thur, Dec. 12, 1998.
3435         - First public release, contributed by PowerLogix.
3436 -       ***********
3437 -       Sat, Aug. 7, 1999.
3438 -       - Terry: Made sure code disabled interrupts before running. (Previously
3439 -                       it was assumed interrupts were already disabled).
3440 -       - Terry: Updated for tentative G4 support.  4MB of memory is now flushed
3441 -                       instead of 2MB.  (Prob. only 3 is necessary).
3442 -       - Terry: Updated for workaround to HID0[DPM] processor bug
3443 -                       during global invalidates.
3444 -       ***********
3445 -       Thu, July 13, 2000.
3446 -       - Terry: Added isync to correct for an errata.
3447         
3448         Author: Terry Greeniaus (tgree@phys.ualberta.ca)
3449         Please e-mail updates to this file to me, thanks!
3450 @@ -641,94 +551,80 @@
3451         causes cache pushes from the L1 cache to go to the L2 cache
3452         instead of to main memory.
3453  */
3454 -/*
3455 - * Summary: this procedure ignores the L2I bit in the value passed in,
3456 - * flushes the cache if it was already enabled, always invalidates the
3457 - * cache, then enables the cache if the L2E bit is set in the value
3458 - * passed in.
3459 - *   -- paulus.
3460 - */
3461 +
3462  _GLOBAL(_set_L2CR)
3463 -       /* Make sure this is a 750 or 7400 chip */
3464 +       /* Make sure this is a 750 chip */
3465         mfspr   r4,PVR
3466         rlwinm  r4,r4,16,16,31
3467 -       cmpwi   r4,0x0008
3468 -       cmpwi   cr1,r4,0x000c
3469 -       cror    2,2,4*cr1+2
3470 -       bne     99f
3471 -
3472 -       /* Turn off interrupts and data relocation. */
3473 -       mfmsr   r7              /* Save MSR in r7 */
3474 -       rlwinm  r4,r7,0,17,15
3475 -       rlwinm  r4,r4,0,28,26   /* Turn off DR bit */
3476 +       cmplwi  r4,0x0008
3477 +       beq     thisIs750
3478 +       li      r3,-1
3479 +       blr
3480 +       
3481 +thisIs750:
3482 +       /* Get the current enable bit of the L2CR into r4 */
3483 +       mfspr   r4,L2CR
3484 +       mfmsr   r7
3485 +       
3486 +       /* See if we want to perform a global inval this time. */
3487 +       rlwinm  r6,r3,0,10,10   /* r6 contains the new invalidate bit */
3488 +       rlwinm. r5,r3,0,0,0     /* r5 contains the new enable bit */
3489 +       rlwinm  r3,r3,0,11,9    /* Turn off the invalidate bit */
3490 +       rlwimi  r3,r4,0,0,0     /* Keep the enable bit the same as it was. */
3491 +       bne     dontDisableCache /* Only disable the cache if L2CRApply
3492 +                                   has the enable bit off */
3493 +
3494 +disableCache:
3495 +       /* Disable the cache.  First, we turn off interrupts.
3496 +          An interrupt while we are flushing the cache could bring
3497 +          in data which may not get properly flushed. */
3498 +       rlwinm  r4,r7,0,17,15   /* Turn off EE bit */
3499         sync
3500         mtmsr   r4
3501         sync
3502 -
3503 -       /* Get the current enable bit of the L2CR into r4 */
3504 -       mfspr   r4,L2CR
3505         
3506 -       /* Tweak some bits */
3507 -       rlwinm  r5,r3,0,0,0             /* r5 contains the new enable bit */
3508 -       rlwinm  r3,r3,0,11,9            /* Turn off the invalidate bit */
3509 -       rlwinm  r3,r3,0,1,31            /* Turn off the enable bit */
3510 -
3511 -       /* Check to see if we need to flush */
3512 -       rlwinm. r4,r4,0,0,0
3513 -       beq     2f
3514 -
3515 -       /* Flush the cache. First, read the first 4MB of memory (physical) to
3516 -        * put new data in the cache.  (Actually we only need
3517 -        * the size of the L2 cache plus the size of the L1 cache, but 4MB will
3518 -        * cover everything just to be safe).
3519 -        */
3520 -               
3521 -        /**** Might be a good idea to set L2DO here - to prevent instructions
3522 -              from getting into the cache.  But since we invalidate
3523 -              the next time we enable the cache it doesn't really matter.
3524 -         ****/
3525 -
3526 -       lis     r4,0x0002
3527 +/*
3528 +       Now, read the first 2MB of memory to put new data in the cache.
3529 +       (Actually we only need the size of the L2 cache plus the size
3530 +       of the L1 cache, but 2MB will cover everything just to be safe).
3531 +*/
3532 +       lis     r4,0x0001
3533         mtctr   r4
3534 -       li      r4,0
3535 -1:
3536 -       lwzx    r0,r0,r4
3537 -       addi    r4,r4,32                /* Go to start of next cache line */
3538 +       lis     r4,KERNELBASE@h
3539 +1:     lwzx    r0,r0,r4
3540 +       addi    r4,r4,0x0020            /* Go to start of next cache line */
3541         bdnz    1b
3542         
3543 -       /* Now, flush the first 4MB of memory */
3544 -       lis     r4,0x0002
3545 +       /* Now, flush the first 2MB of memory */
3546 +       lis     r4,0x0001
3547         mtctr   r4
3548 -       li      r4,0
3549 +       lis     r4,KERNELBASE@h
3550         sync
3551 -1:
3552 -       dcbf    r0,r4
3553 -       addi    r4,r4,32                /* Go to start of next cache line */
3554 -       bdnz    1b
3555 -
3556 -2:
3557 -       /* Set up the L2CR configuration bits (and switch L2 off) */
3558 +2:     dcbf    r0,r4
3559 +       addi    r4,r4,0x0020    /* Go to start of next cache line */
3560 +       bdnz    2b
3561 +       
3562 +       /* Turn off the L2CR enable bit. */
3563 +       rlwinm  r3,r3,0,1,31
3564 +       
3565 +dontDisableCache:
3566 +       /* Set up the L2CR configuration bits */
3567         sync
3568         mtspr   L2CR,r3
3569         sync
3570  
3571 -       /* Before we perform the global invalidation, we must disable dynamic
3572 -        * power management via HID0[DPM] to work around a processor bug where
3573 -        * DPM can possibly interfere with the state machine in the processor
3574 -        * that invalidates the L2 cache tags.
3575 -        */
3576 -       mfspr   r8,HID0                 /* Save HID0 in r8 */
3577 -       rlwinm  r4,r8,0,12,10           /* Turn off HID0[DPM] */
3578 -       sync
3579 -       mtspr   HID0,r4                 /* Disable DPM */
3580 +       /* Reenable interrupts if necessary. */
3581 +       mtmsr   r7
3582         sync
3583 -
3584 +       
3585 +       cmplwi  r6,0
3586 +       beq     noInval
3587 +       
3588         /* Perform a global invalidation */
3589         oris    r3,r3,0x0020
3590         sync
3591         mtspr   L2CR,r3
3592         sync
3593 -       isync                           /* For errata */
3594  
3595         /* Wait for the invalidation to complete */
3596  3:     mfspr   r3,L2CR
3597 @@ -740,38 +636,25 @@
3598         mtspr   L2CR,r3
3599         sync
3600         
3601 -       /* Restore HID0[DPM] to whatever it was before */
3602 -       sync
3603 -       mtspr   1008,r8
3604 -       sync
3605 -
3606 +noInval:
3607         /* See if we need to enable the cache */
3608         cmplwi  r5,0
3609 -       beq     4f
3610 +       beqlr
3611  
3612         /* Enable the cache */
3613         oris    r3,r3,0x8000
3614         mtspr   L2CR,r3
3615         sync
3616 -
3617 -       /* Restore MSR (restores EE and DR bits to original state) */
3618 -4:     sync
3619 -       mtmsr   r7
3620 -       sync
3621 -       blr
3622 -
3623 -99:    li      r3,-1
3624         blr
3625  
3626  _GLOBAL(_get_L2CR)
3627         /* Make sure this is a 750 chip */
3628         mfspr   r3,PVR
3629 -       srwi    r3,r3,16
3630 -       cmpwi   r3,0x0008
3631 -       cmpwi   cr1,r3,0x000c
3632 +       rlwinm  r3,r3,16,16,31
3633 +       cmplwi  r3,0x0008
3634         li      r3,0
3635 -       cror    2,2,4*cr1+2
3636         bnelr
3637 +       
3638         /* Return the L2CR contents */
3639         mfspr   r3,L2CR
3640         blr
3641 @@ -779,6 +662,16 @@
3642  /* --- End of PowerLogix code ---
3643   */
3644  
3645 +/*
3646 +_GLOBAL(_get_L2CR)
3647 +       mfspr   r3,L2CR
3648 +       blr
3649 +
3650 +_GLOBAL(_set_L2CR)
3651 +       mtspr   L2CR,r3
3652 +       blr
3653 +               
3654 +*/
3655  
3656  /*
3657   * These are used in the alignment trap handler when emulating
3658 @@ -1036,7 +929,11 @@
3659         .long sys_getresuid     /* 165 */
3660         .long sys_query_module
3661         .long sys_poll
3662 +#ifdef CONFIG_NFSD
3663         .long sys_nfsservctl
3664 +#else
3665 +       .long sys_ni_syscall
3666 +#endif         
3667         .long sys_setresgid
3668         .long sys_getresgid     /* 170 */
3669         .long sys_prctl
3670 @@ -1058,18 +955,4 @@
3671         .long sys_ni_syscall            /* streams1 */
3672         .long sys_ni_syscall            /* streams2 */
3673         .long sys_vfork
3674 -       .long sys_ni_syscall            /* 190 */       /* MacOnLinux - old */
3675 -       .long sys_ni_syscall            /* 191 */       /* Unused */
3676 -       .long sys_ni_syscall            /* 192 - reserved - mmap2 */
3677 -       .long sys_ni_syscall            /* 193 - reserved - truncate64 */
3678 -       .long sys_ni_syscall            /* 194 - reserved - ftruncate64 */
3679 -       .long sys_ni_syscall            /* 195 - reserved - stat64 */
3680 -       .long sys_ni_syscall            /* 196 - reserved - lstat64 */
3681 -       .long sys_ni_syscall            /* 197 - reserved - fstat64 */
3682 -       .long sys_pciconfig_read        /* 198 */
3683 -       .long sys_pciconfig_write       /* 199 */
3684 -       .long sys_pciconfig_iobase      /* 200 */
3685 -       .long sys_ni_syscall            /* 201 - reserved - MacOnLinux - new */
3686 -       .rept NR_syscalls-201
3687 -               .long sys_ni_syscall
3688 -       .endr
3689 +       .space (NR_syscalls-183)*4
3690 diff -urN linux.orig/arch/ppc/kernel/mk_defs.c linux/arch/ppc/kernel/mk_defs.c
3691 --- linux.orig/arch/ppc/kernel/mk_defs.c        Fri Nov  2 17:39:05 2001
3692 +++ linux/arch/ppc/kernel/mk_defs.c     Thu Jul 11 15:43:29 2002
3693 @@ -8,7 +8,7 @@
3694   * #defines from the assembly-language output.
3695   */
3696  
3697 -#include <linux/config.h>
3698 +#include <stddef.h>
3699  #include <linux/signal.h>
3700  #include <linux/sched.h>
3701  #include <linux/kernel.h>
3702 @@ -22,6 +22,7 @@
3703  #include <asm/page.h>
3704  #include <asm/pgtable.h>
3705  #include <asm/processor.h>
3706 +#include <asm/pf-compat.h>
3707  
3708  #define DEFINE(sym, val) \
3709         asm volatile("\n#define\t" #sym "\t%0" : : "i" (val))
3710 @@ -43,18 +44,11 @@
3711         DEFINE(PGD, offsetof(struct mm_struct, pgd));
3712         DEFINE(LAST_SYSCALL, offsetof(struct thread_struct, last_syscall));
3713         DEFINE(PT_REGS, offsetof(struct thread_struct, regs));
3714 -       DEFINE(PT_TRACESYS, PT_TRACESYS);
3715 +       DEFINE(PF_TRACESYS, PF_TRACESYS);
3716         DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
3717 -       DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));
3718         DEFINE(NEED_RESCHED, offsetof(struct task_struct, need_resched));
3719         DEFINE(TSS_FPR0, offsetof(struct thread_struct, fpr[0]));
3720         DEFINE(TSS_FPSCR, offsetof(struct thread_struct, fpscr));
3721 -#ifdef CONFIG_ALTIVEC
3722 -       DEFINE(TSS_VR0, offsetof(struct thread_struct, vr[0]));
3723 -       DEFINE(TSS_VRSAVE, offsetof(struct thread_struct, vrsave));
3724 -       DEFINE(TSS_VSCR, offsetof(struct thread_struct, vscr));
3725 -#endif /* CONFIG_ALTIVEC */
3726 -
3727         /* Interrupt register frame */
3728         DEFINE(TASK_UNION_SIZE, sizeof(union task_union));
3729         DEFINE(STACK_FRAME_OVERHEAD, STACK_FRAME_OVERHEAD);
3730 diff -urN linux.orig/arch/ppc/kernel/open_pic.c linux/arch/ppc/kernel/open_pic.c
3731 --- linux.orig/arch/ppc/kernel/open_pic.c       Sun Mar 25 18:31:49 2001
3732 +++ linux/arch/ppc/kernel/open_pic.c    Thu Jul 11 15:43:29 2002
3733 @@ -1,126 +1,48 @@
3734 -/*
3735 - * open_pic.c
3736 - *
3737 - * Common support routines for platforms with an OpenPIC interrupt controller
3738 - *
3739 - */
3740 -
3741  #include <linux/stddef.h>
3742  #include <linux/init.h>
3743  #include <linux/sched.h>
3744  #include <linux/signal.h>
3745  #include <linux/openpic.h>
3746  #include <asm/irq.h>
3747 -#include <asm/processor.h>
3748  #include "open_pic.h"
3749  #include "i8259.h"
3750  
3751 -extern volatile unsigned char *chrp_int_ack_special;
3752 -
3753 -void open_pic_do_IRQ(struct pt_regs *regs, int cpu, int isfake)
3754 -{
3755 -       int irq;
3756 -        int openpic_eoi_done = 0;
3757 -
3758  #ifdef __SMP__
3759 -        {
3760 -                unsigned int loops = 1000000;
3761 -                while (test_bit(0, &global_irq_lock)) {
3762 -                        if (smp_processor_id() == global_irq_holder) {
3763 -                                printk("uh oh, interrupt while we hold global irq lock!\n");
3764 -#ifdef CONFIG_XMON
3765 -                                xmon(0);
3766 -#endif
3767 -                                break;
3768 -                        }
3769 -                        if (loops-- == 0) {
3770 -                                printk("do_IRQ waiting for irq lock (holder=%d)\n", global_irq_holder);
3771 -#ifdef CONFIG_XMON
3772 -                                xmon(0);
3773 -#endif
3774 -                        }
3775 -                }
3776 -        }
3777 +void openpic_ipi_action(int cpl, void *dev_id, struct pt_regs *regs)
3778 +{
3779 +       smp_message_recv(cpl-OPENPIC_VEC_IPI);
3780 +}
3781  #endif /* __SMP__ */
3782 -       
3783 -        irq = openpic_irq(smp_processor_id());
3784 -       /* make sure open_pic.irq_offset is set to something!
3785 -        * do we really need the _MACH_Pmac test??
3786 -        */
3787 -        if (!(_machine == _MACH_Pmac) && (irq == open_pic.irq_offset))
3788 -        {
3789 -                /*
3790 -                 * This magic address generates a PCI IACK cycle.
3791 -                 *
3792 -                 * This should go in the above mask/ack code soon. -- Cort
3793 -                 */
3794 -               if ( chrp_int_ack_special )
3795 -                       irq = *chrp_int_ack_special;
3796 -#ifndef CONFIG_PMAC
3797 -               else
3798 -                       irq = i8259_irq(0);
3799 -#endif
3800 -                /*
3801 -                 * Acknowledge as soon as possible to allow i8259
3802 -                 * interrupt nesting                         */
3803 -                openpic_eoi(smp_processor_id());
3804 -                openpic_eoi_done = 1;
3805 -        }
3806 -        if (irq == OPENPIC_VEC_SPURIOUS)
3807 -        {
3808 -                /*
3809 -                 * Spurious interrupts should never be
3810 -                 * acknowledged
3811 -                 */
3812 -                ppc_spurious_interrupts++;
3813 -                openpic_eoi_done = 1;
3814 -               goto out;
3815 -        }
3816  
3817 -        if (irq < 0)
3818 -        {
3819 -                printk(KERN_DEBUG "Bogus interrupt %d from PC = %lx\n",
3820 -                       irq, regs->nip);
3821 -                ppc_spurious_interrupts++;
3822 -        }
3823 -       else
3824 -        {
3825 -               ppc_irq_dispatch_handler( regs, irq );
3826 -       }
3827 -out:
3828 -        if (!openpic_eoi_done)
3829 -                openpic_eoi(smp_processor_id());
3830 +void chrp_mask_and_ack_irq(unsigned int irq_nr)
3831 +{
3832 +       if ((_machine != _MACH_gemini) && is_8259_irq(irq_nr))
3833 +               i8259_pic.mask_and_ack(irq_nr);
3834  }
3835  
3836 -#ifdef __SMP__
3837 -void openpic_ipi_action(int cpl, void *dev_id, struct pt_regs *regs)
3838 +static void chrp_mask_irq(unsigned int irq_nr)
3839  {
3840 -       smp_message_recv(cpl-OPENPIC_VEC_IPI);
3841 +       if ((_machine != _MACH_gemini) && is_8259_irq(irq_nr))
3842 +               i8259_pic.disable(irq_nr);
3843 +       else
3844 +               openpic_disable_irq(irq_nr-open_pic.irq_offset);
3845  }
3846 -#endif /* __SMP__ */
3847  
3848 +static void chrp_unmask_irq(unsigned int irq_nr)
3849 +{
3850 +       if ((_machine != _MACH_gemini) && is_8259_irq(irq_nr))
3851 +               i8259_pic.enable(irq_nr);
3852 +       else
3853 +               openpic_enable_irq(irq_nr-open_pic.irq_offset);
3854 +}
3855  
3856  struct hw_interrupt_type open_pic = {
3857         " OpenPIC  ",
3858         NULL,
3859         NULL,
3860         NULL,
3861 -       openpic_enable_irq,
3862 -       openpic_disable_irq,
3863 -       /* Theorically, the mask&ack should be NULL for OpenPIC. However, doing
3864 -        * so shows tons of bogus interrupts coming in.
3865 -        * This problem is apparently due to the common code always calling
3866 -        * unmask(). I apparently (need more test) fixed it in the 2.4 new IRQ
3867 -        * management by cleanly implementing the handler's end() function, so
3868 -        * neither mask nor unmask are needed. In the meantime, the fix below will
3869 -        * work for 2.2 -Benh
3870 -        *
3871 -        * Hopefully this will fix my bogus interrups on MTX
3872 -        * I merged everthing together so we don't have the same code in three
3873 -        * places. This might cause stability problems, but I'd rather
3874 -        * get it right once than three different times because someone forgot
3875 -        * to make the same change to PReP or something --Troy
3876 -        */
3877 -       openpic_disable_irq,
3878 +       chrp_unmask_irq,
3879 +       chrp_mask_irq,
3880 +       chrp_mask_and_ack_irq,
3881         0
3882  };
3883 diff -urN linux.orig/arch/ppc/kernel/open_pic.h linux/arch/ppc/kernel/open_pic.h
3884 --- linux.orig/arch/ppc/kernel/open_pic.h       Sun Mar 25 18:31:49 2001
3885 +++ linux/arch/ppc/kernel/open_pic.h    Thu Jul 11 15:43:29 2002
3886 @@ -6,7 +6,6 @@
3887  
3888  extern struct hw_interrupt_type open_pic;
3889  
3890 -void open_pic_do_IRQ(struct pt_regs *regs, int cpu, int isfake);
3891  void openpic_ipi_action(int cpl, void *dev_id, struct pt_regs *regs);
3892  void openpic_enable_IPI(u_int ipi);
3893  void do_openpic_setup_cpu(void);
3894 diff -urN linux.orig/arch/ppc/kernel/openpic.c linux/arch/ppc/kernel/openpic.c
3895 --- linux.orig/arch/ppc/kernel/openpic.c        Fri Nov  2 17:39:05 2001
3896 +++ linux/arch/ppc/kernel/openpic.c     Thu Jul 11 15:43:29 2002
3897 @@ -5,11 +5,6 @@
3898   *
3899   *  Fixed up IPI and restructured a bit
3900   *    Cort Dougan <cort@ppc.kernel.org>
3901 - *
3902 - *  Added initialisation code for Apple Core99 machines, tweaked a few things
3903 - *  to avoid bogus interrupts and to make sure the disable function exits with
3904 - *  the interrupt actually masked. --BenH
3905 - *  Todo: map interrupts to all available CPUs after the ack round
3906   * 
3907   *  This file is subject to the terms and conditions of the GNU General Public
3908   *  License.  See the file COPYING in the main directory of this archive
3909 @@ -26,16 +21,11 @@
3910  #include <asm/io.h>
3911  #include <asm/irq.h>
3912  #include "open_pic.h"
3913 -#ifdef __powerpc__
3914 -#include <asm/prom.h>
3915 -#endif
3916  
3917  #define REGISTER_DEBUG
3918  #undef REGISTER_DEBUG
3919  
3920 -#ifdef __powerpc__
3921 -extern int use_of_interrupt_tree;
3922 -#endif
3923 +#define OPENPIC_SENSE_POLARITY                 0x00800000      /* Undoc'd */
3924  
3925  volatile struct OpenPIC *OpenPIC = NULL;
3926  u_int OpenPIC_NumInitSenses __initdata = 0;
3927 @@ -92,7 +82,7 @@
3928   *  I/O functions
3929   */
3930  #ifdef __i386__
3931 -static inline u_int in_le32(volatile u_int *addr)
3932 +static inline u_int ld_le32(volatile u_int *addr)
3933  {
3934         return *addr;
3935  }
3936 @@ -107,7 +97,7 @@
3937  {
3938         u_int val;
3939  
3940 -       val = in_le32(addr);
3941 +       val = ld_le32(addr);
3942  #ifdef REGISTER_DEBUG
3943         printk("openpic_read(0x%08x) = 0x%08x\n", (u_int)addr, val);
3944  #endif
3945 @@ -154,9 +144,6 @@
3946  {
3947         openpic_setfield(addr, OPENPIC_MASK);
3948         /* wait until it's not in use */
3949 -       /* BenH: Is this code really enough ? I would rather check the result
3950 -        *       and eventually retry ...
3951 -        */
3952         while (openpic_read(addr) & OPENPIC_ACTIVITY);
3953         openpic_writefield(addr, mask | OPENPIC_MASK, field | OPENPIC_MASK);
3954  }
3955 @@ -164,20 +151,7 @@
3956  /*
3957   *  Initialize the OpenPIC
3958   */
3959 -
3960 -/* PoweMac note:
3961 - *
3962 - * With BootX, we consider the controller as beeing already initialized by MacOS
3963 - * and we only mask out interrupts.
3964 - * With OF booting, we initialize the interrupts that we find in the device tree,
3965 - * other ones are just masked out.
3966 - * Note: We might want to adjust priorities too.
3967 - */
3968 -
3969 -/* Not an init func, called on pbook wakeup --BenH */
3970 -void
3971 -__init
3972 -openpic_init(int main_pic)
3973 +__initfunc(void openpic_init(int main_pic))
3974  {
3975         u_int t, i;
3976         u_int timerfreq;
3977 @@ -207,16 +181,13 @@
3978                       OPENPIC_FEATURE_LAST_SOURCE_SHIFT) + 1;
3979         printk("OpenPIC Version %s (%d CPUs and %d IRQ sources) at %p\n", version,
3980                NumProcessors, NumSources, OpenPIC);
3981 -       /* Apple's OpenPIC is an IBM MPIC without the timer. */
3982 -       if (_machine != _MACH_Pmac) {
3983 -               timerfreq = openpic_read(&OpenPIC->Global.Timer_Frequency);
3984 -               printk("OpenPIC timer frequency is ");
3985 -               if (timerfreq)
3986 -                       printk("%d Hz\n", timerfreq);
3987 -               else
3988 -                       printk("not set\n");
3989 -       }
3990 -       
3991 +       timerfreq = openpic_read(&OpenPIC->Global.Timer_Frequency);
3992 +       printk("OpenPIC timer frequency is ");
3993 +       if (timerfreq)
3994 +               printk("%d Hz\n", timerfreq);
3995 +       else
3996 +               printk("not set\n");
3997 +
3998         if ( main_pic )
3999         {
4000                 /* Initialize timer interrupts */
4001 @@ -229,60 +200,24 @@
4002             
4003                 /* Initialize IPI interrupts */
4004                 for (i = 0; i < OPENPIC_NUM_IPI; i++) {
4005 -                       openpic_initipi(i, 10+i, OPENPIC_VEC_IPI+i);
4006 +                       openpic_initipi(i, 10, OPENPIC_VEC_IPI+i);
4007                 }
4008             
4009 -               if (_machine != _MACH_Pmac) {
4010 -                       /* Initialize external interrupts */
4011 -                       for (i = 0; i < NumSources; i++) {
4012 -                           /* Enabled, Priority 8 */
4013 -                           openpic_initirq(i, 8, open_pic.irq_offset+i, 0,
4014 -                               i < OpenPIC_NumInitSenses ? OpenPIC_InitSenses[i] : 1);
4015 -                           /* Processor 0 */
4016 -                           openpic_mapirq(i, 1<<0);
4017 -                       }
4018 -               } else {
4019 -                       /* Prevent any interrupt from occurring during initialisation.
4020 -                        * Hum... I believe this is not necessary, Apple does that in
4021 -                        * Darwin's PowerExpress code.
4022 -                        */
4023 -                       openpic_set_priority(0, 0xf);
4024 -
4025 -                       /* First disable all interrupts and map them to CPU 0 */
4026 -                       for (i = 0; i < NumSources; i++) {
4027 -                               openpic_disable_irq(i);
4028 -                               openpic_mapirq(i, 1<<0);
4029 -                       }
4030 -                       
4031 -                       /* If we use the device tree, then lookup all interrupts and
4032 -                        * initialize them according to sense infos found in the tree
4033 -                        */
4034 -                       if (use_of_interrupt_tree) {
4035 -                               struct device_node* np = find_all_nodes();
4036 -                               while(np) {
4037 -                                   int j, pri;
4038 -                                   pri = strcmp(np->name, "programmer-switch") ? 2 : 7;
4039 -                                   for (j=0;j<np->n_intrs;j++) {
4040 -                                       openpic_initirq(        np->intrs[j].line,
4041 -                                                               pri,
4042 -                                                               np->intrs[j].line,
4043 -                                                               0,
4044 -                                                               np->intrs[j].sense);
4045 -                                       irq_desc[np->intrs[j].line].level = np->intrs[j].sense;
4046 -                                   }
4047 -                                   np = np->next;
4048 -                               }
4049 -                       } else {
4050 -                               /* Fixme: read level value from controller */
4051 -                               printk("openpic: WARNING, openpic running without interrupt tree\n");
4052 -                       }
4053 +               /* Initialize external interrupts */
4054 +               for (i = 0; i < NumSources; i++) {
4055 +                       /* Enabled, Priority 8 */
4056 +                       openpic_initirq(i, 8, open_pic.irq_offset+i, 0,
4057 +                                       i < OpenPIC_NumInitSenses ? OpenPIC_InitSenses[i] : 1);
4058 +                       /* Processor 0 */
4059 +                       openpic_mapirq(i, 1<<0);
4060                 }
4061 -
4062 +           
4063                 /* Initialize the spurious interrupt */
4064                 openpic_set_spurious(OPENPIC_VEC_SPURIOUS);
4065  
4066                 /* Gemini has no i8259 */
4067 -               if (( _machine != _MACH_gemini ) && (_machine != _MACH_Pmac)) {
4068 +               if ( _machine != _MACH_gemini )
4069 +               {
4070                         /* SIOint (8259 cascade) is special */
4071                         openpic_initirq(0, 8, open_pic.irq_offset, 1, 1);
4072                         openpic_mapirq(0, 1<<0);
4073 @@ -292,14 +227,6 @@
4074                 }
4075                 openpic_set_priority(0, 0);
4076                 openpic_disable_8259_pass_through();
4077 -
4078 -               /* We ack pending interrupts to avoid blocking them */
4079 -               if (_machine == _MACH_Pmac) {
4080 -                       for (i = 0; i < NumSources; i++) {
4081 -                               (void)openpic_irq(0);
4082 -                               openpic_eoi(0);
4083 -                       }
4084 -               }
4085         }
4086  }
4087  
4088 @@ -311,10 +238,6 @@
4089  {
4090         openpic_setfield(&OpenPIC->Global.Global_Configuration0,
4091                          OPENPIC_CONFIG_RESET);
4092 -       /* Wait for reset to complete */
4093 -       while(openpic_readfield(&OpenPIC->Global.Global_Configuration0,
4094 -                       OPENPIC_CONFIG_RESET))
4095 -               ;
4096  }
4097  
4098  
4099 @@ -360,7 +283,6 @@
4100  {
4101         check_arg_cpu(cpu);
4102         openpic_write(&OpenPIC->THIS_CPU.EOI, 0);
4103 -       (void)openpic_read(&OpenPIC->THIS_CPU.EOI);
4104  }
4105  
4106  
4107 @@ -465,12 +387,12 @@
4108         
4109         for ( i = 0; i < OPENPIC_NUM_IPI ; i++ )
4110                   openpic_enable_IPI(i);
4111 -
4112 +#if 0  
4113         /* let the openpic know we want intrs */
4114         for ( i = 0; i < NumSources ; i++ )
4115                 openpic_mapirq(i, openpic_read(&OpenPIC->Source[i].Destination)
4116                                | (1<<smp_processor_id()) );
4117 -
4118 +#endif 
4119         openpic_set_priority(smp_processor_id(), 0);
4120  }    
4121  
4122 @@ -506,43 +428,14 @@
4123   */
4124  void openpic_enable_irq(u_int irq)
4125  {
4126 -       /* on SMP, we get IPI vector numbers here, we should handle them
4127 -        * or at least ignore them.
4128 -        */
4129 -       if (irq < 0 || irq >= NumSources)
4130 -               return;
4131 +       check_arg_irq(irq);
4132         openpic_clearfield(&OpenPIC->Source[irq].Vector_Priority, OPENPIC_MASK);
4133 -       /* make sure mask gets to controller before we return to user */
4134 -       do {
4135 -               mb();
4136 -       } while(openpic_readfield(&OpenPIC->Source[irq].Vector_Priority,
4137 -                       OPENPIC_MASK));
4138 -}
4139 -
4140 -u_int openpic_get_enable(u_int irq)
4141 -{
4142 -       if (irq < 0 || irq >= NumSources)
4143 -               return 0;
4144 -       return !openpic_readfield(&OpenPIC->Source[irq].Vector_Priority,
4145 -                       OPENPIC_MASK);
4146  }
4147  
4148  void openpic_disable_irq(u_int irq)
4149  {
4150 -       u32 vp;
4151 -       
4152 -       /* on SMP, we get IPI vector numbers here, we should handle them
4153 -        * or at least ignore them.
4154 -        */
4155 -       if (irq < 0 || irq >= NumSources)
4156 -               return;
4157 +       check_arg_irq(irq);
4158         openpic_setfield(&OpenPIC->Source[irq].Vector_Priority, OPENPIC_MASK);
4159 -       /* make sure mask gets to controller before we return to user */
4160 -       do {
4161 -               mb();  /* sync is probably useless here */
4162 -               vp = openpic_readfield(&OpenPIC->Source[irq].Vector_Priority,
4163 -                       OPENPIC_MASK | OPENPIC_ACTIVITY);
4164 -       } while((vp & OPENPIC_ACTIVITY) && !(vp & OPENPIC_MASK));
4165  }
4166  
4167  /*
4168 @@ -561,11 +454,10 @@
4169         check_arg_vec(vec);
4170         openpic_safe_writefield(&OpenPIC->Source[irq].Vector_Priority,
4171                                 OPENPIC_PRIORITY_MASK | OPENPIC_VECTOR_MASK |
4172 -                               OPENPIC_POLARITY_MASK | OPENPIC_SENSE_MASK,
4173 +                               OPENPIC_SENSE_POLARITY | OPENPIC_SENSE_LEVEL,
4174                                 (pri << OPENPIC_PRIORITY_SHIFT) | vec |
4175 -                               (pol ? OPENPIC_POLARITY_POSITIVE :
4176 -                                       OPENPIC_POLARITY_NEGATIVE) |
4177 -                               (sense ? OPENPIC_SENSE_LEVEL : OPENPIC_SENSE_EDGE));
4178 +                               (pol ? OPENPIC_SENSE_POLARITY : 0) |
4179 +                               (sense ? OPENPIC_SENSE_LEVEL : 0));
4180  }
4181  
4182  /*
4183 @@ -589,7 +481,6 @@
4184                                 OPENPIC_SENSE_LEVEL,
4185                                 (sense ? OPENPIC_SENSE_LEVEL : 0));
4186  }
4187 -
4188  #ifdef CONFIG_PMAC_PBOOK
4189  static u32 save_ipi_vp[OPENPIC_NUM_IPI];
4190  static u32 save_irq_src_vp[OPENPIC_MAX_SOURCES];
4191 diff -urN linux.orig/arch/ppc/kernel/pci.c linux/arch/ppc/kernel/pci.c
4192 --- linux.orig/arch/ppc/kernel/pci.c    Sun Mar 25 18:31:48 2001
4193 +++ linux/arch/ppc/kernel/pci.c Thu Jul 11 15:43:29 2002
4194 @@ -10,20 +10,15 @@
4195  #include <linux/init.h>
4196  #include <linux/config.h>
4197  #include <linux/openpic.h>
4198 -#include <linux/capability.h>
4199 -#include <linux/sched.h>
4200 -#include <linux/errno.h>
4201  
4202  #include <asm/processor.h>
4203  #include <asm/io.h>
4204  #include <asm/prom.h>
4205  #include <asm/pci-bridge.h>
4206 -#include <asm/pci.h>
4207  #include <asm/residual.h>
4208  #include <asm/byteorder.h>
4209  #include <asm/irq.h>
4210  #include <asm/gg2.h>
4211 -#include <asm/uaccess.h>
4212  
4213  #include "pci.h"
4214  
4215 @@ -98,7 +93,7 @@
4216  
4217         for (; node != 0;node = node->sibling) {
4218                 class_code = (unsigned int *) get_property(node, "class-code", 0);
4219 -               if(class_code && (*class_code >> 8) == PCI_CLASS_BRIDGE_PCI)
4220 +               if((*class_code >> 8) == PCI_CLASS_BRIDGE_PCI)
4221                         fix_intr(node->child, dev);
4222                 reg = (unsigned int *) get_property(node, "reg", 0);
4223                 if (reg == 0 || ((reg[0] >> 8) & 0xff) != dev->devfn)
4224 @@ -110,156 +105,3 @@
4225         }
4226  }
4227  #endif
4228 -
4229 -
4230 -void *
4231 -pci_dev_io_base(unsigned char bus, unsigned char devfn, int physical)
4232 -{
4233 -       if (!ppc_md.pci_dev_io_base) {
4234 -               /* Please, someone fix this for non-pmac machines, we
4235 -                * need either the virtual or physical PCI IO base
4236 -                */
4237 -               return 0;
4238 -       }
4239 -       return ppc_md.pci_dev_io_base(bus, devfn, physical);
4240 -}
4241 -
4242 -void *
4243 -pci_dev_mem_base(unsigned char bus, unsigned char devfn)
4244 -{
4245 -       /* Default memory base is 0 (1:1 mapping) */
4246 -       if (!ppc_md.pci_dev_mem_base) {
4247 -               /* Please, someone fix this for non-pmac machines.*/
4248 -               return 0;
4249 -       }
4250 -       return ppc_md.pci_dev_mem_base(bus, devfn);
4251 -}
4252 -
4253 -/* Returns the root-bridge number (Uni-N number) of a device */
4254 -int
4255 -pci_dev_root_bridge(unsigned char bus, unsigned char devfn)
4256 -{
4257 -       /* Defaults to 0 */
4258 -       if (!ppc_md.pci_dev_root_bridge)
4259 -               return 0;
4260 -       return ppc_md.pci_dev_root_bridge(bus, devfn);
4261 -}
4262 -
4263 -/*
4264 - * Those syscalls are derived from the Alpha versions, they
4265 - * allow userland apps to retreive the per-device iobase and
4266 - * mem-base. They also provide wrapper for userland to do
4267 - * config space accesses.
4268 - * The "host_number" returns the number of the Uni-N sub bridge
4269 - */
4270 -
4271 -asmlinkage int
4272 -sys_pciconfig_read(unsigned long bus, unsigned long dfn,
4273 -                  unsigned long off, unsigned long len,
4274 -                  unsigned char *buf)
4275 -{
4276 -       unsigned char ubyte;
4277 -       unsigned short ushort;
4278 -       unsigned int uint;
4279 -       long err = 0;
4280 -
4281 -       if (!capable(CAP_SYS_ADMIN))
4282 -               return -EPERM;
4283 -       if (!pcibios_present())
4284 -               return -ENOSYS;
4285 -       
4286 -       switch (len) {
4287 -       case 1:
4288 -               err = pcibios_read_config_byte(bus, dfn, off, &ubyte);
4289 -               put_user(ubyte, buf);
4290 -               break;
4291 -       case 2:
4292 -               err = pcibios_read_config_word(bus, dfn, off, &ushort);
4293 -               put_user(ushort, (unsigned short *)buf);
4294 -               break;
4295 -       case 4:
4296 -               err = pcibios_read_config_dword(bus, dfn, off, &uint);
4297 -               put_user(uint, (unsigned int *)buf);
4298 -               break;
4299 -       default:
4300 -               err = -EINVAL;
4301 -               break;
4302 -       }
4303 -       return err;
4304 -}
4305 -
4306 -asmlinkage int
4307 -sys_pciconfig_write(unsigned long bus, unsigned long dfn,
4308 -                   unsigned long off, unsigned long len,
4309 -                   unsigned char *buf)
4310 -{
4311 -       unsigned char ubyte;
4312 -       unsigned short ushort;
4313 -       unsigned int uint;
4314 -       long err = 0;
4315 -
4316 -       if (!capable(CAP_SYS_ADMIN))
4317 -               return -EPERM;
4318 -       if (!pcibios_present())
4319 -               return -ENOSYS;
4320 -
4321 -       switch (len) {
4322 -       case 1:
4323 -               err = get_user(ubyte, buf);
4324 -               if (err)
4325 -                       break;
4326 -               err = pcibios_write_config_byte(bus, dfn, off, ubyte);
4327 -               if (err != PCIBIOS_SUCCESSFUL) {
4328 -                       err = -EFAULT;
4329 -               }
4330 -               break;
4331 -       case 2:
4332 -               err = get_user(ushort, (unsigned short *)buf);
4333 -               if (err)
4334 -                       break;
4335 -               err = pcibios_write_config_word(bus, dfn, off, ushort);
4336 -               if (err != PCIBIOS_SUCCESSFUL) {
4337 -                       err = -EFAULT;
4338 -               }
4339 -               break;
4340 -       case 4:
4341 -               err = get_user(uint, (unsigned int *)buf);
4342 -               if (err)
4343 -                       break;
4344 -               err = pcibios_write_config_dword(bus, dfn, off, uint);
4345 -               if (err != PCIBIOS_SUCCESSFUL) {
4346 -                       err = -EFAULT;
4347 -               }
4348 -               break;
4349 -       default:
4350 -               err = -EINVAL;
4351 -               break;
4352 -       }
4353 -       return err;
4354 -}
4355 -
4356 -/* Provide information on locations of various I/O regions in physical
4357 - * memory.  Do this on a per-card basis so that we choose the right
4358 - * root bridge.
4359 - * Note that the returned IO or memory base is a physical address
4360 - */
4361 -
4362 -asmlinkage long
4363 -sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
4364 -{
4365 -       long result = -EOPNOTSUPP;
4366 -       
4367 -       switch (which) {
4368 -       case IOBASE_BRIDGE_NUMBER:
4369 -               return (long)pci_dev_root_bridge(bus, devfn);
4370 -       case IOBASE_MEMORY:
4371 -               return (long)pci_dev_mem_base(bus, devfn);
4372 -       case IOBASE_IO:
4373 -               result = (long)pci_dev_io_base(bus, devfn, 1);
4374 -               if (result == 0)
4375 -                       result = -EOPNOTSUPP;
4376 -               break;
4377 -       }
4378 -
4379 -       return result;
4380 -}
4381 diff -urN linux.orig/arch/ppc/kernel/pmac_pci.c linux/arch/ppc/kernel/pmac_pci.c
4382 --- linux.orig/arch/ppc/kernel/pmac_pci.c       Fri Nov  2 17:39:05 2001
4383 +++ linux/arch/ppc/kernel/pmac_pci.c    Thu Jul 11 15:43:29 2002
4384 @@ -28,20 +28,6 @@
4385  struct bridge_data **bridges, *bridge_list;
4386  static int max_bus;
4387  
4388 -struct uninorth_data {
4389 -       struct device_node*     node;
4390 -       volatile unsigned int*  cfg_addr;
4391 -       volatile unsigned int*  cfg_data;
4392 -       void*                   iobase;
4393 -       void*                   iobase_phys;
4394 -};
4395 -
4396 -static struct uninorth_data uninorth_bridges[3];
4397 -static int uninorth_count;
4398 -static int uninorth_default = -1;
4399
4400 -
4401 -
4402  static void add_bridges(struct device_node *dev, unsigned long *mem_ptr);
4403  
4404  /*
4405 @@ -85,208 +71,6 @@
4406         return 0;
4407  }
4408  
4409 -/* This routines figures out on which root bridge a given PCI device
4410 - * is attached.
4411 - * 
4412 - * WARNING: When passed the address of the bridge itself (11), it must
4413 - *          return the AGP bus. Currently, it returns 0, which is by
4414 - *          chance the AGP one. We may have to improve that however...
4415 - */
4416 -__pmac
4417 -int
4418 -pmac_pci_dev_root_bridge(unsigned char bus, unsigned char dev_fn)
4419 -{
4420 -       struct device_node *node, *bridge_node;
4421 -       int bridge = uninorth_default;
4422 -
4423 -       if (uninorth_count == 0)
4424 -               return 0;
4425 -       if (bus == 0 && PCI_SLOT(dev_fn) < 11)
4426 -               return 0;
4427 -       
4428 -       /* We look for the OF device corresponding to this bus/devfn pair. If we
4429 -        * don't find it, we default to the external PCI */
4430 -       bridge_node = NULL;
4431 -       node = find_pci_device_OFnode(bus, dev_fn & 0xf8);
4432 -       if (node) {
4433 -           /* note: we don't stop on the first occurrence since we need to go
4434 -             * up to the root bridge */
4435 -           do {
4436 -               if (node->type && !strcmp(node->type, "pci") 
4437 -                       && device_is_compatible(node, "uni-north"))
4438 -                       bridge_node = node;
4439 -               node=node->parent;
4440 -           } while (node);
4441 -       }
4442 -       if (bridge_node) {
4443 -           int i;
4444 -           for (i=0;i<uninorth_count;i++)
4445 -               if (uninorth_bridges[i].node == bridge_node) {
4446 -                   bridge = i;
4447 -                   break;
4448 -               }
4449 -       }
4450 -
4451 -       if (bridge == -1) {
4452 -               printk(KERN_WARNING "pmac_pci: no default bridge !\n");
4453 -               return 0;
4454 -       }
4455 -
4456 -       return bridge;  
4457 -}
4458 -
4459 -__pmac
4460 -void *
4461 -pmac_pci_dev_io_base(unsigned char bus, unsigned char devfn, int physical)
4462 -{
4463 -       int bridge = -1;
4464 -       if (uninorth_count != 0)
4465 -               bridge = pmac_pci_dev_root_bridge(bus, devfn);
4466 -       if (bridge == -1) {
4467 -               struct bridge_data *bp;
4468 -
4469 -               if (bus > max_bus || (bp = bridges[bus]) == 0)
4470 -                       return 0;
4471 -               return physical ? bp->io_base_phys : bp->io_base;
4472 -       }
4473 -       return physical ? uninorth_bridges[bridge].iobase_phys
4474 -               : uninorth_bridges[bridge].iobase;
4475 -}
4476 -
4477 -__pmac
4478 -void *
4479 -pmac_pci_dev_mem_base(unsigned char bus, unsigned char devfn)
4480 -{
4481 -       return 0;
4482 -}
4483 -
4484 -/* This function only works for bus 0, uni-N uses a different mecanism for
4485 - * other busses (see below)
4486 - */
4487 -#define UNI_N_CFA0(devfn, off) \
4488 -       ((1 << (unsigned long)PCI_SLOT(dev_fn)) \
4489 -       | (((unsigned long)PCI_FUNC(dev_fn)) << 8) \
4490 -       | (((unsigned long)(off)) & 0xFCUL))
4491 -
4492 -/* This one is for type 1 config accesses */
4493 -#define UNI_N_CFA1(bus, devfn, off)    \
4494 -       ((((unsigned long)(bus)) << 16) \
4495 -       |(((unsigned long)(devfn)) << 8) \
4496 -       |(((unsigned long)(off)) & 0xFCUL) \
4497 -       |1UL)
4498 -       
4499 -
4500 -__pmac static
4501 -unsigned int
4502 -uni_north_access_data(unsigned char bus, unsigned char dev_fn,
4503 -                               unsigned char offset)
4504 -{
4505 -       int bridge;
4506 -       unsigned int caddr;
4507 -
4508 -       bridge = pmac_pci_dev_root_bridge(bus, dev_fn);
4509 -       if (bus == 0)
4510 -               caddr = UNI_N_CFA0(dev_fn, offset);
4511 -       else
4512 -               caddr = UNI_N_CFA1(bus, dev_fn, offset);
4513 -       
4514 -       if (bridge == -1) {
4515 -               printk(KERN_WARNING "pmac_pci: no default bridge !\n");
4516 -               return 0;
4517 -       }
4518 -               
4519 -       /* Uninorth will return garbage if we don't read back the value ! */
4520 -       out_le32(uninorth_bridges[bridge].cfg_addr, caddr);
4521 -       (void)in_le32(uninorth_bridges[bridge].cfg_addr);
4522 -       /* Yes, offset is & 7, not & 3 ! */
4523 -       return (unsigned int)(uninorth_bridges[bridge].cfg_data) + (offset & 0x07);
4524 -}
4525 -
4526 -__pmac
4527 -int uni_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn,
4528 -                                 unsigned char offset, unsigned char *val)
4529 -{
4530 -       unsigned int addr;
4531 -       
4532 -       *val = 0xff;
4533 -       addr = uni_north_access_data(bus, dev_fn, offset);
4534 -       if (!addr)
4535 -               return PCIBIOS_DEVICE_NOT_FOUND;
4536 -       *val = in_8((volatile unsigned char*)addr);
4537 -       return PCIBIOS_SUCCESSFUL;
4538 -}
4539 -
4540 -__pmac
4541 -int uni_pcibios_read_config_word(unsigned char bus, unsigned char dev_fn,
4542 -                                 unsigned char offset, unsigned short *val)
4543 -{
4544 -       unsigned int addr;
4545 -       
4546 -       *val = 0xffff;
4547 -       addr = uni_north_access_data(bus, dev_fn, offset);
4548 -       if (!addr)
4549 -               return PCIBIOS_DEVICE_NOT_FOUND;
4550 -       *val = in_le16((volatile unsigned short*)addr);
4551 -       return PCIBIOS_SUCCESSFUL;
4552 -}
4553 -
4554 -__pmac
4555 -int uni_pcibios_read_config_dword(unsigned char bus, unsigned char dev_fn,
4556 -                                  unsigned char offset, unsigned int *val)
4557 -{
4558 -       unsigned int addr;
4559 -       
4560 -       *val = 0xffff;
4561 -       addr = uni_north_access_data(bus, dev_fn, offset);
4562 -       if (!addr)
4563 -               return PCIBIOS_DEVICE_NOT_FOUND;
4564 -       *val = in_le32((volatile unsigned int*)addr);
4565 -       return PCIBIOS_SUCCESSFUL;
4566 -}
4567 -
4568 -__pmac
4569 -int uni_pcibios_write_config_byte(unsigned char bus, unsigned char dev_fn,
4570 -                                  unsigned char offset, unsigned char val)
4571 -{
4572 -       unsigned int addr;
4573 -       
4574 -       addr = uni_north_access_data(bus, dev_fn, offset);
4575 -       if (!addr)
4576 -               return PCIBIOS_DEVICE_NOT_FOUND;
4577 -       out_8((volatile unsigned char *)addr, val);
4578 -       (void)in_8((volatile unsigned char *)addr);
4579 -       return PCIBIOS_SUCCESSFUL;
4580 -}
4581 -
4582 -__pmac
4583 -int uni_pcibios_write_config_word(unsigned char bus, unsigned char dev_fn,
4584 -                                  unsigned char offset, unsigned short val)
4585 -{
4586 -       unsigned int addr;
4587 -       
4588 -       addr = uni_north_access_data(bus, dev_fn, offset);
4589 -       if (!addr)
4590 -               return PCIBIOS_DEVICE_NOT_FOUND;
4591 -       out_le16((volatile unsigned short *)addr, val);
4592 -       (void)in_le16((volatile unsigned short *)addr);
4593 -       return PCIBIOS_SUCCESSFUL;
4594 -}
4595 -
4596 -__pmac
4597 -int uni_pcibios_write_config_dword(unsigned char bus, unsigned char dev_fn,
4598 -                                   unsigned char offset, unsigned int val)
4599 -{
4600 -       unsigned int addr;
4601 -       
4602 -       addr = uni_north_access_data(bus, dev_fn, offset);
4603 -       if (!addr)
4604 -               return PCIBIOS_DEVICE_NOT_FOUND;
4605 -       out_le32((volatile unsigned int *)addr, val);
4606 -       (void)in_le32((volatile unsigned int *)addr);
4607 -       return PCIBIOS_SUCCESSFUL;
4608 -}
4609 -
4610 -
4611  __pmac
4612  int pmac_pcibios_read_config_byte(unsigned char bus, unsigned char dev_fn,
4613                                   unsigned char offset, unsigned char *val)
4614 @@ -576,80 +360,6 @@
4615                bp->io_base);
4616  }
4617  
4618 -#define GRACKLE_PICR1_STG              0x00000040
4619 -#define GRACKLE_PICR1_LOOPSNOOP                0x00000010
4620 -
4621 -/* N.B. this is called before bridges is initialized, so we can't
4622 -   use grackle_pcibios_{read,write}_config_dword. */
4623 -static inline void grackle_set_stg(struct bridge_data *bp, int enable)
4624 -{
4625 -       unsigned int val;
4626 -
4627 -       out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
4628 -       val = in_le32((volatile unsigned int *)bp->cfg_data);
4629 -       val = enable? (val | GRACKLE_PICR1_STG) :
4630 -               (val & ~GRACKLE_PICR1_STG);
4631 -       out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
4632 -       out_le32((volatile unsigned int *)bp->cfg_data, val);
4633 -}
4634 -
4635 -static inline void grackle_set_loop_snoop(struct bridge_data *bp, int enable)
4636 -{
4637 -       unsigned int val;
4638 -
4639 -       out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
4640 -       val = in_le32((volatile unsigned int *)bp->cfg_data);
4641 -       val = enable? (val | GRACKLE_PICR1_LOOPSNOOP) :
4642 -               (val & ~GRACKLE_PICR1_LOOPSNOOP);
4643 -       out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
4644 -       out_le32((volatile unsigned int *)bp->cfg_data, val);
4645 -}
4646 -
4647 -static int __init
4648 -fixup_one_level_bus_range(struct device_node *node, int higher)
4649 -{
4650 -       for (; node != 0;node = node->sibling) {
4651 -               int * bus_range;
4652 -               unsigned int *class_code;                       
4653 -               int len;
4654 -
4655 -               /* For PCI<->PCI bridges or CardBus bridges, we go down */
4656 -               class_code = (unsigned int *) get_property(node, "class-code", 0);
4657 -               if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
4658 -                       (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
4659 -                       continue;
4660 -               bus_range = (int *) get_property(node, "bus-range", &len);
4661 -               if (bus_range != NULL && len > 2 * sizeof(int)) {
4662 -                       if (bus_range[1] > higher)
4663 -                               higher = bus_range[1];
4664 -               }
4665 -               higher = fixup_one_level_bus_range(node->child, higher);
4666 -       }
4667 -       return higher;
4668 -}
4669 -
4670 -/* This routine fixes the "bus-range" property of all bridges in the
4671 - * system since they tend to have their "last" member wrong on macs
4672 - * 
4673 - * Note that the bus numbers manipulated here are OF bus numbers, they
4674 - * are not Linux bus numbers.
4675 - */
4676 -static void __init
4677 -fixup_bus_range(struct device_node *bridge)
4678 -{
4679 -       int * bus_range;
4680 -       int len;
4681 -       
4682 -       /* Lookup the "bus-range" property for the hose */              
4683 -       bus_range = (int *) get_property(bridge, "bus-range", &len);
4684 -       if (bus_range == NULL || len < 2 * sizeof(int)) {
4685 -               printk(KERN_WARNING "Can't get bus-range for %s\n",
4686 -                              bridge->full_name);
4687 -               return;
4688 -       }
4689 -       bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]);
4690 -}
4691 -
4692  __initfunc(unsigned long pmac_find_bridges(unsigned long mem_start, unsigned long mem_end))
4693  {
4694         int bus;
4695 @@ -689,7 +399,6 @@
4696                                dev->full_name);
4697                         continue;
4698                 }
4699 -               fixup_bus_range(dev);
4700                 bus_range = (int *) get_property(dev, "bus-range", &len);
4701                 if (bus_range == NULL || len < 2 * sizeof(int)) {
4702                         printk(KERN_WARNING "Can't get bus-range for %s\n",
4703 @@ -702,54 +411,21 @@
4704                         printk(KERN_INFO "PCI buses %d..%d", bus_range[0],
4705                                bus_range[1]);
4706                 printk(" controlled by %s at %x\n", dev->name, addr->address);
4707 -               if (device_is_compatible(dev, "uni-north")) {
4708 -                       int i = uninorth_count++;
4709 -                       uninorth_bridges[i].cfg_addr = ioremap(addr->address + 0x800000, 0x1000);
4710 -                       uninorth_bridges[i].cfg_data = ioremap(addr->address + 0xc00000, 0x1000);
4711 -                       uninorth_bridges[i].node = dev;
4712 -                       uninorth_bridges[i].iobase_phys = (void *)addr->address;
4713 -                       /* is 0x10000 enough for io space ? */
4714 -                       uninorth_bridges[i].iobase = (void *)ioremap(addr->address, 0x10000);
4715 -                       /* XXX This is the bridge with the PCI expansion bus. This is also the
4716 -                        * address of the bus that will receive type 1 config accesses and io
4717 -                        * accesses. Appears to be correct for iMac DV and G4 Sawtooth too.
4718 -                        * That means that we cannot do io cycles on the AGP bus nor the internal
4719 -                        * ethernet/fw bus. Fortunately, they appear not to be needed on iMac DV
4720 -                        * and G4 neither.
4721 -                        */
4722 -                       if (addr->address == 0xf2000000)
4723 -                               uninorth_default = i;
4724 -                       else
4725 -                               continue;
4726 -               }
4727                 bp = (struct bridge_data *) *mem_ptr;
4728                 *mem_ptr += sizeof(struct bridge_data);
4729 -               if (device_is_compatible(dev, "uni-north")) {
4730 -                       bp->cfg_addr = 0;
4731 -                       bp->cfg_data = 0;
4732 -                       bp->io_base = uninorth_bridges[uninorth_count-1].iobase;
4733 -                       bp->io_base_phys = uninorth_bridges[uninorth_count-1].iobase_phys;
4734 -               } else if (strcmp(dev->name, "pci") == 0) {
4735 -                       /* XXX assume this is a mpc106 (grackle) */
4736 -                       bp->cfg_addr = (volatile unsigned int *)
4737 -                               ioremap(0xfec00000, 0x1000);
4738 -                       bp->cfg_data = (volatile unsigned char *)
4739 -                               ioremap(0xfee00000, 0x1000);
4740 -                        bp->io_base = (void *) ioremap(0xfe000000, 0x20000);
4741 -                        bp->io_base_phys = (void *)0xfe000000;
4742 -                        if (machine_is_compatible("AAPL,PowerBook1998"))
4743 -                               grackle_set_loop_snoop(bp, 1);
4744 -#if 0                  /* Disabled for now, HW problems ??? */
4745 -                       grackle_set_stg(bp, 1);
4746 -#endif
4747 -               } else {
4748 -                       /* a `bandit' or `chaos' bridge */
4749 +               if (strcmp(dev->name, "pci") != 0) {
4750                         bp->cfg_addr = (volatile unsigned int *)
4751                                 ioremap(addr->address + 0x800000, 0x1000);
4752                         bp->cfg_data = (volatile unsigned char *)
4753                                 ioremap(addr->address + 0xc00000, 0x1000);
4754                         bp->io_base = (void *) ioremap(addr->address, 0x10000);
4755 -                       bp->io_base_phys = (void *)addr->address;
4756 +               } else {
4757 +                       /* XXX */
4758 +                       bp->cfg_addr = (volatile unsigned int *)
4759 +                               ioremap(0xfec00000, 0x1000);
4760 +                       bp->cfg_data = (volatile unsigned char *)
4761 +                               ioremap(0xfee00000, 0x1000);
4762 +                        bp->io_base = (void *) ioremap(0xfe000000, 0x20000);
4763                 }
4764                 if (isa_io_base == 0)
4765                         isa_io_base = (unsigned long) bp->io_base;
4766 @@ -792,13 +468,7 @@
4767                 if (pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin) ||
4768                     !pin)
4769                         continue; /* No interrupt generated -> no fixup */
4770 -               /* We iterate all instances of uninorth for now */      
4771 -               if (uninorth_count && dev->bus->number == 0) {
4772 -                       int i;
4773 -                       for (i=0;i<uninorth_count;i++)
4774 -                               fix_intr(uninorth_bridges[i].node->child, dev);
4775 -               } else
4776 -                       fix_intr(bp->node->child, dev);
4777 +                fix_intr(bp->node->child, dev);
4778         }
4779  }
4780  
4781 @@ -806,17 +476,9 @@
4782  void
4783  pmac_setup_pci_ptrs(void))
4784  {
4785 -       struct device_node* np;
4786 -
4787 -       np = find_devices("pci");
4788 -       if (np != 0) {
4789 -               if (device_is_compatible(np, "uni-north")) {
4790 -                       /* looks like an Core99 powermac */
4791 -                       set_config_access_method(uni);
4792 -               } else {
4793 -                       /* looks like a G3 powermac */
4794 -                       set_config_access_method(grackle);
4795 -               }
4796 +       if (find_devices("pci") != 0) {
4797 +               /* looks like a G3 powermac */
4798 +               set_config_access_method(grackle);
4799         } else {
4800                 set_config_access_method(pmac);
4801         }
4802 diff -urN linux.orig/arch/ppc/kernel/pmac_pic.c linux/arch/ppc/kernel/pmac_pic.c
4803 --- linux.orig/arch/ppc/kernel/pmac_pic.c       Sun Mar 25 18:31:49 2001
4804 +++ linux/arch/ppc/kernel/pmac_pic.c    Thu Jul 11 15:43:29 2002
4805 @@ -4,13 +4,11 @@
4806  #include <linux/sched.h>
4807  #include <linux/signal.h>
4808  #include <linux/pci.h>
4809 -#include <linux/openpic.h>
4810  #include <asm/pci-bridge.h>
4811  #include <asm/io.h>
4812  #include <asm/smp.h>
4813  #include <asm/prom.h>
4814  #include "pmac_pic.h"
4815 -#include "open_pic.h"
4816  
4817  struct pmac_irq_hw {
4818          unsigned int    flag;
4819 @@ -30,8 +28,6 @@
4820  static int max_irqs;
4821  static int max_real_irqs;
4822  
4823 -extern u_int openpic_read(volatile u_int *addr);
4824 -
4825  #define MAXCOUNT 10000000
4826  
4827  #define GATWICK_IRQ_POOL_SIZE        10
4828 @@ -158,8 +154,6 @@
4829             int            cpu,
4830              int            isfake)
4831  {
4832 -       extern void psurge_smp_message_recv(void);
4833 -
4834         int irq;
4835         unsigned long bits = 0;
4836  
4837 @@ -174,7 +168,7 @@
4838                          if (xmon_2nd)
4839                                  xmon(regs);
4840  #endif
4841 -                        psurge_smp_message_recv();
4842 +                        pmac_smp_message_recv();
4843                          goto out;
4844                  }
4845                  /* could be here due to a do_fake_interrupt call but we don't
4846 @@ -356,58 +350,6 @@
4847          struct device_node *irqctrler;
4848          volatile struct pmac_irq_hw *addr;
4849         int second_irq;
4850 -       u_int t;
4851 -       int nr_irq;
4852 -
4853 -       /* We first try to detect Apple's new Core99 chipset, since mac-io
4854 -        * is quite different on those machines and contains an IBM MPIC2.
4855 -        */
4856 -       irqctrler = find_type_devices("open-pic");
4857 -       if (irqctrler != NULL) {
4858 -           printk("PowerMac using OpenPIC irq controller\n");
4859 -           if (irqctrler->n_addrs > 0) {
4860 -#ifdef CONFIG_XMON
4861 -               struct device_node* pswitch;
4862 -#endif /* CONFIG_XMON */       
4863 -               OpenPIC = (volatile struct OpenPIC *)
4864 -                       ioremap(irqctrler->addrs[0].address,
4865 -                       irqctrler->addrs[0].size);
4866 -               /* from openpic.c code... --Troy
4867 -                * dynamically figure out how many interrupts 
4868 -                * We should really do something like panic
4869 -                * if nr_irq >= OPENPIC_VEC_IPI
4870 -                */
4871 -               t = openpic_read(&OpenPIC->Global.Feature_Reporting0);
4872 -                nr_irq = ((t & OPENPIC_FEATURE_LAST_SOURCE_MASK) >>
4873 -                                OPENPIC_FEATURE_LAST_SOURCE_SHIFT) + 1;
4874 -               
4875 -               for ( i = 0 ; i < nr_irq ; i++ ) {
4876 -                   irq_desc[i].ctl = &open_pic;
4877 -                   irq_desc[i].level = 0;
4878 -               }
4879 -               ppc_md.do_IRQ = open_pic_do_IRQ;
4880 -               open_pic.irq_offset = 0;
4881 -               openpic_init(1);
4882 -#ifdef CONFIG_XMON
4883 -               pswitch = find_devices("programmer-switch");
4884 -               if (pswitch && pswitch->n_intrs)
4885 -                       request_irq(pswitch->intrs[0].line, xmon_irq, 0,        
4886 -                               "NMI - XMON", 0);
4887 -#endif /* CONFIG_XMON */
4888 -#ifdef __SMP__
4889 -               request_irq(OPENPIC_VEC_IPI, openpic_ipi_action,
4890 -                           0, "IPI0", 0);
4891 -               request_irq(OPENPIC_VEC_IPI+1, openpic_ipi_action,
4892 -                           0, "IPI1 (invalidate TLB)", 0);
4893 -               request_irq(OPENPIC_VEC_IPI+2, openpic_ipi_action,
4894 -                           0, "IPI2 (stop CPU)", 0);
4895 -               request_irq(OPENPIC_VEC_IPI+3, openpic_ipi_action,
4896 -                           0, "IPI3 (reschedule)", 0);
4897 -#endif /* __SMP__ */
4898 -               return;
4899 -           }
4900 -           irqctrler = NULL;
4901 -       }
4902  
4903         /*
4904          * G3 powermacs and 1999 G3 PowerBooks have 64 interrupts,
4905 @@ -487,8 +429,6 @@
4906   * sleep_save_intrs() saves the states of all interrupt enables
4907   * and disables all interupts except for the nominated one.
4908   * sleep_restore_intrs() restores the states of all interrupt enables.
4909 - * 
4910 - * TODO: Those should be sleep notifiers with high priority.
4911   */
4912  unsigned int sleep_save_mask[2];
4913  
4914 @@ -499,8 +439,7 @@
4915         sleep_save_mask[1] = ppc_cached_irq_mask[1];
4916         ppc_cached_irq_mask[0] = 0;
4917         ppc_cached_irq_mask[1] = 0;
4918 -       if (viaint > 0)
4919 -               set_bit(viaint, ppc_cached_irq_mask);
4920 +       set_bit(viaint, ppc_cached_irq_mask);
4921         out_le32(&pmac_irq_hw[0]->enable, ppc_cached_irq_mask[0]);
4922         if (max_real_irqs > 32)
4923                 out_le32(&pmac_irq_hw[1]->enable, ppc_cached_irq_mask[1]);
4924 @@ -513,7 +452,6 @@
4925  {
4926         int i;
4927  
4928 -
4929         out_le32(&pmac_irq_hw[0]->enable, 0);
4930         if (max_real_irqs > 32)
4931                 out_le32(&pmac_irq_hw[1]->enable, 0);
4932 diff -urN linux.orig/arch/ppc/kernel/pmac_setup.c linux/arch/ppc/kernel/pmac_setup.c
4933 --- linux.orig/arch/ppc/kernel/pmac_setup.c     Sun Mar 25 18:37:30 2001
4934 +++ linux/arch/ppc/kernel/pmac_setup.c  Thu Jul 11 15:46:22 2002
4935 @@ -57,20 +57,18 @@
4936  #include <asm/feature.h>
4937  #include <asm/ide.h>
4938  #include <asm/machdep.h>
4939 -#include <asm/keyboard.h>
4940 -#include <asm/time.h>
4941  
4942 +#include "time.h"
4943  #include "local_irq.h"
4944  #include "pmac_pic.h"
4945  
4946  #undef SHOW_GATWICK_IRQS
4947  
4948 -extern long pmac_time_init(void);
4949 -extern unsigned long pmac_get_rtc_time(void);
4950 -extern int pmac_set_rtc_time(unsigned long nowtime);
4951 -extern void pmac_read_rtc_time(void);
4952 -extern void pmac_calibrate_decr(void);
4953 -extern void pmac_setup_pci_ptrs(void);
4954 +unsigned long pmac_get_rtc_time(void);
4955 +int pmac_set_rtc_time(unsigned long nowtime);
4956 +void pmac_read_rtc_time(void);
4957 +void pmac_calibrate_decr(void);
4958 +void pmac_setup_pci_ptrs(void);
4959  
4960  extern int mackbd_setkeycode(unsigned int scancode, unsigned int keycode);
4961  extern int mackbd_getkeycode(unsigned int scancode);
4962 @@ -80,59 +78,29 @@
4963  extern void mackbd_leds(unsigned char leds);
4964  extern void mackbd_init_hw(void);
4965  #ifdef CONFIG_MAGIC_SYSRQ
4966 -extern unsigned char mackbd_sysrq_xlate[128];
4967 -extern unsigned char mac_hid_kbd_sysrq_xlate[128];
4968 -extern unsigned char pckbd_sysrq_xlate[128];
4969 +unsigned char mackbd_sysrq_xlate[128];
4970  #endif /* CONFIG_MAGIC_SYSRQ */
4971 -extern int keyboard_sends_linux_keycodes;
4972 -extern int mac_hid_kbd_translate(unsigned char scancode,
4973 -                                unsigned char *keycode, char raw_mode);
4974 -extern char mac_hid_kbd_unexpected_up(unsigned char keycode);
4975 -extern void mac_hid_init_hw(void);
4976 -
4977 -extern void pmac_nvram_update(void);
4978 -
4979 -extern void *pmac_pci_dev_io_base(unsigned char bus, unsigned char devfn);
4980 -extern void *pmac_pci_dev_mem_base(unsigned char bus, unsigned char devfn);
4981 -extern int pmac_pci_dev_root_bridge(unsigned char bus, unsigned char devfn);
4982 +extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
4983 +extern int pckbd_getkeycode(unsigned int scancode);
4984 +extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
4985 +                          char raw_mode);
4986 +extern char pckbd_unexpected_up(unsigned char keycode);
4987 +extern void pckbd_leds(unsigned char leds);
4988 +extern void pckbd_init_hw(void);
4989  
4990  unsigned char drive_info;
4991  
4992  int ppc_override_l2cr = 0;
4993  int ppc_override_l2cr_value;
4994  
4995 -static int current_root_goodness = -1;
4996 -
4997  extern char saved_command_line[];
4998  
4999 -extern int pmac_newworld;
5000 -
5001  #define DEFAULT_ROOT_DEVICE 0x0801     /* sda1 - slightly silly choice */
5002  
5003  extern void zs_kgdb_hook(int tty_num);
5004  static void ohare_init(void);
5005  static void init_p2pbridge(void);
5006  
5007 -#ifdef CONFIG_SMP
5008 -volatile static long int core99_l2_cache;
5009 -void core99_init_l2(void)
5010 -{
5011 -       int cpu = smp_processor_id();
5012
5013 -       if ( (_get_PVR() >> 16) != 8 && (_get_PVR() >> 16) != 12 )
5014 -               return;
5015 -
5016 -       if (cpu == 0){
5017 -               core99_l2_cache = _get_L2CR();
5018 -               printk("CPU0: L2CR is %lx\n", core99_l2_cache);
5019 -       } else {
5020 -               printk("CPU%d: L2CR was %lx\n", cpu, _get_L2CR());
5021 -               _set_L2CR(core99_l2_cache);
5022 -               printk("CPU%d: L2CR set to %lx\n", cpu, core99_l2_cache);
5023 -       }
5024 -}
5025 -#endif /* CONFIG_SMP */
5026 -
5027  __pmac
5028  int
5029  pmac_get_cpuinfo(char *buffer)
5030 @@ -219,10 +187,6 @@
5031                         len += sprintf(buffer+len, "l2cr override\t: 0x%x\n", *l2cr);
5032                 }
5033         }
5034 -
5035 -       /* Indicate newworld/oldworld */
5036 -       len += sprintf(buffer+len, "pmac-generation\t: %s\n",
5037 -               pmac_newworld ? "NewWorld" : "OldWorld");               
5038         
5039         return len;
5040  }
5041 @@ -282,18 +246,16 @@
5042                 if (fp != 0) {
5043                         switch (_get_PVR() >> 16) {
5044                         case 4:         /* 604 */
5045 -                       case 8:         /* G3 */
5046                         case 9:         /* 604e */
5047                         case 10:        /* mach V (604ev5) */
5048 -                       case 12:        /* G4 */
5049                         case 20:        /* 620 */
5050                                 loops_per_jiffy = *fp / HZ;
5051                                 break;
5052                         default:        /* 601, 603, etc. */
5053 -                               loops_per_jiffy = *fp / (2*HZ);
5054 +                               loops_per_jiffy = *fp / (2/HZ);
5055                         }
5056                 } else
5057 -                       loops_per_jiffy = 50000000 / HZ;
5058 +                       loops_per_jiffy = 50000000/HZ;
5059         }
5060  
5061         /* this area has the CPU identification register
5062 @@ -304,11 +266,9 @@
5063  
5064         *memory_start_p = pmac_find_bridges(*memory_start_p, *memory_end_p);
5065         init_p2pbridge();
5066 -       
5067 -       /* Checks "l2cr-value" property in the registry
5068 -        * And enable G3/G4 Dynamic Power Management
5069 -        */
5070 -       if ( (_get_PVR() >> 16) == 8 || (_get_PVR() >> 16) == 12 ) {
5071 +
5072 +       /* Checks "l2cr-value" property in the registry */
5073 +       if ( (_get_PVR() >> 16) == 8) {
5074                 struct device_node *np = find_devices("cpus");          
5075                 if (np == 0)
5076                         np = find_type_devices("cpu");          
5077 @@ -319,22 +279,17 @@
5078                                 ppc_override_l2cr = 1;
5079                                 ppc_override_l2cr_value = *l2cr;
5080                                 _set_L2CR(0);
5081 -                               if (ppc_override_l2cr_value)
5082 -                                       _set_L2CR(ppc_override_l2cr_value);
5083 +                               _set_L2CR(ppc_override_l2cr_value);
5084                         }
5085                 }
5086 -               _set_HID0(_get_HID0() | HID0_DPM);
5087         }
5088  
5089         if (ppc_override_l2cr)
5090                 printk(KERN_INFO "L2CR overriden (0x%x), backside cache is %s\n",
5091                         ppc_override_l2cr_value, (ppc_override_l2cr_value & 0x80000000)
5092                                 ? "enabled" : "disabled");
5093 -       feature_init();
5094  
5095 -#ifdef CONFIG_SMP
5096 -       core99_init_l2();
5097 -#endif
5098 +       feature_init();
5099  
5100  #ifdef CONFIG_KGDB
5101         zs_kgdb_hook(0);
5102 @@ -343,8 +298,6 @@
5103         find_via_cuda();
5104         find_via_pmu();
5105  
5106 -       pmac_nvram_init();
5107 -
5108  #ifdef CONFIG_DUMMY_CONSOLE
5109         conswitchp = &dummy_con;
5110  #endif
5111 @@ -413,6 +366,7 @@
5112  pmac_init2(void))
5113  {
5114         adb_init();
5115 +       pmac_nvram_init();
5116         media_bay_init();
5117  }
5118  
5119 @@ -493,14 +447,13 @@
5120  
5121  /* can't be initfunc - can be called whenever a disk is first accessed */
5122  __pmac
5123 -void note_bootable_part(kdev_t dev, int part, int goodness)
5124 +void note_bootable_part(kdev_t dev, int part)
5125  {
5126         static int found_boot = 0;
5127         char *p;
5128  
5129         /* Do nothing if the root has been set already. */
5130 -       if ((goodness < current_root_goodness) &&
5131 -               (ROOT_DEV != to_kdev_t(DEFAULT_ROOT_DEVICE)))
5132 +       if (ROOT_DEV != to_kdev_t(DEFAULT_ROOT_DEVICE))
5133                 return;
5134         p = strstr(saved_command_line, "root=");
5135         if (p != NULL && (p == saved_command_line || p[-1] == ' '))
5136 @@ -513,7 +466,7 @@
5137         if (boot_dev == 0 || dev == boot_dev) {
5138                 ROOT_DEV = MKDEV(MAJOR(dev), MINOR(dev) + part);
5139                 boot_dev = NODEV;
5140 -               current_root_goodness = goodness;
5141 +               printk(" (root)");
5142         }
5143  }
5144  
5145 @@ -522,8 +475,6 @@
5146  {
5147         struct adb_request req;
5148  
5149 -       pmac_nvram_update();
5150 -       
5151         switch (adb_hardware) {
5152         case ADB_VIACUDA:
5153                 cuda_request(&req, NULL, 2, CUDA_PACKET,
5154 @@ -544,8 +495,6 @@
5155  {
5156         struct adb_request req;
5157  
5158 -       pmac_nvram_update();
5159 -       
5160         switch (adb_hardware) {
5161         case ADB_VIACUDA:
5162                 cuda_request(&req, NULL, 2, CUDA_PACKET,
5163 @@ -564,6 +513,7 @@
5164  void
5165  pmac_halt(void)
5166  {
5167 +   pmac_power_off();
5168  }
5169  
5170  
5171 @@ -663,17 +613,12 @@
5172         ppc_md.power_off      = pmac_power_off;
5173         ppc_md.halt           = pmac_halt;
5174  
5175 -       ppc_md.time_init      = pmac_time_init;
5176 +       ppc_md.time_init      = NULL;
5177         ppc_md.set_rtc_time   = pmac_set_rtc_time;
5178         ppc_md.get_rtc_time   = pmac_get_rtc_time;
5179         ppc_md.calibrate_decr = pmac_calibrate_decr;
5180  
5181 -       ppc_md.pci_dev_root_bridge      = pmac_pci_dev_root_bridge;
5182 -       ppc_md.pci_dev_mem_base         = pmac_pci_dev_mem_base;
5183 -       ppc_md.pci_dev_io_base          = pmac_pci_dev_io_base;
5184 -
5185 -#ifdef CONFIG_VT
5186 -#ifdef CONFIG_MAC_KEYBOARD
5187 +#if defined(CONFIG_VT) && defined(CONFIG_MAC_KEYBOARD)
5188         ppc_md.kbd_setkeycode    = mackbd_setkeycode;
5189         ppc_md.kbd_getkeycode    = mackbd_getkeycode;
5190         ppc_md.kbd_translate     = mackbd_translate;
5191 @@ -684,27 +629,7 @@
5192         ppc_md.sysrq_xlate       = mackbd_sysrq_xlate;
5193         SYSRQ_KEY                = 0x69;
5194  #endif
5195 -#elif defined(CONFIG_INPUT_ADBHID)
5196 -       ppc_md.kbd_setkeycode    = 0;
5197 -       ppc_md.kbd_getkeycode    = 0;
5198 -       ppc_md.kbd_translate     = mac_hid_kbd_translate;
5199 -       ppc_md.kbd_unexpected_up = mac_hid_kbd_unexpected_up;
5200 -       ppc_md.kbd_leds          = 0;
5201 -       ppc_md.kbd_init_hw       = mac_hid_init_hw;
5202 -#ifdef CONFIG_MAGIC_SYSRQ
5203 -#ifdef CONFIG_MAC_ADBKEYCODES
5204 -       if (!keyboard_sends_linux_keycodes) {
5205 -               ppc_md.sysrq_xlate = mac_hid_kbd_sysrq_xlate;
5206 -               SYSRQ_KEY = 0x69;
5207 -       } else
5208 -#endif /* CONFIG_MAC_ADBKEYCODES */
5209 -       {
5210 -               ppc_md.sysrq_xlate = pckbd_sysrq_xlate;
5211 -               SYSRQ_KEY = 0x54;
5212 -       }
5213  #endif
5214 -#endif /* CONFIG_MAC_KEYBOARD */
5215 -#endif /* CONFIG_VT */
5216  
5217  #if defined(CONFIG_BLK_DEV_IDE_PMAC)
5218          ppc_ide_md.insw = pmac_ide_insw;
5219 diff -urN linux.orig/arch/ppc/kernel/pmac_support.c linux/arch/ppc/kernel/pmac_support.c
5220 --- linux.orig/arch/ppc/kernel/pmac_support.c   Sun Mar 25 18:31:49 2001
5221 +++ linux/arch/ppc/kernel/pmac_support.c        Thu Jul 11 15:43:29 2002
5222 @@ -1,19 +1,10 @@
5223  /*
5224   * Miscellaneous procedures for dealing with the PowerMac hardware.
5225 - * Contains support for the nvram.
5226 - * 
5227 - *   Copyright (C) 2000 Paul Mackerras
5228 - *   Copyright (C) 2000 Benjamin Herrenschmidt
5229 - *
5230 - * ToDo: Handle type 0 and type 1 "NameRegistry" NVRAM properties. Those
5231 - *       contain, among other things, the brightness, video mode, etc...
5232   */
5233  #include <linux/kernel.h>
5234  #include <linux/stddef.h>
5235  #include <linux/reboot.h>
5236  #include <linux/nvram.h>
5237 -#include <linux/slab.h>
5238 -#include <linux/delay.h>
5239  #include <asm/init.h>
5240  #include <asm/ptrace.h>
5241  #include <asm/io.h>
5242 @@ -22,49 +13,16 @@
5243  #include <asm/prom.h>
5244  #include <asm/adb.h>
5245  #include <asm/pmu.h>
5246 -#include <asm/machdep.h>
5247  #include <asm/nvram.h>
5248  #include <asm/backlight.h>
5249  
5250 -#undef DEBUG
5251 -
5252 -#define NVRAM_SIZE             0x2000  /* 8kB of non-volatile RAM */
5253 -
5254 -#define CORE99_SIGNATURE       0x5a
5255 -#define CORE99_ADLER_START     0x14
5256 -
5257 -/* Core99 nvram is a flash */
5258 -#define CORE99_FLASH_STATUS_DONE       0x80
5259 -#define CORE99_FLASH_STATUS_ERR                0x38
5260 -#define CORE99_FLASH_CMD_ERASE_CONFIRM 0xd0
5261 -#define CORE99_FLASH_CMD_ERASE_SETUP   0x20
5262 -#define CORE99_FLASH_CMD_RESET         0xff
5263 -#define CORE99_FLASH_CMD_WRITE_SETUP   0x40
5264 -
5265 -/* CHRP NVRAM header */
5266 -struct chrp_header {
5267 -       u8      signature;
5268 -       u8      cksum;
5269 -       u16     len;
5270 -       char    name[12];
5271 -       u8      data[0];
5272 -};
5273 -
5274 -struct core99_header {
5275 -       struct chrp_header hdr;
5276 -       u32     adler;
5277 -       u32     generation;
5278 -       u32     reserved[2];
5279 -};
5280 -
5281  /*
5282   * Read and write the non-volatile RAM on PowerMacs and CHRP machines.
5283   */
5284  static int nvram_naddrs;
5285  static volatile unsigned char *nvram_addr;
5286  static volatile unsigned char *nvram_data;
5287 -static int nvram_mult, is_core_99;
5288 -static int core99_bank = 0;
5289 +static int nvram_mult;
5290  static int nvram_partitions[3];
5291  
5292  static struct backlight_controller *backlighter = NULL;
5293 @@ -73,213 +31,22 @@
5294  static int backlight_level = BACKLIGHT_MAX;
5295  static int backlight_enabled = 1;
5296  
5297 -/* FIXME: kmalloc fails to allocate the image now that I had to move it
5298 - *        before time_init(). For now, I allocate a static buffer here
5299 - *        but it's a waste of space on all but core99 machines
5300 - */
5301 -#if 0
5302 -static char* nvram_image;
5303 -#else
5304 -static char nvram_image[NVRAM_SIZE];
5305 -#endif
5306 -
5307 -extern int pmac_newworld;
5308 -
5309 -static u8 __pmac
5310 -chrp_checksum(struct chrp_header* hdr)
5311 -{
5312 -       u8 *ptr;
5313 -       u16 sum = hdr->signature;
5314 -       for (ptr = (u8 *)&hdr->len; ptr < hdr->data; ptr++)
5315 -               sum += *ptr;
5316 -       while (sum > 0xFF)
5317 -               sum = (sum & 0xFF) + (sum>>8);
5318 -       return sum;
5319 -}
5320 -
5321 -static u32 __pmac
5322 -core99_calc_adler(u8 *buffer)
5323 -{
5324 -       int cnt;
5325 -       u32 low, high;
5326 -
5327 -       buffer += CORE99_ADLER_START;
5328 -       low = 1;
5329 -       high = 0;
5330 -       for (cnt=0; cnt<(NVRAM_SIZE-CORE99_ADLER_START); cnt++) {
5331 -               if ((cnt % 5000) == 0) {
5332 -                       high  %= 65521UL;
5333 -                       high %= 65521UL;
5334 -               }
5335 -               low += buffer[cnt];
5336 -               high += low;
5337 -       }
5338 -       low  %= 65521UL;
5339 -       high %= 65521UL;
5340 -  
5341 -       return (high << 16) | low;
5342 -}
5343 -
5344 -static u32 __pmac
5345 -core99_check(u8* datas)
5346 -{
5347 -       struct core99_header* hdr99 = (struct core99_header*)datas;
5348 +#define NVRAM_SIZE     0x2000  /* 8kB of non-volatile RAM */
5349  
5350 -       if (hdr99->hdr.signature != CORE99_SIGNATURE) {
5351 -#ifdef DEBUG
5352 -               printk("Invalid signature\n");
5353 -#endif         
5354 -               return 0;
5355 -       }
5356 -       if (hdr99->hdr.cksum != chrp_checksum(&hdr99->hdr)) {
5357 -#ifdef DEBUG
5358 -               printk("Invalid checksum\n");
5359 -#endif
5360 -               return 0;
5361 -       }
5362 -       if (hdr99->adler != core99_calc_adler(datas)) {
5363 -#ifdef DEBUG
5364 -               printk("Invalid adler\n");
5365 -#endif
5366 -               return 0;
5367 -       }
5368 -       return hdr99->generation;
5369 -}
5370 -
5371 -static int __pmac
5372 -core99_erase_bank(int bank)
5373 -{
5374 -       int stat, i;
5375 -       
5376 -       u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
5377 -       
5378 -       out_8(base, CORE99_FLASH_CMD_ERASE_SETUP);
5379 -       out_8(base, CORE99_FLASH_CMD_ERASE_CONFIRM);
5380 -       do { stat = in_8(base); }
5381 -       while(!(stat & CORE99_FLASH_STATUS_DONE));
5382 -       out_8(base, CORE99_FLASH_CMD_RESET);
5383 -       if (stat & CORE99_FLASH_STATUS_ERR) {
5384 -               printk("nvram: flash error 0x%02x on erase !\n", stat);
5385 -               return -ENXIO;
5386 -       }
5387 -       for (i=0; i<NVRAM_SIZE; i++)
5388 -               if (base[i] != 0xff) {
5389 -                       printk("nvram: flash erase failed !\n");
5390 -                       return -ENXIO;
5391 -               }
5392 -       return 0;
5393 -}
5394 -
5395 -static int __pmac
5396 -core99_write_bank(int bank, u8* datas)
5397 -{
5398 -       int i, stat = 0;
5399 -       
5400 -       u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
5401 -       
5402 -       for (i=0; i<NVRAM_SIZE; i++) {
5403 -               out_8(base+i, CORE99_FLASH_CMD_WRITE_SETUP);
5404 -               out_8(base+i, datas[i]);
5405 -               do { stat = in_8(base); }
5406 -               while(!(stat & CORE99_FLASH_STATUS_DONE));
5407 -               if (stat & CORE99_FLASH_STATUS_ERR)
5408 -                       break;
5409 -       }
5410 -       out_8(base, CORE99_FLASH_CMD_RESET);
5411 -       if (stat & CORE99_FLASH_STATUS_ERR) {
5412 -               printk("nvram: flash error 0x%02x on write !\n", stat);
5413 -               return -ENXIO;
5414 -       }
5415 -       for (i=0; i<NVRAM_SIZE; i++)
5416 -               if (base[i] != datas[i]) {
5417 -                       printk("nvram: flash write failed !\n");
5418 -                       return -ENXIO;
5419 -               }
5420 -       return 0;       
5421 -}
5422 -
5423 -static void __pmac
5424 -lookup_partitions(void)
5425 -{
5426 -       u8 buffer[17];
5427 -       int i, offset;
5428 -       struct chrp_header* hdr;
5429 -
5430 -       if (pmac_newworld) {
5431 -               nvram_partitions[pmac_nvram_OF] = -1;
5432 -               nvram_partitions[pmac_nvram_XPRAM] = -1;
5433 -               nvram_partitions[pmac_nvram_NR] = -1;
5434 -               hdr = (struct chrp_header *)buffer;
5435 -       
5436 -               offset = 0;
5437 -               buffer[16] = 0;
5438 -               do {
5439 -                       for (i=0;i<16;i++)
5440 -                               buffer[i] = nvram_read_byte(offset+i);
5441 -                       if (!strcmp(hdr->name, "common"))
5442 -                               nvram_partitions[pmac_nvram_OF] = offset + 0x10;
5443 -                       if (!strcmp(hdr->name, "APL,MacOS75")) {
5444 -                               nvram_partitions[pmac_nvram_XPRAM] = offset + 0x10;
5445 -                               nvram_partitions[pmac_nvram_NR] = offset + 0x110;
5446 -                       }
5447 -                       offset += (hdr->len * 0x10);
5448 -               } while(offset < NVRAM_SIZE);
5449 -       } else {
5450 -               nvram_partitions[pmac_nvram_OF] = 0x1800;
5451 -               nvram_partitions[pmac_nvram_XPRAM] = 0x1300;
5452 -               nvram_partitions[pmac_nvram_NR] = 0x1400;
5453 -       }       
5454 -#ifdef DEBUG
5455 -       printk("nvram: OF partition at 0x%x\n", nvram_partitions[pmac_nvram_OF]);
5456 -       printk("nvram: XP partition at 0x%x\n", nvram_partitions[pmac_nvram_XPRAM]);
5457 -       printk("nvram: NR partition at 0x%x\n", nvram_partitions[pmac_nvram_NR]);
5458 -#endif 
5459 -}
5460  
5461  __init
5462  void pmac_nvram_init(void)
5463  {
5464         struct device_node *dp;
5465  
5466 -       nvram_naddrs = 0;
5467 -
5468         dp = find_devices("nvram");
5469         if (dp == NULL) {
5470                 printk(KERN_ERR "Can't find NVRAM device\n");
5471 +               nvram_naddrs = 0;
5472                 return;
5473         }
5474         nvram_naddrs = dp->n_addrs;
5475 -       is_core_99 = device_is_compatible(dp, "nvram,flash");
5476 -       printk("pmac nvram is core99: %d\n", is_core_99);
5477 -       if (is_core_99) {
5478 -               int i;
5479 -               u32 gen_bank0, gen_bank1;
5480 -               
5481 -               if (nvram_naddrs < 1) {
5482 -                       printk(KERN_ERR "nvram: no address\n");
5483 -                       return;
5484 -               }
5485 -#if 0
5486 -               nvram_image = kmalloc(NVRAM_SIZE, GFP_KERNEL);
5487 -               if (!nvram_image) {
5488 -                       printk(KERN_ERR "nvram: can't allocate image\n");
5489 -                       return;
5490 -               }
5491 -#endif         
5492 -               nvram_data = ioremap(dp->addrs[0].address, NVRAM_SIZE*2);
5493 -#ifdef DEBUG
5494 -               printk("nvram: Checking bank 0...\n");
5495 -#endif
5496 -               gen_bank0 = core99_check((u8 *)nvram_data);
5497 -               gen_bank1 = core99_check((u8 *)nvram_data + NVRAM_SIZE);
5498 -               core99_bank = (gen_bank0 < gen_bank1) ? 1 : 0;
5499 -#ifdef DEBUG
5500 -               printk("nvram: gen0=%d, gen1=%d\n", gen_bank0, gen_bank1);
5501 -               printk("nvram: Active bank is: %d\n", core99_bank);
5502 -#endif
5503 -               for (i=0; i<NVRAM_SIZE; i++)
5504 -                       nvram_image[i] = nvram_data[i + core99_bank*NVRAM_SIZE];
5505 -       } else if (_machine == _MACH_chrp && nvram_naddrs == 1) {
5506 +       if (_machine == _MACH_chrp && nvram_naddrs == 1) {
5507                 nvram_data = ioremap(dp->addrs[0].address, dp->addrs[0].size);
5508                 nvram_mult = 1;
5509         } else if (nvram_naddrs == 1) {
5510 @@ -288,45 +55,15 @@
5511         } else if (nvram_naddrs == 2) {
5512                 nvram_addr = ioremap(dp->addrs[0].address, dp->addrs[0].size);
5513                 nvram_data = ioremap(dp->addrs[1].address, dp->addrs[1].size);
5514 -       } else if (nvram_naddrs == 0 && adb_controller &&
5515 -               adb_controller->kind == ADB_VIAPMU) {
5516 +       } else if (nvram_naddrs == 0 && adb_hardware == ADB_VIAPMU) {
5517                 nvram_naddrs = -1;
5518         } else {
5519                 printk(KERN_ERR "Don't know how to access NVRAM with %d addresses\n",
5520                        nvram_naddrs);
5521         }
5522 -       lookup_partitions();
5523  }
5524  
5525 -void __pmac
5526 -pmac_nvram_update(void)
5527 -{
5528 -       struct core99_header* hdr99;
5529 -       
5530 -       if (!is_core_99 || !nvram_data || !nvram_image)
5531 -               return;
5532 -       if (!memcmp(nvram_image, (u8*)nvram_data + core99_bank*NVRAM_SIZE,
5533 -               NVRAM_SIZE))
5534 -               return;
5535 -#ifdef DEBUG
5536 -       printk("Updating nvram...\n");
5537 -#endif
5538 -       hdr99 = (struct core99_header*)nvram_image;
5539 -       hdr99->generation++;
5540 -       hdr99->hdr.signature = CORE99_SIGNATURE;
5541 -       hdr99->hdr.cksum = chrp_checksum(&hdr99->hdr);
5542 -       hdr99->adler = core99_calc_adler(nvram_image);
5543 -       core99_bank = core99_bank ? 0 : 1;
5544 -       if (core99_erase_bank(core99_bank)) {
5545 -               printk("nvram: Error erasing bank %d\n", core99_bank);
5546 -               return;
5547 -       }
5548 -       if (core99_write_bank(core99_bank, nvram_image))
5549 -               printk("nvram: Error writing bank %d\n", core99_bank);
5550 -}
5551 -
5552 -unsigned char __pmac
5553 -nvram_read_byte(int addr)
5554 +unsigned char nvram_read_byte(int addr)
5555  {
5556         struct adb_request req;
5557  
5558 @@ -339,8 +76,6 @@
5559                         pmu_poll();
5560                 return req.reply[1];
5561         case 1:
5562 -               if (is_core_99)
5563 -                       return nvram_image ? nvram_image[addr] : 0;
5564                 return nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult];
5565         case 2:
5566                 *nvram_addr = addr >> 5;
5567 @@ -350,8 +85,7 @@
5568         return 0;
5569  }
5570  
5571 -void __pmac
5572 -nvram_write_byte(unsigned char val, int addr)
5573 +void nvram_write_byte(unsigned char val, int addr)
5574  {
5575         struct adb_request req;
5576  
5577 @@ -364,12 +98,6 @@
5578                         pmu_poll();
5579                 break;
5580         case 1:
5581 -               if (is_core_99) {
5582 -                       if (!nvram_image)
5583 -                               return;
5584 -                       nvram_image[addr] = val;
5585 -                       break;
5586 -               }
5587                 nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult] = val;
5588                 break;
5589         case 2:
5590 diff -urN linux.orig/arch/ppc/kernel/pmac_time.c linux/arch/ppc/kernel/pmac_time.c
5591 --- linux.orig/arch/ppc/kernel/pmac_time.c      Sun Mar 25 18:31:49 2001
5592 +++ linux/arch/ppc/kernel/pmac_time.c   Thu Jul 11 15:43:29 2002
5593 @@ -22,9 +22,8 @@
5594  #include <asm/system.h>
5595  #include <asm/io.h>
5596  #include <asm/pgtable.h>
5597 -#include <asm/nvram.h>
5598  
5599 -#include <asm/time.h>
5600 +#include "time.h"
5601  
5602  /* Apparently the RTC stores seconds since 1 Jan 1904 */
5603  #define RTC_OFFSET     2082844800
5604 @@ -50,26 +49,8 @@
5605  /* Bits in IFR and IER */
5606  #define T1_INT         0x40            /* Timer 1 interrupt */
5607  
5608 -extern struct timezone sys_tz;
5609 -
5610 -__init
5611 -long pmac_time_init(void)
5612 -{
5613 -       s32 delta = 0;
5614 -       int dst;
5615 -       
5616 -       delta = ((s32)pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x9)) << 16;
5617 -       delta |= ((s32)pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0xa)) << 8;
5618 -       delta |= pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0xb);
5619 -       if (delta & 0x00800000UL)
5620 -               delta |= 0xFF000000UL;
5621 -       dst = ((pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x8) & 0x80) != 0);
5622 -       printk("GMT Delta read from XPRAM: %d minutes, DST: %s\n", delta/60,
5623 -               dst ? "on" : "off");
5624 -       return -delta;
5625 -}
5626 -
5627  __pmac
5628 +
5629  unsigned long pmac_get_rtc_time(void)
5630  {
5631         struct adb_request req;
5632 @@ -109,42 +90,7 @@
5633  
5634  int pmac_set_rtc_time(unsigned long nowtime)
5635  {
5636 -       struct adb_request req;
5637 -       int dst, delta;
5638 -
5639 -       nowtime += RTC_OFFSET;
5640 -
5641 -       /* Set the time in the RTC */
5642 -       if (adb_controller == 0)
5643 -               return 0;
5644 -       /* adb_controller->kind, not adb_hardware, since that doesn't
5645 -          get set until we call adb_init - paulus. */
5646 -       switch (adb_controller->kind) {
5647 -       case ADB_VIACUDA:
5648 -               if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME,
5649 -                                nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0)
5650 -                       return 0;
5651 -               while (!req.complete)
5652 -                       cuda_poll();
5653 -//             if (req.reply_len != 7)
5654 -                       printk(KERN_ERR "pmac_set_rtc_time: got %d byte reply\n",
5655 -                              req.reply_len);
5656 -               break;
5657 -       case ADB_VIAPMU:
5658 -               if (pmu_request(&req, NULL, 5, PMU_SET_RTC,
5659 -                               nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0)
5660 -                       return 0;
5661 -               while (!req.complete)
5662 -                       pmu_poll();
5663 -               if (req.reply_len != 5)
5664 -                       printk(KERN_ERR "pmac_set_rtc_time: got %d byte reply\n",
5665 -                              req.reply_len);
5666 -               break;
5667 -       default:
5668 -               return 0;
5669 -       }
5670 -
5671 -       return 1;
5672 +       return 0;
5673  }
5674  
5675  /*
5676 diff -urN linux.orig/arch/ppc/kernel/ppc-stub.c linux/arch/ppc/kernel/ppc-stub.c
5677 --- linux.orig/arch/ppc/kernel/ppc-stub.c       Sun Mar 25 18:31:49 2001
5678 +++ linux/arch/ppc/kernel/ppc-stub.c    Thu Jul 11 15:43:29 2002
5679 @@ -351,7 +351,7 @@
5680  
5681  static inline void set_msr(int msr)
5682  {
5683 -       asm volatile("mtmsr %0" : : "r" (msr));
5684 +       asm volatile("mfmsr %0" : : "r" (msr));
5685  }
5686  
5687  /* Set up exception handlers for tracing and breakpoints
5688 diff -urN linux.orig/arch/ppc/kernel/ppc_asm.tmpl linux/arch/ppc/kernel/ppc_asm.tmpl
5689 --- linux.orig/arch/ppc/kernel/ppc_asm.tmpl     Sun Mar 25 18:31:48 2001
5690 +++ linux/arch/ppc/kernel/ppc_asm.tmpl  Thu Jul 11 15:43:29 2002
5691 @@ -64,36 +64,3 @@
5692  #define        fr29    29
5693  #define        fr30    30
5694  #define        fr31    31
5695 -
5696 -#define        vr0     0
5697 -#define        vr1     1
5698 -#define        vr2     2
5699 -#define        vr3     3
5700 -#define        vr4     4
5701 -#define        vr5     5
5702 -#define        vr6     6
5703 -#define        vr7     7
5704 -#define        vr8     8
5705 -#define        vr9     9
5706 -#define        vr10    10
5707 -#define        vr11    11
5708 -#define        vr12    12
5709 -#define        vr13    13
5710 -#define        vr14    14
5711 -#define        vr15    15
5712 -#define        vr16    16
5713 -#define        vr17    17
5714 -#define        vr18    18
5715 -#define        vr19    19
5716 -#define        vr20    20
5717 -#define        vr21    21
5718 -#define        vr22    22
5719 -#define        vr23    23
5720 -#define        vr24    24
5721 -#define        vr25    25
5722 -#define        vr26    26
5723 -#define        vr27    27
5724 -#define        vr28    28
5725 -#define        vr29    29
5726 -#define        vr30    30
5727 -#define        vr31    31
5728 diff -urN linux.orig/arch/ppc/kernel/ppc_htab.c linux/arch/ppc/kernel/ppc_htab.c
5729 --- linux.orig/arch/ppc/kernel/ppc_htab.c       Sun Mar 25 18:31:49 2001
5730 +++ linux/arch/ppc/kernel/ppc_htab.c    Thu Jul 11 15:43:29 2002
5731 @@ -547,8 +547,7 @@
5732                 "0.5", "1.0", "(reserved2)", "(reserved3)"
5733         };
5734  
5735 -       if ( ((_get_PVR() >> 16) != 8) && ((_get_PVR() >> 16) != 12))
5736 -               return -EFAULT;
5737 +       if ( (_get_PVR() >> 16) != 8) return -EFAULT;
5738         
5739         if ( /*!table->maxlen ||*/ (filp->f_pos && !write)) {
5740                 *lenp = 0;
5741 @@ -587,8 +586,9 @@
5742                         buffer += len;
5743                         left -= len;
5744                         _set_L2CR(0);
5745 -                       if (val)
5746 -                               _set_L2CR(val);
5747 +                       _set_L2CR(val);
5748 +                       while ( _get_L2CR() & 0x1 )
5749 +                               /* wait for invalidate to finish */;
5750                           
5751                 } else {
5752                         p = buf;
5753 diff -urN linux.orig/arch/ppc/kernel/ppc_ksyms.c linux/arch/ppc/kernel/ppc_ksyms.c
5754 --- linux.orig/arch/ppc/kernel/ppc_ksyms.c      Tue Jun 11 19:39:18 2002
5755 +++ linux/arch/ppc/kernel/ppc_ksyms.c   Thu Jul 11 18:49:10 2002
5756 @@ -5,26 +5,31 @@
5757  #include <linux/sched.h>
5758  #include <linux/string.h>
5759  #include <linux/interrupt.h>
5760 -#include <linux/smp_lock.h>
5761  #include <linux/vt_kern.h>
5762  #include <linux/nvram.h>
5763  
5764 +#include <asm/page.h>
5765  #include <asm/semaphore.h>
5766  #include <asm/processor.h>
5767  #include <asm/uaccess.h>
5768 +#include <asm/io.h>
5769 +#include <linux/ide.h>
5770  #include <asm/ide.h>
5771 +#include <asm/atomic.h>
5772 +#include <asm/bitops.h>
5773  #include <asm/checksum.h>
5774  #include <asm/pgtable.h>
5775  #include <asm/adb.h>
5776  #include <asm/cuda.h>
5777  #include <asm/pmu.h>
5778  #include <asm/prom.h>
5779 +#include <asm/system.h>
5780  #include <asm/pci-bridge.h>
5781  #include <asm/irq.h>
5782  #include <asm/feature.h>
5783 +#include <asm/spinlock.h>
5784  #include <asm/dma.h>
5785 -#include <asm/nvram.h>
5786 -#include <asm/time.h>
5787 +#include <asm/machdep.h>
5788  
5789  /* Tell string.h we don't want memcpy etc. as cpp defines */
5790  #define EXPORT_SYMTAB_STROPS
5791 @@ -45,10 +50,10 @@
5792                              unsigned int, unsigned int, unsigned int);
5793  extern void to_tm(int tim, struct rtc_time * tm);
5794  
5795 -long long __ashrdi3(long long, int);
5796 -long long __ashldi3(long long, int);
5797 -long long __lshrdi3(long long, int);
5798 -int abs(int);
5799 +asmlinkage long long __ashrdi3(long long, int);
5800 +asmlinkage long long __ashldi3(long long, int);
5801 +asmlinkage long long __lshrdi3(long long, int);
5802 +asmlinkage int abs(int);
5803  
5804  EXPORT_SYMBOL(clear_page);
5805  EXPORT_SYMBOL(do_signal);
5806 @@ -73,12 +78,10 @@
5807  EXPORT_SYMBOL(isa_mem_base);
5808  EXPORT_SYMBOL(pci_dram_offset);
5809  EXPORT_SYMBOL(ISA_DMA_THRESHOLD);
5810 -EXPORT_SYMBOL_NOVERS(DMA_MODE_READ);
5811 +EXPORT_SYMBOL(DMA_MODE_READ);
5812  EXPORT_SYMBOL(DMA_MODE_WRITE);
5813 -#if defined(CONFIG_PREP) || defined(CONFIG_ALL_PPC)
5814  EXPORT_SYMBOL(_prep_type);
5815  EXPORT_SYMBOL(ucSystemType);
5816 -#endif
5817  
5818  EXPORT_SYMBOL(atomic_add);
5819  EXPORT_SYMBOL(atomic_sub);
5820 @@ -167,16 +170,11 @@
5821  EXPORT_SYMBOL(enable_kernel_fp);
5822  EXPORT_SYMBOL(flush_icache_range);
5823  EXPORT_SYMBOL(xchg_u32);
5824 -
5825 -#ifdef CONFIG_ALTIVEC
5826 -EXPORT_SYMBOL(giveup_altivec);
5827 -#endif
5828 -
5829  #ifdef __SMP__
5830 -EXPORT_SYMBOL(cpu_data);
5831 -EXPORT_SYMBOL(kernel_flag);
5832 -EXPORT_SYMBOL(cpu_number_map);
5833 -EXPORT_SYMBOL(smp_num_cpus);
5834 +EXPORT_SYMBOL(__global_cli);
5835 +EXPORT_SYMBOL(__global_sti);
5836 +EXPORT_SYMBOL(__global_save_flags);
5837 +EXPORT_SYMBOL(__global_restore_flags);
5838  EXPORT_SYMBOL(_spin_lock);
5839  EXPORT_SYMBOL(_spin_unlock);
5840  EXPORT_SYMBOL(spin_trylock);
5841 @@ -184,35 +182,11 @@
5842  EXPORT_SYMBOL(_read_unlock);
5843  EXPORT_SYMBOL(_write_lock);
5844  EXPORT_SYMBOL(_write_unlock);
5845 -
5846 -/* Global SMP irq stuff */
5847 -EXPORT_SYMBOL(synchronize_irq);
5848 -EXPORT_SYMBOL(synchronize_bh);
5849 -EXPORT_SYMBOL(global_bh_count);
5850 -EXPORT_SYMBOL(global_bh_lock);
5851 -EXPORT_SYMBOL(global_irq_holder);
5852 -EXPORT_SYMBOL(__global_cli);
5853 -EXPORT_SYMBOL(__global_sti);
5854 -EXPORT_SYMBOL(__global_save_flags);
5855 -EXPORT_SYMBOL(__global_restore_flags);
5856 -#endif /* __SMP__ */
5857 +#endif
5858  
5859  EXPORT_SYMBOL(_machine);
5860  EXPORT_SYMBOL(ppc_md);
5861 -EXPORT_SYMBOL(abort);
5862  
5863 -#ifndef CONFIG_MBX
5864 -EXPORT_SYMBOL(find_devices);
5865 -EXPORT_SYMBOL(find_type_devices);
5866 -EXPORT_SYMBOL(find_compatible_devices);
5867 -EXPORT_SYMBOL(find_path_device);
5868 -EXPORT_SYMBOL(find_phandle);
5869 -EXPORT_SYMBOL(device_is_compatible);
5870 -EXPORT_SYMBOL(machine_is_compatible);
5871 -EXPORT_SYMBOL(find_pci_device_OFnode);
5872 -EXPORT_SYMBOL(find_all_nodes);
5873 -EXPORT_SYMBOL(get_property);
5874 -#endif /* CONFIG_MBX */
5875  #ifdef CONFIG_POWERMAC
5876  EXPORT_SYMBOL(adb_request);
5877  EXPORT_SYMBOL(adb_register);
5878 @@ -227,21 +201,25 @@
5879  EXPORT_SYMBOL(pmu_enable_irled);
5880  #endif /* CONFIG_PMAC_PBOOK */
5881  #ifdef CONFIG_POWERMAC
5882 +EXPORT_SYMBOL(abort);
5883 +EXPORT_SYMBOL(find_devices);
5884 +EXPORT_SYMBOL(find_type_devices);
5885 +EXPORT_SYMBOL(find_compatible_devices);
5886 +EXPORT_SYMBOL(find_path_device);
5887 +EXPORT_SYMBOL(find_phandle);
5888 +EXPORT_SYMBOL(device_is_compatible);
5889 +EXPORT_SYMBOL(machine_is_compatible);
5890 +EXPORT_SYMBOL(find_pci_device_OFnode);
5891 +EXPORT_SYMBOL(get_property);
5892  EXPORT_SYMBOL(pci_io_base);
5893 -EXPORT_SYMBOL(pci_dev_io_base);
5894 -EXPORT_SYMBOL(pci_dev_mem_base);
5895  EXPORT_SYMBOL(pci_device_loc);
5896  EXPORT_SYMBOL(feature_set);
5897  EXPORT_SYMBOL(feature_clear);
5898  EXPORT_SYMBOL(feature_test);
5899  EXPORT_SYMBOL(feature_set_gmac_power);
5900  EXPORT_SYMBOL(feature_set_gmac_phy_reset);
5901 -EXPORT_SYMBOL(feature_set_usb_power);
5902 -EXPORT_SYMBOL(feature_set_firewire_power);
5903  EXPORT_SYMBOL(nvram_read_byte);
5904  EXPORT_SYMBOL(nvram_write_byte);
5905 -EXPORT_SYMBOL(pmac_xpram_read);
5906 -EXPORT_SYMBOL(pmac_xpram_write);
5907  #ifdef CONFIG_SCSI
5908  EXPORT_SYMBOL(note_scsi_host);
5909  #endif /* CONFIG_SCSI */
5910 diff -urN linux.orig/arch/ppc/kernel/prep_pci.c linux/arch/ppc/kernel/prep_pci.c
5911 --- linux.orig/arch/ppc/kernel/prep_pci.c       Sun Mar 25 18:31:49 2001
5912 +++ linux/arch/ppc/kernel/prep_pci.c    Thu Jul 11 15:43:29 2002
5913 @@ -8,7 +8,6 @@
5914   */
5915  
5916  #include <linux/types.h>
5917 -#include <linux/string.h>
5918  #include <linux/pci.h>
5919  #include <linux/kernel.h>
5920  #include <linux/init.h>
5921 @@ -22,10 +21,10 @@
5922  #include <asm/residual.h>
5923  #include <asm/processor.h>
5924  #include <asm/irq.h>
5925 +#include <asm/irq-compat.h>
5926  #include <asm/machdep.h>
5927  
5928  #include "pci.h"
5929 -#include "open_pic.h"
5930  
5931  #define MAX_DEVNR 22
5932  
5933 @@ -38,11 +37,13 @@
5934  unsigned char *Motherboard_routes;
5935  void (*Motherboard_non0)(struct pci_dev *);
5936  
5937 -void Powerplus_Map_Non0(struct pci_dev *);
5938 +void Mesquite_Map_Non0(struct pci_dev *);
5939  
5940  /* Used for Motorola to store system config register */
5941  static unsigned long   *ProcInfo;
5942  
5943 +extern void chrp_do_IRQ(struct pt_regs *,int , int);
5944 +
5945  /* Tables for known hardware */   
5946  
5947  /* Motorola PowerStackII - Utah */
5948 @@ -508,51 +509,6 @@
5949          13      /* Line 4 */
5950  };
5951  
5952 -/* Motorola PowerPlus architecture PCI IRQ tables */
5953 -/* Interrupt line values for INTA-D on primary/secondary MPIC inputs */
5954 -
5955 -struct powerplus_irq_list
5956 -{
5957 -       unsigned char primary[4];       /* INT A-D */
5958 -       unsigned char secondary[4];     /* INT A-D */
5959 -};
5960 -
5961 -/*
5962 - * For standard PowerPlus boards, bus 0 PCI INTs A-D are routed to
5963 - * OpenPIC inputs 9-12.  PCI INTs A-D from the on board P2P bridge
5964 - * are routed to OpenPIC inputs 5-8.  These values are offset by 
5965 - * 16 in the table to reflect the Linux kernel interrupt value.
5966 - */
5967 -struct powerplus_irq_list Powerplus_pci_IRQ_list =
5968 -{
5969 -       {25, 26, 27, 28},
5970 -       {21, 22, 23, 24}
5971 -};
5972 -
5973 -/* 
5974 - * For the MCP750 (system slot board), bus 0 PCI INTs A-D are routed
5975 - * to OpenPIC inputs 8-11.  PCI INTs A-D from the on board P2P bridge
5976 - * are routed to OpenPIC inputs 12-15.  These values are offset by 16
5977 - * in the table to reflect the Linux kernel interrupt value.
5978 - */
5979 -struct powerplus_irq_list Mesquite_pci_IRQ_list =
5980 -{
5981 -       {24, 25, 26, 27},
5982 -       {28, 29, 30, 31}
5983 -};
5984 -
5985 -/*
5986 - * This table represents the standard PCI swizzle defined in the
5987 - * PCI bus specification.
5988 - */ 
5989 -static unsigned char prep_pci_intpins[4][4] =
5990 -{
5991 -        { 1, 2, 3, 4},  /* Buses 0, 4, 8, ... */
5992 -        { 2, 3, 4, 1},  /* Buses 1, 5, 9, ... */
5993 -        { 3, 4, 1, 2},  /* Buses 2, 6, 10 ... */
5994 -        { 4, 1, 2, 3},  /* Buses 3, 7, 11 ... */
5995 -};
5996 -
5997  /* We have to turn on LEVEL mode for changed IRQ's */
5998  /* All PCI IRQ's need to be level mode, so this should be something
5999   * other than hard-coded as well... IRQ's are individually mappable
6000 @@ -730,7 +686,8 @@
6001  #define MOT_RAVEN_PRESENT      0x1
6002  #define MOT_HAWK_PRESENT       0x2
6003  
6004 -int mot_entry = -1;
6005 +/* Keyboard present flag */
6006 +int prep_kbd_present = 1;   /* Keyboard present by default */
6007  
6008  int MotMPIC = 0;
6009  int mot_multi = 0;
6010 @@ -783,7 +740,7 @@
6011         OpenPIC_InitSenses = mvme2600_openpic_initsenses;
6012         OpenPIC_NumInitSenses = sizeof(mvme2600_openpic_initsenses);
6013  
6014 -       ppc_md.do_IRQ = open_pic_do_IRQ;
6015 +       ppc_md.do_IRQ = chrp_do_IRQ;
6016         
6017         /* If raven is present on Motorola store the system config register
6018          * for later use.
6019 @@ -795,17 +752,13 @@
6020                 mot_multi = 1;
6021         }
6022  
6023 -       /*
6024 -        * If a Motorola MVME2300, 2400, or MCPN750 board is detected
6025 -        * disable keyboard controller initialization to avoid system
6026 -        * hangs.
6027 +       /* This is a hack.  If this is a 2300 or 2400 mot board then there is
6028 +        * no keyboard controller and we have to indicate that.
6029          */
6030         base_mod = inb(MOTOROLA_BASETYPE_REG);
6031         if ((MotMPIC == MOT_HAWK_PRESENT) || (base_mod == 0xF9) ||
6032 -           (base_mod == 0xFA) || (base_mod == 0xE1)) {
6033 -               ppc_md.kbd_leds = NULL; 
6034 -               ppc_md.kbd_init_hw = NULL; 
6035 -       }
6036 +           (base_mod == 0xFA) || (base_mod == 0xE1))
6037 +               prep_kbd_present = 0;
6038  
6039         return 1;
6040  }
6041 @@ -819,35 +772,33 @@
6042         unsigned char   *map;
6043         unsigned char   *routes;
6044         void            (*map_non0_bus)(struct pci_dev *);      /* For boards with more than bus 0 devices. */
6045 -       struct powerplus_irq_list *pci_irq_list; /* List of PCI MPIC inputs */
6046 -       unsigned char   secondary_bridge_devfn; /* devfn of secondary bus transparent bridge */
6047  } mot_info[] = {
6048 -       {0x300, 0x00, 0x00, "MVME 2400",                        Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6049 -       {0x010, 0x00, 0x00, "Genesis",                          Genesis_pci_IRQ_map,    Genesis_pci_IRQ_routes, Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6050 -       {0x020, 0x00, 0x00, "Powerstack (Series E)",            Comet_pci_IRQ_map,      Comet_pci_IRQ_routes,   NULL, NULL, 0x00},
6051 -       {0x040, 0x00, 0x00, "Blackhawk (Powerstack)",           Blackhawk_pci_IRQ_map,  Blackhawk_pci_IRQ_routes, NULL, NULL, 0x00},
6052 -       {0x050, 0x00, 0x00, "Omaha (PowerStack II Pro3000)",    Omaha_pci_IRQ_map,      Omaha_pci_IRQ_routes,   NULL, NULL, 0x00},
6053 -       {0x060, 0x00, 0x00, "Utah (Powerstack II Pro4000)",     Utah_pci_IRQ_map,       Utah_pci_IRQ_routes,    NULL, NULL, 0x00},
6054 -       {0x0A0, 0x00, 0x00, "Powerstack (Series EX)",           Comet2_pci_IRQ_map,     Comet2_pci_IRQ_routes,  NULL, NULL, 0x00},
6055 -       {0x1E0, 0xE0, 0x00, "Mesquite cPCI (MCP750)",           Mesquite_pci_IRQ_map,   Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Mesquite_pci_IRQ_list, 0x00},
6056 -       {0x1E0, 0xE1, 0x00, "Sitka cPCI (MCPN750)",             Sitka_pci_IRQ_map,      Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6057 -       {0x1E0, 0xE2, 0x00, "Mesquite cPCI (MCP750) w/ HAC",    Mesquite_pci_IRQ_map,   Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Mesquite_pci_IRQ_list, 0xC0},
6058 -       {0x1E0, 0xF6, 0x80, "MTX Plus",                         MTXplus_pci_IRQ_map,    Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xA0},
6059 -       {0x1E0, 0xF6, 0x81, "Dual MTX Plus",                    MTXplus_pci_IRQ_map,    Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0xA0},
6060 -       {0x1E0, 0xF7, 0x80, "MTX wo/ Parallel Port",            MTX_pci_IRQ_map,        Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6061 -       {0x1E0, 0xF7, 0x81, "Dual MTX wo/ Parallel Port",       MTX_pci_IRQ_map,        Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6062 -       {0x1E0, 0xF8, 0x80, "MTX w/ Parallel Port",             MTX_pci_IRQ_map,        Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6063 -       {0x1E0, 0xF8, 0x81, "Dual MTX w/ Parallel Port",        MTX_pci_IRQ_map,        Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6064 -       {0x1E0, 0xF9, 0x00, "MVME 2300",                        Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6065 -       {0x1E0, 0xFA, 0x00, "MVME 2300SC/2600",                 Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6066 -       {0x1E0, 0xFB, 0x00, "MVME 2600 with MVME712M",          Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6067 -       {0x1E0, 0xFC, 0x00, "MVME 2600/2700 with MVME761",      Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6068 -       {0x1E0, 0xFD, 0x80, "MVME 3600 with MVME712M",          Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6069 -       {0x1E0, 0xFD, 0x81, "MVME 4600 with MVME712M",          Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6070 -       {0x1E0, 0xFE, 0x80, "MVME 3600 with MVME761",           Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6071 -       {0x1E0, 0xFE, 0x81, "MVME 4600 with MVME761",           Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   Powerplus_Map_Non0, &Powerplus_pci_IRQ_list, 0x00},
6072 -       {0x1E0, 0xFF, 0x00, "MVME 1600-001 or 1600-011",        Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   NULL, NULL, 0x00},
6073 -       {0x000, 0x00, 0x00, "",                                 NULL,                   NULL,   NULL, 0x00}
6074 +       {0x300, 0x00, 0x00, "MVME 2400",                        Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   NULL},
6075 +       {0x010, 0x00, 0x00, "Genesis",                          Genesis_pci_IRQ_map,    Genesis_pci_IRQ_routes, NULL},
6076 +       {0x020, 0x00, 0x00, "Powerstack (Series E)",            Comet_pci_IRQ_map,      Comet_pci_IRQ_routes,   NULL},
6077 +       {0x040, 0x00, 0x00, "Blackhawk (Powerstack)",           Blackhawk_pci_IRQ_map,  Blackhawk_pci_IRQ_routes, NULL},
6078 +       {0x050, 0x00, 0x00, "Omaha (PowerStack II Pro3000)",    Omaha_pci_IRQ_map,      Omaha_pci_IRQ_routes,   NULL},
6079 +       {0x060, 0x00, 0x00, "Utah (Powerstack II Pro4000)",     Utah_pci_IRQ_map,       Utah_pci_IRQ_routes,    NULL},
6080 +       {0x0A0, 0x00, 0x00, "Powerstack (Series EX)",           Comet2_pci_IRQ_map,     Comet2_pci_IRQ_routes,  NULL},
6081 +       {0x1E0, 0xE0, 0x00, "Mesquite cPCI (MCP750)",           Mesquite_pci_IRQ_map,   Raven_pci_IRQ_routes,   NULL},
6082 +       {0x1E0, 0xE1, 0x00, "Sitka cPCI (MCPN750)",             Sitka_pci_IRQ_map,      Raven_pci_IRQ_routes,   NULL},
6083 +       {0x1E0, 0xE2, 0x00, "Mesquite cPCI (MCP750) w/ HAC",    Mesquite_pci_IRQ_map,   Raven_pci_IRQ_routes,   Mesquite_Map_Non0},
6084 +       {0x1E0, 0xF6, 0x80, "MTX Plus",                         MTXplus_pci_IRQ_map,    Raven_pci_IRQ_routes,   NULL},
6085 +       {0x1E0, 0xF6, 0x81, "Dual MTX Plus",                    MTXplus_pci_IRQ_map,    Raven_pci_IRQ_routes,   NULL},
6086 +       {0x1E0, 0xF7, 0x80, "MTX wo/ Parallel Port",            MTX_pci_IRQ_map,        Raven_pci_IRQ_routes,   NULL},
6087 +       {0x1E0, 0xF7, 0x81, "Dual MTX wo/ Parallel Port",       MTX_pci_IRQ_map,        Raven_pci_IRQ_routes,   NULL},
6088 +       {0x1E0, 0xF8, 0x80, "MTX w/ Parallel Port",             MTX_pci_IRQ_map,        Raven_pci_IRQ_routes,   NULL},
6089 +       {0x1E0, 0xF8, 0x81, "Dual MTX w/ Parallel Port",        MTX_pci_IRQ_map,        Raven_pci_IRQ_routes,   NULL},
6090 +       {0x1E0, 0xF9, 0x00, "MVME 2300",                        Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   NULL},
6091 +       {0x1E0, 0xFA, 0x00, "MVME 2300SC/2600",                 Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   NULL},
6092 +       {0x1E0, 0xFB, 0x00, "MVME 2600 with MVME712M",          Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   NULL},
6093 +       {0x1E0, 0xFC, 0x00, "MVME 2600/2700 with MVME761",      Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   NULL},
6094 +       {0x1E0, 0xFD, 0x80, "MVME 3600 with MVME712M",          Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   NULL},
6095 +       {0x1E0, 0xFD, 0x81, "MVME 4600 with MVME712M",          Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   NULL},
6096 +       {0x1E0, 0xFE, 0x80, "MVME 3600 with MVME761",           Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   NULL},
6097 +       {0x1E0, 0xFE, 0x81, "MVME 4600 with MVME761",           Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   NULL},
6098 +       {0x1E0, 0xFF, 0x00, "MVME 1600-001 or 1600-011",        Genesis2_pci_IRQ_map,   Raven_pci_IRQ_routes,   NULL},
6099 +       {0x000, 0x00, 0x00, "",                                 NULL,                   NULL,   NULL}
6100  };
6101  
6102  __initfunc(unsigned long prep_route_pci_interrupts(void))
6103 @@ -862,6 +813,7 @@
6104                 unsigned char  cpu_type;
6105                 unsigned char  base_mod;
6106                 int            entry;
6107 +               int            mot_entry = -1;
6108  
6109                 cpu_type = inb(MOTOROLA_CPUTYPE_REG) & 0xF0;
6110                 base_mod = inb(MOTOROLA_BASETYPE_REG);
6111 @@ -1038,91 +990,91 @@
6112         return 0;
6113  }
6114  
6115 -/*
6116 - * Remove a device from the kernel PCI device list based on its 
6117 - * devfn identifier.
6118 - */
6119 -__initfunc(
6120 -void
6121 -prep_exclude_pci_device(unsigned char devfn)
6122 -)
6123 +static unsigned int pci_localpirqs[4] =
6124  {
6125 -       struct pci_dev *dev, *pdev = NULL;
6126 +       24,
6127 +       25,
6128 +       26,
6129 +       27
6130 +};
6131  
6132 -       /* Walk the pci device list */
6133 -       for(dev=pci_devices; dev; dev=dev->next) {
6134 -               if (dev->devfn == devfn)
6135 -               {
6136 -                       /*
6137 -                        * If we find a matching device, adjust
6138 -                        * the list to remove the device.
6139 -                        */
6140 -                       if (pdev != NULL)
6141 -                               pdev->next = dev->next;
6142 -                       else
6143 -                               pci_devices = dev->next;
6144 +static unsigned int pci_remotepirqs[4] =
6145 +{
6146 +       28,
6147 +       29,
6148 +       30,
6149 +       31
6150 +};
6151  
6152 -                       break;
6153 -               }
6154 -               pdev = dev;
6155 -       }
6156 -}
6157 +static unsigned int pci_remotedev = 0xc0;
6158  
6159  void
6160 -Powerplus_Map_Non0(struct pci_dev *dev)
6161 +Mesquite_Map_Non0(struct pci_dev *pdev)
6162  {
6163 -       struct pci_bus  *pbus;          /* Parent bus structure pointer */
6164 -       struct pci_dev  *tdev;          /* Temporary device structure */
6165 -        unsigned int    devnum;         /* Accumulated device number */
6166 -        unsigned char   intline;        /* Linux interrupt value */
6167 -       unsigned char   intpin;         /* PCI interrupt pin */
6168
6169 -       /* Check for valid PCI dev pointer */
6170 -       if (dev == NULL) return;
6171 -
6172 -       /* Fill our temporary device, and get the device number */
6173 -       *tdev = *dev;
6174 -       devnum = PCI_SLOT(tdev->devfn);
6175 -
6176 -       /* Read the interrupt pin of the device and adjust for indexing */
6177 -       pcibios_read_config_byte(tdev->bus->number, tdev->devfn,
6178 -                               PCI_INTERRUPT_PIN, &intpin);
6179 +       struct pci_bus  *pbus;          /* Parent Bus Structure Pointer */
6180 +       unsigned int    devnum;         /* Accumulated Device Number */
6181 +       unsigned int    irq;            /* IRQ Value */
6182  
6183 -       /* If device doesn't request an interrupt, return */
6184 -       if ( (intpin < 1) || (intpin > 4) )
6185 -               return;
6186 +       /*
6187 +       **    Device Interrupt Line register initialization.
6188 +       **    The IRQ line number will be generated after
6189 +       **    taking into account all the PCI-2-PCI bridge
6190 +       **    devices between the device and the Host Bridge.
6191 +       */
6192 +       devnum = PCI_SLOT(pdev->devfn);
6193 +       pbus = pdev->bus;
6194 +
6195 +       while ((pbus->parent)->primary != (pbus->parent)->secondary)
6196 +       {
6197 +           devnum += PCI_SLOT((pbus->self)->devfn);
6198 +
6199 +           pbus = pbus->parent;
6200 +       }
6201 +
6202 +       devnum &= 0x03;
6203 +
6204 +       /*
6205 +       **    By default, get the PCI local domain IRQ value.
6206 +       */
6207 +       irq = pci_localpirqs[devnum];
6208 +
6209 +       /*
6210 +       **    Determine if the device is located in the
6211 +       **    remote domain or not. We must find the
6212 +       **    domain's bridge device located on bus 0.
6213 +       */
6214 +       pbus = pdev->bus;
6215 +
6216 +       while (pbus->primary != 0)
6217 +           pbus = pbus->parent;
6218  
6219 -       intpin--;
6220 +       /*
6221 +       **    Check the device/function of domain's bridge
6222 +       **    device against the remote device/function.
6223 +       **    If the same, then the device is located in
6224 +       **    the remote domain. Thus, get the PCI remote
6225 +       **    domain IRQ value.
6226 +       */
6227 +       if ((pbus->self)->devfn == pci_remotedev)
6228 +        irq = pci_remotepirqs[devnum];
6229  
6230 -       /* Walk up to bus 0, adjusting the interrupt pin for the standard
6231 -          PCI bus swizzle. */
6232 -       do {
6233 -               intpin = (prep_pci_intpins[devnum % 4][intpin]) - 1;
6234 -               pbus = tdev->bus;        /* up one level */
6235 -               tdev = pbus->self;
6236 -               devnum = PCI_SLOT(tdev->devfn);
6237 -       } while(tdev->bus->number);
6238 -
6239 -       /* Use the primary interrupt inputs by default */
6240 -       intline = mot_info[mot_entry].pci_irq_list->primary[intpin];
6241 -
6242 -       /* If the board has secondary interrupt inputs, walk the bus and
6243 -          note the devfn of the bridge from bus 0.  If it is the same as
6244 -          the devfn of the bus bridge with secondary inputs, use those. */
6245 -       if (mot_info[mot_entry].secondary_bridge_devfn)
6246 +       /*
6247 +       **    Validate the IRQ number.
6248 +       */
6249 +       if (irq <= 255)
6250         {
6251 -               pbus = dev->bus;
6252
6253 -               while (pbus->primary != 0)
6254 -                       pbus = pbus->parent;
6255
6256 -               if ((pbus->self)->devfn == mot_info[mot_entry].secondary_bridge_devfn)
6257 -                       intline = mot_info[mot_entry].pci_irq_list->secondary[intpin];
6258 +           /*
6259 +           **    Set the device's Interrupt Line register
6260 +           **    to the IRQ number and save it in the
6261 +           **    device's structure.
6262 +           */
6263 +
6264 +           pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, (u8)irq);
6265 +
6266 +           pdev->irq = irq;
6267 +
6268         }
6269 -       
6270 -       /* Write calculated interrupt value to header and device list */
6271 -       pci_write_config_byte(dev, PCI_INTERRUPT_LINE, (u8)intline);
6272 -       dev->irq = intline;
6273 +       return;
6274  }
6275  
6276  int motopenpic_to_irq(int n)
6277 @@ -1130,7 +1082,7 @@
6278         if (n & 0xF0) {
6279                 return (n & 0x0F);
6280         } else {
6281 -               return(n+open_pic.irq_offset);
6282 +               return(openpic_to_irq(n));
6283         }
6284  }
6285  
6286 @@ -1169,17 +1121,6 @@
6287                                         dev->devfn, 0x44, short_reg);
6288                 }
6289         }
6290 -       if ((dev = pci_find_device(PCI_VENDOR_ID_WINBOND,
6291 -                                  PCI_DEVICE_ID_WINBOND_82C105, dev))){
6292 -               if (OpenPIC){
6293 -                       /* Disable LEGIRQ mode so PCI INTs are routed to
6294 -                          the 8259 */
6295 -                       pci_write_config_dword(dev, 0x40, 0x10ff00a1);
6296 -               } else {
6297 -                       /* Enable LEGIRQ for PCI INT -> 8259 IRQ routing */
6298 -                       pci_write_config_dword(dev, 0x40, 0x10ff08a1);
6299 -               }
6300 -       }
6301  }
6302  __initfunc(
6303  void
6304 @@ -1197,15 +1138,6 @@
6305  
6306         prep_route_pci_interrupts();
6307  
6308 -       /*
6309 -        * If MTX+, exclude the SL82C105 IDE controller so the driver
6310 -        * doesn't hang.
6311 -        */
6312 -       if ( _prep_type == _PREP_Motorola )
6313 -               if ( strstr(mot_info[mot_entry].name, "MTX Plus") )
6314 -                       /* On MTX+, SL82C105 is at IDSEL 0xb function 0x1 */
6315 -                       prep_exclude_pci_device(PCI_DEVFN(0xb, 0x1));
6316 -
6317         prep_pib_init();
6318  
6319         printk("Setting PCI interrupts for a \"%s\"\n", Motherboard_map_name);
6320 @@ -1219,7 +1151,7 @@
6321                        motopenpic_to_irq(Motherboard_map[PCI_SLOT(dev->devfn)]);
6322  
6323                     pcibios_write_config_byte(dev->bus->number, dev->devfn, 
6324 -                                             PCI_INTERRUPT_LINE, dev->irq);
6325 +                                             PCI_INTERRUPT_PIN, dev->irq);
6326                 } else {
6327                         if (Motherboard_non0 != NULL)
6328                                 Motherboard_non0(dev);
6329 diff -urN linux.orig/arch/ppc/kernel/prep_setup.c linux/arch/ppc/kernel/prep_setup.c
6330 --- linux.orig/arch/ppc/kernel/prep_setup.c     Sun Mar 25 18:31:49 2001
6331 +++ linux/arch/ppc/kernel/prep_setup.c  Thu Jul 11 15:46:34 2002
6332 @@ -33,12 +33,12 @@
6333  #include <linux/timex.h>
6334  #include <linux/pci.h>
6335  #include <linux/openpic.h>
6336 -#include <linux/delay.h>
6337  
6338  #include <asm/mmu.h>
6339  #include <asm/processor.h>
6340  #include <asm/residual.h>
6341  #include <asm/io.h>
6342 +#include <asm/irq-compat.h>
6343  #include <asm/pgtable.h>
6344  #include <asm/ide.h>
6345  #include <asm/cache.h>
6346 @@ -48,9 +48,9 @@
6347  #include <asm/prep_nvram.h>
6348  #include <asm/raven.h>
6349  #include <asm/keyboard.h>
6350 -#include <asm/time.h>
6351 -#include <asm/vga.h>
6352  
6353 +
6354 +#include "time.h"
6355  #include "local_irq.h"
6356  #include "i8259.h"
6357  #include "open_pic.h"
6358 @@ -102,12 +102,16 @@
6359  extern PTE *Hash, *Hash_end;
6360  extern unsigned long Hash_size, Hash_mask;
6361  extern int probingmem;
6362 +extern unsigned long loops_per_jiffy;
6363  
6364  #ifdef CONFIG_BLK_DEV_RAM
6365  extern int rd_doload;          /* 1 = load ramdisk, 0 = don't load */
6366  extern int rd_prompt;          /* 1 = prompt for ramdisk, 0 = don't prompt */
6367  extern int rd_image_start;     /* starting block # of image */
6368  #endif
6369 +#ifdef CONFIG_VGA_CONSOLE
6370 +unsigned long vgacon_remap_base;
6371 +#endif
6372  
6373  __prep
6374  int
6375 @@ -605,7 +609,6 @@
6376         int i;
6377  
6378         if (OpenPIC != NULL) {
6379 -               open_pic.irq_offset = 16;
6380                 for ( i = 16 ; i < 36 ; i++ )
6381                         irq_desc[i].ctl = &open_pic;
6382                 openpic_init(1);
6383 @@ -615,14 +618,8 @@
6384                  irq_desc[i].ctl = &i8259_pic;
6385          i8259_init();
6386  #ifdef __SMP__
6387 -       request_irq(OPENPIC_VEC_IPI, openpic_ipi_action,
6388 +       request_irq(openpic_to_irq(OPENPIC_VEC_SPURIOUS), openpic_ipi_action,
6389                     0, "IPI0", 0);
6390 -       request_irq(OPENPIC_VEC_IPI+1, openpic_ipi_action,
6391 -                   0, "IPI1 (invalidate TLB)", 0);
6392 -       request_irq(OPENPIC_VEC_IPI+2, openpic_ipi_action,
6393 -                   0, "IPI2 (stop CPU)", 0);
6394 -       request_irq(OPENPIC_VEC_IPI+3, openpic_ipi_action,
6395 -                   0, "IPI3 (reschedule)", 0);
6396  #endif /* __SMP__ */
6397  }
6398  
6399 diff -urN linux.orig/arch/ppc/kernel/prep_time.c linux/arch/ppc/kernel/prep_time.c
6400 --- linux.orig/arch/ppc/kernel/prep_time.c      Sun Mar 25 18:31:49 2001
6401 +++ linux/arch/ppc/kernel/prep_time.c   Thu Jul 11 15:43:29 2002
6402 @@ -26,7 +26,7 @@
6403  #include <asm/prep_nvram.h>
6404  #include <asm/mk48t59.h>
6405  
6406 -#include <asm/time.h>
6407 +#include "time.h"
6408  
6409  /*
6410   * The motorola uses the m48t18 rtc (includes DS1643) whose registers
6411 diff -urN linux.orig/arch/ppc/kernel/process.c linux/arch/ppc/kernel/process.c
6412 --- linux.orig/arch/ppc/kernel/process.c        Sun Mar 25 18:31:49 2001
6413 +++ linux/arch/ppc/kernel/process.c     Thu Jul 11 15:43:29 2002
6414 @@ -43,11 +43,9 @@
6415  #include <asm/mmu_context.h>
6416  
6417  int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs);
6418 -int dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs);
6419  extern unsigned long _get_SP(void);
6420  
6421  struct task_struct *last_task_used_math = NULL;
6422 -struct task_struct *last_task_used_altivec = NULL;
6423  static struct vm_area_struct init_mmap = INIT_MMAP;
6424  static struct fs_struct init_fs = INIT_FS;
6425  static struct files_struct init_files = INIT_FILES;
6426 @@ -81,31 +79,6 @@
6427         return 1;
6428  }
6429  
6430 -#ifdef CONFIG_ALTIVEC
6431 -int
6432 -dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs)
6433 -{
6434 -       if (regs->msr & MSR_VEC)
6435 -               giveup_altivec(current);
6436 -       memcpy(vrregs, &current->tss.vr[0], sizeof(*vrregs));
6437 -       return 1;
6438 -}
6439 -
6440 -void 
6441 -enable_kernel_altivec(void)
6442 -{
6443 -#ifdef __SMP__
6444 -       if (current->tss.regs && (current->tss.regs->msr & MSR_VEC))
6445 -               giveup_altivec(current);
6446 -       else
6447 -               giveup_altivec(NULL);   /* just enable AltiVec for kernel - force */
6448 -#else
6449 -       giveup_altivec(last_task_used_altivec);
6450 -#endif /* __SMP __ */
6451 -       printk("MSR_VEC in enable_altivec_kernel\n");
6452 -}
6453 -#endif /* CONFIG_ALTIVEC */
6454 -
6455  void
6456  enable_kernel_fp(void)
6457  {
6458 @@ -221,53 +194,22 @@
6459         _enable_interrupts(s);
6460  }
6461  
6462 -struct bits {
6463 -       const char *name;
6464 -       unsigned int bit;
6465 -};
6466 -
6467 -void print_bits(unsigned int val, struct bits *bits)
6468 -{
6469 -       const char *sep = "";
6470 -
6471 -       printk("[");
6472 -       for (; bits->bit != 0; ++bits) {
6473 -               if (val & bits->bit) {
6474 -                       printk("%s%s", sep, bits->name);
6475 -                       sep = ", ";
6476 -               }
6477 -       }
6478 -       printk("]");
6479 -}
6480 -
6481 -struct bits msr_bits[] = {
6482 -       {"VEC", MSR_VEC},
6483 -       {"EE", MSR_EE},
6484 -       {"PR", MSR_PR},
6485 -       {"FP", MSR_FP},
6486 -       {"IR", MSR_IR},
6487 -       {"DR", MSR_DR},
6488 -       {"ME", MSR_ME},
6489 -       {0, 0}
6490 -};
6491 -
6492 -void show_regs(struct pt_regs *regs)
6493 +void show_regs(struct pt_regs * regs)
6494  {
6495         int i;
6496  
6497         printk("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx\n",
6498                regs->nip, regs->xer, regs->link, regs,regs->trap);
6499 -       printk("MSR: %08lx ", regs->msr);
6500 -       print_bits(regs->msr, msr_bits);
6501 -       printk("\n");
6502 +       printk("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
6503 +              regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
6504 +              regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
6505 +              regs->msr&MSR_IR ? 1 : 0,
6506 +              regs->msr&MSR_DR ? 1 : 0);
6507         printk("TASK = %p[%d] '%s' mm->pgd %p ",
6508                current, current->pid, current->comm, current->mm->pgd);
6509         printk("Last syscall: %ld ", current->tss.last_syscall);
6510 -       if (last_task_used_math)
6511 -               printk("\nlast math %p", last_task_used_math);
6512 -       if (last_task_used_altivec)
6513 -               printk("\nlast altivec %p", last_task_used_altivec);
6514 -
6515 +       printk("\nlast math %p", last_task_used_math);
6516 +       
6517  #ifdef __SMP__ 
6518         printk(" CPU: %d last CPU: %d", current->processor,current->last_processor);
6519  #endif /* __SMP__ */
6520 @@ -314,16 +256,12 @@
6521  {
6522         if (last_task_used_math == current)
6523                 last_task_used_math = NULL;
6524 -       if (last_task_used_altivec == current)
6525 -               last_task_used_altivec = NULL;
6526  }
6527  
6528  void flush_thread(void)
6529  {
6530         if (last_task_used_math == current)
6531                 last_task_used_math = NULL;
6532 -       if (last_task_used_altivec == current)
6533 -               last_task_used_altivec = NULL;
6534  }
6535  
6536  void
6537 @@ -381,19 +319,6 @@
6538         if (regs->msr & MSR_FP)
6539                 giveup_fpu(current);
6540  
6541 -#ifdef CONFIG_ALTIVEC
6542 -       /*
6543 -        * copy altiVec info - assume lazy altiVec switch
6544 -        * - kumar
6545 -        */
6546 -       if (regs->msr & MSR_VEC)
6547 -               giveup_altivec(current);
6548 -
6549 -       memcpy(&p->tss.vr, &current->tss.vr, sizeof(p->tss.vr));
6550 -       p->tss.vscr = current->tss.vscr;
6551 -       childregs->msr &= ~MSR_VEC;
6552 -#endif /* CONFIG_ALTIVEC */
6553 -
6554         memcpy(&p->tss.fpr, &current->tss.fpr, sizeof(p->tss.fpr));
6555         p->tss.fpscr = current->tss.fpscr;
6556         childregs->msr &= ~MSR_FP;
6557 @@ -455,8 +380,6 @@
6558         shove_aux_table(sp);
6559         if (last_task_used_math == current)
6560                 last_task_used_math = 0;
6561 -       if (last_task_used_altivec == current)
6562 -               last_task_used_altivec = 0;
6563         current->tss.fpscr = 0;
6564  }
6565  
6566 @@ -516,10 +439,6 @@
6567                 goto out;
6568         if (regs->msr & MSR_FP)
6569                 giveup_fpu(current);
6570 -#ifdef CONFIG_ALTIVEC
6571 -       if (regs->msr & MSR_VEC)
6572 -               giveup_altivec(current);
6573 -#endif /* CONFIG_ALTIVEC */ 
6574         error = do_execve(filename, (char **) a1, (char **) a2, regs);
6575         putname(filename);
6576  out:
6577 diff -urN linux.orig/arch/ppc/kernel/prom.c linux/arch/ppc/kernel/prom.c
6578 --- linux.orig/arch/ppc/kernel/prom.c   Sun Mar 25 18:37:30 2001
6579 +++ linux/arch/ppc/kernel/prom.c        Thu Jul 11 15:43:29 2002
6580 @@ -16,29 +16,24 @@
6581  #include <linux/string.h>
6582  #include <linux/init.h>
6583  #include <linux/version.h>
6584 -#include <linux/fs.h>
6585 -#include <linux/console.h>
6586  #include <asm/spinlock.h>
6587  #include <asm/prom.h>
6588  #include <asm/page.h>
6589  #include <asm/processor.h>
6590  #include <asm/irq.h>
6591 +#include <asm/irq-compat.h>
6592  #include <asm/io.h>
6593  #include <asm/smp.h>
6594  #include <asm/bootx.h>
6595  #include <asm/system.h>
6596  #include <asm/gemini.h>
6597 -#include <asm/linux_logo.h>
6598 -#include <asm/mmu.h>
6599 -#include <asm/pgtable.h>
6600 -#include <asm/adb.h>
6601 -#include <asm/pmu.h>
6602  
6603  /*
6604   * Properties whose value is longer than this get excluded from our
6605   * copy of the device tree.  This way we don't waste space storing
6606   * things like "driver,AAPL,MacOS,PowerPC" properties.
6607   */
6608 +
6609  #define MAX_PROPERTY_LENGTH    1024
6610  
6611  struct prom_args {
6612 @@ -95,77 +90,45 @@
6613  char *of_stdout_device = 0;
6614  
6615  prom_entry prom = 0;
6616 -ihandle prom_chosen = 0, prom_stdout = 0, prom_disp_node = 0;
6617 +ihandle prom_chosen = 0, prom_stdout = 0;
6618  int prom_version = 0;
6619  
6620  extern char *klimit;
6621  char *bootpath = 0;
6622  char *bootdevice = 0;
6623  
6624 -unsigned int rtas_data = 0;   /* physical pointer */
6625 +unsigned int rtas_data = 0;   /* virtual pointer */
6626  unsigned int rtas_entry = 0;  /* physical pointer */
6627  unsigned int rtas_size = 0;
6628  unsigned int old_rtas = 0;
6629  
6630 -/* Set for a newworld machine */
6631 -int use_of_interrupt_tree = 0;
6632 -int pmac_newworld = 0;
6633 -
6634  static struct device_node *allnodes = 0;
6635  
6636 -#ifdef CONFIG_BOOTX_TEXT
6637 -
6638 -/*
6639 - * The VGA font is in the _pmac section. Can't this cause problems with CHRP
6640 - * using some of the prom_xxxx functions ?
6641 - * All this need to be moved in a separate source file anyway
6642 - */
6643 -
6644  static void clearscreen(void);
6645  static void flushscreen(void);
6646  
6647 +#ifdef CONFIG_BOOTX_TEXT
6648 +
6649  void drawchar(char c);
6650  void drawstring(const char *c);
6651 -void drawhex(unsigned long v);
6652 +static void drawhex(unsigned long v);
6653  static void scrollscreen(void);
6654 -static void prepare_disp_BAT(void);
6655 -static void boot_console_write(struct console *co, const char *s,
6656 -                                unsigned count);
6657  
6658  static void draw_byte(unsigned char c, long locX, long locY);
6659 -static void draw_byte_32(unsigned char *bits, unsigned long *base, int rb);
6660 -static void draw_byte_16(unsigned char *bits, unsigned long *base, int rb);
6661 -static void draw_byte_8(unsigned char *bits, unsigned long *base, int rb);
6662 -
6663 -/* We want those in the data section */
6664 -static long                            g_loc_X = 0;
6665 -static long                            g_loc_Y = 0;
6666 -static long                            g_max_loc_X = 0;
6667 -static long                            g_max_loc_Y = 0; 
6668 -
6669 -unsigned long disp_BATL = 0;
6670 -unsigned long disp_BATU = 0;
6671 +static void draw_byte_32(unsigned char *bits, unsigned long *base);
6672 +static void draw_byte_16(unsigned char *bits, unsigned long *base);
6673 +static void draw_byte_8(unsigned char *bits, unsigned long *base);
6674 +
6675 +static long                            g_loc_X;
6676 +static long                            g_loc_Y;
6677 +static long                            g_max_loc_X;
6678 +static long                            g_max_loc_Y;
6679  
6680  #define cmapsz (16*256)
6681  
6682  static unsigned char vga_font[cmapsz];
6683  
6684 -static struct console boot_cons = {
6685 -       "boot",
6686 -       boot_console_write,
6687 -       NULL,
6688 -       NULL,
6689 -       NULL,
6690 -       NULL,
6691 -       NULL,
6692 -       CON_PRINTBUFFER,
6693 -       0,
6694 -       0,
6695 -       NULL
6696 -};
6697 -static int boot_cons_registered = 0;
6698 -
6699 -#endif /* CONFIG_BOOTX_TEXT */
6700 +#endif
6701  
6702  
6703  static void *call_prom(const char *service, int nargs, int nret, ...);
6704 @@ -175,25 +138,15 @@
6705                                   unsigned long, struct device_node ***);
6706  static unsigned long finish_node(struct device_node *, unsigned long,
6707                                  interpret_func *);
6708 -static unsigned long finish_node_interrupts(struct device_node *, unsigned long);
6709  static unsigned long check_display(unsigned long);
6710  static int prom_next_node(phandle *);
6711  static void *early_get_property(unsigned long, unsigned long, char *);
6712  
6713 -#ifdef CONFIG_BOOTX_TEXT
6714 -static void setup_disp_fake_bi(ihandle dp);
6715 -static void prom_welcome(boot_infos_t* bi, unsigned long phys);
6716 -#endif
6717 -
6718  extern void enter_rtas(void *);
6719  extern unsigned long reloc_offset(void);
6720  
6721  extern char cmd_line[512];     /* XXX */
6722  boot_infos_t *boot_infos = 0;  /* init it so it's in data segment not bss */
6723 -#ifdef CONFIG_BOOTX_TEXT
6724 -boot_infos_t *disp_bi = 0;
6725 -boot_infos_t fake_bi = {0,};
6726 -#endif
6727  
6728  /*
6729   * prom_init() is called very early on, before the kernel text
6730 @@ -276,7 +229,7 @@
6731         return prom_args.args[nargs];
6732  }
6733  
6734 -/*__init*/
6735 +__init
6736  void
6737  prom_print(const char *msg)
6738  {
6739 @@ -286,7 +239,7 @@
6740         if (RELOC(prom_stdout) == 0)
6741         {
6742  #ifdef CONFIG_BOOTX_TEXT
6743 -               if (RELOC(disp_bi) != 0)
6744 +               if (RELOC(boot_infos) != 0)
6745                         drawstring(msg);
6746  #endif
6747                 return;
6748 @@ -307,22 +260,6 @@
6749         }
6750  }
6751  
6752 -void
6753 -prom_print_hex(unsigned int v)
6754 -{
6755 -       char buf[16];
6756 -       int i, c;
6757 -
6758 -       for (i = 0; i < 8; ++i) {
6759 -               c = (v >> ((7-i)*4)) & 0xf;
6760 -               c += (c >= 10)? ('a' - 10): '0';
6761 -               buf[i] = c;
6762 -       }
6763 -       buf[i] = ' ';
6764 -       buf[i+1] = 0;
6765 -       prom_print(buf);
6766 -}
6767 -
6768  unsigned long smp_ibm_chrp_hack __initdata = 0;
6769  
6770  /*
6771 @@ -338,7 +275,6 @@
6772         phandle node;
6773         char type[16], *path;
6774  #endif 
6775 -       int chrp = 0;
6776         unsigned long mem;
6777         ihandle prom_rtas, prom_mmu, prom_op;
6778         unsigned long offset = reloc_offset();
6779 @@ -365,19 +301,22 @@
6780                 unsigned long space;
6781                 unsigned long ptr, x;
6782                 char *model;
6783 +#ifdef CONFIG_BOOTX_TEXT
6784 +               unsigned long flags;
6785 +#endif         
6786  
6787                 RELOC(boot_infos) = PTRUNRELOC(bi);
6788                 if (!BOOT_INFO_IS_V2_COMPATIBLE(bi))
6789                         bi->logicalDisplayBase = 0;
6790 +
6791 +               clearscreen();
6792 +
6793  #ifdef CONFIG_BOOTX_TEXT
6794                 RELOC(g_loc_X) = 0;
6795                 RELOC(g_loc_Y) = 0;
6796                 RELOC(g_max_loc_X) = (bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) / 8;
6797                 RELOC(g_max_loc_Y) = (bi->dispDeviceRect[3] - bi->dispDeviceRect[1]) / 16;
6798 -               RELOC(disp_bi) = PTRUNRELOC(bi);
6799                 
6800 -               clearscreen();
6801 -
6802                 /* Test if boot-info is compatible. Done only in config CONFIG_BOOTX_TEXT since
6803                    there is nothing much we can do with an incompatible version, except display
6804                    a message and eventually hang the processor...
6805 @@ -388,10 +327,24 @@
6806                 if (!BOOT_INFO_IS_COMPATIBLE(bi))
6807                         prom_print(RELOC(" !!! WARNING - Incompatible version of BootX !!!\n\n\n"));
6808                 
6809 -               prom_welcome(bi, phys);
6810 +               prom_print(RELOC("Welcome to Linux, kernel " UTS_RELEASE "\n"));
6811 +               prom_print(RELOC("\nstarted at       : 0x"));
6812 +               drawhex(reloc_offset() + KERNELBASE);
6813 +               prom_print(RELOC("\nlinked at        : 0x"));
6814 +               drawhex(KERNELBASE);
6815 +               prom_print(RELOC("\nframe buffer at  : 0x"));
6816 +               drawhex((unsigned long)bi->dispDeviceBase);
6817 +               prom_print(RELOC(" (phys), 0x"));
6818 +               drawhex((unsigned long)bi->logicalDisplayBase);
6819 +               prom_print(RELOC(" (log)"));
6820 +               prom_print(RELOC("\nMSR              : 0x"));
6821 +               __asm__ __volatile__ ("mfmsr %0" : "=r" ((flags)) : : "memory");
6822 +               drawhex(flags);
6823 +               prom_print(RELOC("\n\n"));
6824 +#endif
6825 +               /* Out of the #if/#endif since it flushes the clearscreen too */
6826                 flushscreen();
6827 -#endif /* CONFIG_BOOTX_TEXT */
6828 -
6829 +               
6830                 /* New BootX enters kernel with MMU off, i/os are not allowed
6831                    here. This hack will have been done by the boostrap anyway.
6832                  */
6833 @@ -432,7 +385,6 @@
6834                 }
6835                 
6836  #ifdef CONFIG_BOOTX_TEXT
6837 -               prepare_disp_BAT();
6838                 prom_print(RELOC("booting...\n"));
6839                 flushscreen();
6840  #endif
6841 @@ -470,15 +422,12 @@
6842             int sz;
6843             sz = (int)call_prom(RELOC("getprop"), 4, 1, prom_op, RELOC("model"), model, 64);
6844             if (sz > 0) {
6845 -               if ( strncmp(model,RELOC("IBM"),3) ) {
6846 -                   char *c;
6847 -                   for (c = model; *c; c++)
6848 -                       if (*c >= '0' && *c <= '9') {
6849 -                           RELOC(prom_version) = *c - '0';
6850 -                           break;
6851 -                       }
6852 -               } else
6853 -                   chrp = 1;
6854 +               char *c;
6855 +               for (c = model; *c; c++)
6856 +                   if (*c >= '0' && *c <= '9') {
6857 +                       RELOC(prom_version) = *c - '0';
6858 +                       break;
6859 +                   }
6860             }
6861         }
6862         if (RELOC(prom_version) >= 3)
6863 @@ -498,6 +447,15 @@
6864                 RELOC(bootdevice) = PTRUNRELOC(d);
6865                 mem = ALIGN(mem + strlen(d) + 1);
6866         }
6867 +
6868 +       mem = check_display(mem);
6869 +
6870 +       prom_print(RELOC("copying OF device tree..."));
6871 +       mem = copy_device_tree(mem, mem + (1<<20));
6872 +       prom_print(RELOC("done\n"));
6873 +
6874 +
6875 +       RELOC(klimit) = (char *) (mem - offset);
6876         
6877         prom_rtas = call_prom(RELOC("finddevice"), 1, 1, RELOC("/rtas"));
6878         if (prom_rtas != (void *) -1) {
6879 @@ -509,14 +467,18 @@
6880                         RELOC(rtas_data) = 0;
6881                 } else {
6882                         /*
6883 -                        * Ask OF for some space for RTAS.
6884 +                        * We do _not_ want the rtas_data inside the klimit
6885 +                        * boundry since it'll be squashed when we do the
6886 +                        * relocate of the kernel on chrp right after prom_init()
6887 +                        * in head.S.  So, we just pick a spot in memory.
6888 +                        * -- Cort
6889                          */
6890 -                       RELOC(rtas_data) = (unsigned int)
6891 -                               call_prom(RELOC("claim"), 3, 1, 0,
6892 -                                         RELOC(rtas_size), 0x1000);
6893 -                       prom_print(RELOC("rtas at "));
6894 -                       prom_print_hex(RELOC(rtas_data));
6895 -                       prom_print(RELOC("\n"));
6896 +#if 0
6897 +                       mem = (mem + 4095) & -4096;
6898 +                       RELOC(rtas_data) = mem + KERNELBASE;
6899 +                       mem += RELOC(rtas_size);
6900 +#endif
6901 +                       RELOC(rtas_data) = (6<<20) + KERNELBASE;
6902                 }
6903                 prom_rtas = call_prom(RELOC("open"), 1, 1, RELOC("/rtas"));
6904                 {
6905 @@ -528,7 +490,7 @@
6906                         prom_args.nret = 2;
6907                         prom_args.args[0] = RELOC("instantiate-rtas");
6908                         prom_args.args[1] = prom_rtas;
6909 -                       prom_args.args[2] = (void *) RELOC(rtas_data);
6910 +                       prom_args.args[2] = ((void *)(RELOC(rtas_data)-KERNELBASE));
6911                         RELOC(prom)(&prom_args);
6912                         if (prom_args.args[nargs] != 0)
6913                                 i = 0;
6914 @@ -542,15 +504,6 @@
6915                         prom_print(RELOC(" done\n"));
6916         }
6917  
6918 -       mem = check_display(mem);
6919 -
6920 -       prom_print(RELOC("copying OF device tree..."));
6921 -       /* N.B. do this *after* any claims */
6922 -       mem = copy_device_tree(mem, mem + (1<<20));
6923 -       prom_print(RELOC("done\n"));
6924 -
6925 -       RELOC(klimit) = (char *) (mem - offset);
6926 -
6927         /* If we are already running at 0xc0000000, we assume we were loaded by
6928          * an OF bootloader which did set a BAT for us. This breaks OF translate
6929          * so we force phys to be 0
6930 @@ -582,11 +535,6 @@
6931             }
6932         }
6933             
6934 -#ifdef CONFIG_BOOTX_TEXT
6935 -       if (RELOC(prom_disp_node) != 0)
6936 -               setup_disp_fake_bi(RELOC(prom_disp_node));
6937 -#endif
6938 -
6939  #ifdef CONFIG_SMP
6940         /*
6941          * With CHRP SMP we need to use the OF to start the other
6942 @@ -607,11 +555,7 @@
6943          * is in its holding pattern code.
6944          *
6945          * -- Cort
6946 -        * 
6947 -        * This code crashes on some pmacs since the memory at 8M is not
6948 -        * claim'ed and so can be unmapped. -- BenH
6949          */
6950 -       if (chrp)
6951         {
6952                 extern void __secondary_hold(void);
6953                 unsigned long i;
6954 @@ -637,7 +581,7 @@
6955         }
6956  
6957         /* look for cpus */
6958 -       for (node = 0; chrp && prom_next_node(&node);)
6959 +       for (node = 0; prom_next_node(&node);)
6960         {
6961                 type[0] = 0;
6962                 call_prom(RELOC("getprop"), 4, 1, node, RELOC("device_type"),
6963 @@ -666,132 +610,19 @@
6964                 else
6965                         prom_print(RELOC("...failed\n"));
6966         }
6967 +#endif /* CONFIG_SMP */
6968         
6969 -#endif 
6970 -       /* If PowerMac, then use quiesce call */
6971 -       if (!chrp) {
6972 +       /* If OpenFirmware version >= 3, then use quiesce call */
6973 +       if (RELOC(prom_version) >= 3) {
6974             prom_print(RELOC("Calling quiesce ...\n"));
6975             call_prom(RELOC("quiesce"), 0, 0);
6976             offset = reloc_offset();
6977             phys = offset + KERNELBASE;
6978         }
6979  
6980 -#ifdef CONFIG_BOOTX_TEXT
6981 -       if (!chrp && RELOC(disp_bi)) {
6982 -               RELOC(prom_stdout) = 0;
6983 -               clearscreen();
6984 -               prepare_disp_BAT();
6985 -               prom_welcome(PTRRELOC(RELOC(disp_bi)), phys);
6986 -       }
6987 -#endif
6988 -
6989 -       prom_print(RELOC("booting...\n"));
6990         return phys;
6991  }
6992  
6993 -#ifdef CONFIG_BOOTX_TEXT
6994 -__init static void
6995 -prom_welcome(boot_infos_t* bi, unsigned long phys)
6996 -{
6997 -       unsigned long offset = reloc_offset();
6998 -       unsigned long flags;
6999 -       unsigned long pvr;
7000 -       
7001 -       prom_print(RELOC("Welcome to Linux, kernel " UTS_RELEASE "\n"));
7002 -       prom_print(RELOC("\nstarted at       : 0x"));
7003 -       drawhex(phys);
7004 -       prom_print(RELOC("\nlinked at        : 0x"));
7005 -       drawhex(KERNELBASE);
7006 -       prom_print(RELOC("\nframe buffer at  : 0x"));
7007 -       drawhex((unsigned long)bi->dispDeviceBase);
7008 -       prom_print(RELOC(" (phys), 0x"));
7009 -       drawhex((unsigned long)bi->logicalDisplayBase);
7010 -       prom_print(RELOC(" (log)"));
7011 -       prom_print(RELOC("\nMSR              : 0x"));
7012 -       __asm__ __volatile__ ("mfmsr %0" : "=r" (flags));
7013 -       drawhex(flags);
7014 -       __asm__ __volatile__ ("mfspr %0, 287" : "=r" (pvr));
7015 -       pvr >>= 16;
7016 -       if (pvr > 1) {
7017 -           prom_print(RELOC("\nHID0             : 0x"));
7018 -           __asm__ __volatile__ ("mfspr %0, 1008" : "=r" (flags));
7019 -           drawhex(flags);
7020 -       }
7021 -       if (pvr == 8 || pvr == 12) {
7022 -           prom_print(RELOC("\nICTC             : 0x"));
7023 -           __asm__ __volatile__ ("mfspr %0, 1019" : "=r" (flags));
7024 -           drawhex(flags);
7025 -       }
7026 -       prom_print(RELOC("\n\n"));
7027 -}
7028 -
7029 -void showvalue(char *str, unsigned long val)
7030 -{
7031 -       drawstring(str);
7032 -       drawhex(val);
7033 -       drawstring("\n");
7034 -}
7035 -
7036 -/* Calc BAT values for mapping the display and store them
7037 - * in disp_BATH and disp_BATL. Those values are then used
7038 - * from head.S to map the display during identify_machine()
7039 - * and MMU_Init()
7040 - * 
7041 - * For now, the display is mapped in place (1:1). This should
7042 - * be changed if the display physical address overlaps
7043 - * KERNELBASE, which is fortunately not the case on any machine
7044 - * I know of. This mapping is temporary and will disappear as
7045 - * soon as the setup done by MMU_Init() is applied
7046 - * 
7047 - * For now, we align the BAT and then map 8Mb on 601 and 16Mb
7048 - * on other PPCs. This may cause trouble if the framebuffer
7049 - * is really badly aligned, but I didn't encounter this case
7050 - * yet.
7051 - */
7052 -__init
7053 -static void
7054 -prepare_disp_BAT(void)
7055 -{
7056 -       unsigned long offset = reloc_offset();
7057 -       boot_infos_t* bi = PTRRELOC(RELOC(disp_bi));
7058 -       unsigned long addr = (unsigned long)bi->dispDeviceBase;
7059 -       
7060 -       if ((_get_PVR() >> 16) != 1) {
7061 -               /* 603, 604, G3, G4, ... */
7062 -               addr &= 0xFF000000UL;
7063 -               RELOC(disp_BATU) = addr | (BL_16M<<2) | 2;
7064 -               RELOC(disp_BATL) = addr | (_PAGE_NO_CACHE | _PAGE_GUARDED | BPP_RW);            
7065 -       } else {
7066 -               /* 601 */
7067 -               addr &= 0xFF800000UL;
7068 -               RELOC(disp_BATU) = addr | (_PAGE_NO_CACHE | PP_RWXX) | 4;
7069 -               RELOC(disp_BATL) = addr | BL_8M | 0x40;
7070 -       }
7071 -       bi->logicalDisplayBase = bi->dispDeviceBase;
7072 -}
7073 -
7074 -#endif
7075 -
7076 -__init
7077 -static int
7078 -prom_set_color(ihandle ih, int i, int r, int g, int b)
7079 -{
7080 -       struct prom_args prom_args;
7081 -       unsigned long offset = reloc_offset();
7082 -
7083 -       prom_args.service = RELOC("call-method");
7084 -       prom_args.nargs = 6;
7085 -       prom_args.nret = 1;
7086 -       prom_args.args[0] = RELOC("color!");
7087 -       prom_args.args[1] = ih;
7088 -       prom_args.args[2] = (void *) i;
7089 -       prom_args.args[3] = (void *) b;
7090 -       prom_args.args[4] = (void *) g;
7091 -       prom_args.args[5] = (void *) r;
7092 -       RELOC(prom)(&prom_args);
7093 -       return (int) prom_args.args[6];
7094 -}
7095 -
7096  /*
7097   * If we have a display that we don't know how to drive,
7098   * we will want to try to execute OF's open method for it
7099 @@ -804,32 +635,11 @@
7100  static unsigned long
7101  check_display(unsigned long mem)
7102  {
7103 -#ifdef CONFIG_FB
7104         phandle node;
7105         ihandle ih;
7106         int i;
7107         unsigned long offset = reloc_offset();
7108 -       char type[16], *path, name[32];
7109 -       static unsigned char default_colors[] = {
7110 -               0x00, 0x00, 0x00,
7111 -               0x00, 0x00, 0xaa,
7112 -               0x00, 0xaa, 0x00,
7113 -               0x00, 0xaa, 0xaa,
7114 -               0xaa, 0x00, 0x00,
7115 -               0xaa, 0x00, 0xaa,
7116 -               0xaa, 0xaa, 0x00,
7117 -               0xaa, 0xaa, 0xaa,
7118 -               0x55, 0x55, 0x55,
7119 -               0x55, 0x55, 0xff,
7120 -               0x55, 0xff, 0x55,
7121 -               0x55, 0xff, 0xff,
7122 -               0xff, 0x55, 0x55,
7123 -               0xff, 0x55, 0xff,
7124 -               0xff, 0xff, 0x55,
7125 -               0xff, 0xff, 0xff
7126 -       };
7127 -
7128 -       RELOC(prom_disp_node) = 0;
7129 +       char type[16], *path;
7130  
7131         for (node = 0; prom_next_node(&node); ) {
7132                 type[0] = 0;
7133 @@ -837,12 +647,6 @@
7134                           type, sizeof(type));
7135                 if (strcmp(type, RELOC("display")) != 0)
7136                         continue;
7137 -               name[0] = 0;
7138 -               call_prom(RELOC("getprop"), 4, 1, node, RELOC("name"),
7139 -                         name, sizeof(name));
7140 -               if (!strcmp(name, RELOC("offscreen-display")))
7141 -                       continue;
7142 -
7143                 /* It seems OF doesn't null-terminate the path :-( */
7144                 path = (char *) mem;
7145                 memset(path, 0, 256);
7146 @@ -858,24 +662,6 @@
7147                 }
7148                 prom_print(RELOC("... ok\n"));
7149  
7150 -               if (RELOC(prom_disp_node) == 0)
7151 -                       RELOC(prom_disp_node) = node;
7152 -
7153 -               /* Setup a useable color table when the appropriate
7154 -                * method is available. Should update this to set-colors */
7155 -               for (i = 0; i < 32; i++)
7156 -                       if (prom_set_color(ih, i, RELOC(default_colors)[i*3],
7157 -                                          RELOC(default_colors)[i*3+1],
7158 -                                          RELOC(default_colors)[i*3+2]) != 0)
7159 -                               break;
7160 -
7161 -               for (i = 0; i < LINUX_LOGO_COLORS; i++)
7162 -                       if (prom_set_color(ih, i + 32,
7163 -                                          RELOC(linux_logo_red)[i],
7164 -                                          RELOC(linux_logo_green)[i],
7165 -                                          RELOC(linux_logo_blue)[i]) != 0)
7166 -                               break;
7167 -
7168                 /*
7169                  * If this display is the device that OF is using for stdout,
7170                  * move it to the front of the list.
7171 @@ -892,85 +678,9 @@
7172                 if (RELOC(prom_num_displays) >= FB_MAX)
7173                         break;
7174         }
7175 -#endif /* CONFIG_FB */
7176         return ALIGN(mem);
7177  }
7178  
7179 -/* This function will enable the early boot text when doing OF booting. This
7180 - * way, xmon output should work too
7181 - */
7182 -#ifdef CONFIG_BOOTX_TEXT
7183 -__init
7184 -static void
7185 -setup_disp_fake_bi(ihandle dp)
7186 -{
7187 -       unsigned int len;
7188 -       int width = 640, height = 480, depth = 8, pitch;
7189 -       unsigned  address;
7190 -       boot_infos_t* bi;
7191 -       unsigned long offset = reloc_offset();
7192 -       
7193 -       prom_print(RELOC("Initing fake screen\n"));
7194 -
7195 -       len = 0;
7196 -       call_prom(RELOC("getprop"), 4, 1, dp, RELOC("depth"), &len, sizeof(len));
7197 -       if (len == 0)
7198 -               prom_print(RELOC("Warning: assuming display depth = 8\n"));
7199 -       else
7200 -               depth = len;
7201 -       width = len = 0;
7202 -       call_prom(RELOC("getprop"), 4, 1, dp, RELOC("width"), &len, sizeof(len));
7203 -       width = len;
7204 -       if (width == 0) {
7205 -               prom_print(RELOC("Failed to get width\n"));
7206 -               return;
7207 -       }
7208 -       height = len = 0;
7209 -       call_prom(RELOC("getprop"), 4, 1, dp, RELOC("height"), &len, sizeof(len));
7210 -       height = len;
7211 -       if (height == 0) {
7212 -               prom_print(RELOC("Failed to get height\n"));
7213 -               return;
7214 -       }
7215 -       pitch = len = 0;
7216 -       call_prom(RELOC("getprop"), 4, 1, dp, RELOC("linebytes"), &len, sizeof(len));
7217 -       pitch = len;
7218 -       if (pitch == 0) {
7219 -               prom_print(RELOC("Failed to get pitch\n"));
7220 -               return;
7221 -       }
7222 -       if (pitch == 1)
7223 -               pitch = 0x1000;
7224 -       address = len = 0;
7225 -       len = 0xfa000000;
7226 -       call_prom(RELOC("getprop"), 4, 1, dp, RELOC("address"), &len, sizeof(len));
7227 -       address = len;
7228 -       if (address == 0) {
7229 -               prom_print(RELOC("Failed to get address\n"));
7230 -               return;
7231 -       }
7232 -#if 0
7233 -       /* kludge for valkyrie */
7234 -       if (strcmp(dp->name, "valkyrie") == 0) 
7235 -           address += 0x1000;
7236 -#endif
7237
7238 -       RELOC(disp_bi) = &fake_bi;
7239 -       bi = PTRRELOC((&fake_bi));
7240 -       RELOC(g_loc_X) = 0;
7241 -       RELOC(g_loc_Y) = 0;
7242 -       RELOC(g_max_loc_X) = width / 8;
7243 -       RELOC(g_max_loc_Y) = height / 16;
7244 -       bi->logicalDisplayBase = (unsigned char *)address;
7245 -       bi->dispDeviceBase = (unsigned char *)address;
7246 -       bi->dispDeviceRowBytes = pitch;
7247 -       bi->dispDeviceDepth = depth;
7248 -       bi->dispDeviceRect[0] = bi->dispDeviceRect[1] = 0;
7249 -       bi->dispDeviceRect[2] = width;
7250 -       bi->dispDeviceRect[3] = height;
7251 -}
7252 -#endif
7253 -
7254  __init
7255  static int
7256  prom_next_node(phandle *nodep)
7257 @@ -1106,18 +816,6 @@
7258  {
7259         unsigned long mem = (unsigned long) klimit;
7260  
7261 -       /* All newworld machines and CHRP now use the interrupt tree */
7262 -       struct device_node *np = allnodes;
7263 -       while(np && (_machine == _MACH_Pmac)) {
7264 -               if (get_property(np, "interrupt-parent", 0)) {
7265 -                       pmac_newworld = 1;
7266 -                       break;
7267 -               }
7268 -               np = np->allnext;
7269 -       }
7270 -       if ((_machine == _MACH_chrp) || (boot_infos == 0 && pmac_newworld))
7271 -               use_of_interrupt_tree = 1;
7272 -
7273         mem = finish_node(allnodes, mem, NULL);
7274         printk(KERN_INFO "device tree used %lu bytes\n",
7275                mem - (unsigned long) allnodes);
7276 @@ -1158,9 +856,6 @@
7277         if (ifunc != NULL) {
7278                 mem_start = ifunc(np, mem_start);
7279         }
7280 -       if (use_of_interrupt_tree) {
7281 -               mem_start = finish_node_interrupts(np, mem_start);
7282 -       }
7283  
7284         /* the f50 sets the name to 'display' and 'compatible' to what we
7285          * expect for the name -- Cort
7286 @@ -1207,151 +902,6 @@
7287         return mem_start;
7288  }
7289  
7290 -/* This routine walks the interrupt tree for a given device node and gather 
7291 - * all necessary informations according to the draft interrupt mapping
7292 - * for CHRP. The current version was only tested on Apple "Core99" machines
7293 - * and may not handle cascaded controllers correctly.
7294 - */
7295 -__init
7296 -static unsigned long
7297 -finish_node_interrupts(struct device_node *np, unsigned long mem_start)
7298 -{
7299 -       /* Finish this node */
7300 -       unsigned int *isizep, *asizep, *interrupts, *map, *map_mask, *reg;
7301 -       phandle *parent;
7302 -       struct device_node *node, *parent_node;
7303 -       int l, isize, ipsize, asize, map_size, regpsize;
7304 -
7305 -       /* Currently, we don't look at all nodes with no "interrupts" property */
7306 -       interrupts = (unsigned int *)get_property(np, "interrupts", &l);
7307 -       if (interrupts == NULL)
7308 -               return mem_start;
7309 -       ipsize = l>>2;
7310 -
7311 -       reg = (unsigned int *)get_property(np, "reg", &l);
7312 -       regpsize = l>>2;
7313 -
7314 -       /* We assume default interrupt cell size is 1 (bugus ?) */
7315 -       isize = 1;
7316 -       node = np;
7317 -       
7318 -       do {
7319 -           /* We adjust the cell size if the current parent contains an #interrupt-cells
7320 -            * property */
7321 -           isizep = (unsigned int *)get_property(node, "#interrupt-cells", &l);
7322 -           if (isizep)
7323 -               isize = *isizep;
7324 -
7325 -           /* We don't do interrupt cascade (ISA) for now, we stop on the first 
7326 -            * controller found
7327 -            */
7328 -           if (get_property(node, "interrupt-controller", &l)) {
7329 -               int i,j;
7330 -               np->intrs = (struct interrupt_info *) mem_start;
7331 -               np->n_intrs = ipsize / isize;
7332 -               mem_start += np->n_intrs * sizeof(struct interrupt_info);
7333 -               for (i = 0; i < np->n_intrs; ++i) {
7334 -                   np->intrs[i].line = *interrupts++;
7335 -                   np->intrs[i].sense = 0;
7336 -                   if (isize > 1)
7337 -                       np->intrs[i].sense = *interrupts++;
7338 -                   for (j=2; j<isize; j++)
7339 -                       interrupts++;
7340 -               }
7341 -               /*
7342 -                *  On the CHRP LongTrail, ISA interrupts are cascaded through
7343 -                *  the OpenPIC. For compatibility reasons, ISA interrupts are
7344 -                *  numbered 0-15 and OpenPIC interrupts start at 16.
7345 -                *  Hence we have to fixup the interrupt numbers for sources
7346 -                *  that are attached to the OpenPIC and thus have an
7347 -                *  interrupt-controller named `open-pic'.
7348 -                *
7349 -                *  FIXME: The name of the interrupt-controller node for the
7350 -                *         `ide' node has no name, although its parent is
7351 -                *         correctly specified in interrupt-map, so we check
7352 -                *         for a NULL name as well.
7353 -                */
7354 -               if (_machine == _MACH_chrp &&
7355 -                   ((node->name && !strcmp(node->name, "open-pic")) ||
7356 -                    !node->name)) {
7357 -                   for (i = 0; i < np->n_intrs; ++i)
7358 -                       np->intrs[i].line = np->intrs[i].line + NUM_8259_INTERRUPTS;
7359 -               }
7360 -               return mem_start;
7361 -           }
7362 -           /* We lookup for an interrupt-map. This code can only handle one interrupt
7363 -            * per device in the map. We also don't handle #address-cells in the parent
7364 -            * I skip the pci node itself here, may not be necessary but I don't like it's
7365 -            * reg property.
7366 -            */
7367 -           if (np != node)
7368 -               map = (unsigned int *)get_property(node, "interrupt-map", &l);
7369 -            else
7370 -               map = NULL;
7371 -           if (map && l) {
7372 -               int i, found, temp_isize;
7373 -               map_size = l>>2;
7374 -               map_mask = (unsigned int *)get_property(node, "interrupt-map-mask", &l);
7375 -               asizep = (unsigned int *)get_property(node, "#address-cells", &l);
7376 -               if (asizep && l == sizeof(unsigned int))
7377 -                   asize = *asizep;
7378 -               else
7379 -                   asize = 0;
7380 -               found = 0;
7381 -               while(map_size>0 && !found) {
7382 -                   found = 1;
7383 -                   for (i=0; i<asize; i++) {
7384 -                       unsigned int mask = map_mask ? map_mask[i] : 0xffffffff;
7385 -                       if (!reg || (i>=regpsize) || ((mask & *map) != (mask & reg[i])))
7386 -                           found = 0;
7387 -                       map++;
7388 -                       map_size--;
7389 -                   }
7390 -                   for (i=0; i<isize; i++) {
7391 -                       unsigned int mask = map_mask ? map_mask[i+asize] : 0xffffffff;
7392 -                       if ((mask & *map) != (mask & interrupts[i]))
7393 -                           found = 0;
7394 -                       map++;
7395 -                       map_size--;
7396 -                   }
7397 -                   parent = *((phandle *)(map));
7398 -                   map+=1; map_size-=1;
7399 -                   parent_node = find_phandle(parent);
7400 -                   temp_isize = isize;
7401 -                   if (parent_node) {
7402 -                       isizep = (unsigned int *)get_property(parent_node, "#interrupt-cells", &l);
7403 -                       if (isizep)
7404 -                           temp_isize = *isizep;
7405 -                   }
7406 -                   if (!found) {
7407 -                       map += temp_isize;
7408 -                       map_size-=temp_isize;
7409 -                   }
7410 -               }
7411 -               if (found) {
7412 -                   node = parent_node;
7413 -                   reg = NULL;
7414 -                   regpsize = 0;
7415 -                   interrupts = (unsigned int *)map;
7416 -                   ipsize = temp_isize*1;
7417 -                   continue;
7418 -               }
7419 -           }
7420 -           /* We look for an explicit interrupt-parent.
7421 -            */
7422 -           parent = (phandle *)get_property(node, "interrupt-parent", &l);
7423 -           if (parent && (l == sizeof(phandle)) &&
7424 -               (parent_node = find_phandle(*parent))) {
7425 -               node = parent_node;
7426 -               continue;
7427 -           }
7428 -           /* Default, get real parent */
7429 -           node = node->parent;
7430 -       } while(node);
7431 -
7432 -       return mem_start;
7433 -}
7434 -
7435  /*
7436   * When BootX makes a copy of the device tree from the MacOS
7437   * Name Registry, it is in the format we use but all of the pointers
7438 @@ -1410,9 +960,6 @@
7439                 mem_start += i * sizeof(struct address_range);
7440         }
7441  
7442 -       if (use_of_interrupt_tree)
7443 -               return mem_start;
7444 -
7445         /*
7446          * If the pci host bridge has an interrupt-map property,
7447          * look for our node in it.
7448 @@ -1422,28 +969,14 @@
7449                 get_property(np->parent, "interrupt-map", &ml)) != 0
7450             && (ip = (int *) get_property(np, "interrupts", &l)) != 0) {
7451                 unsigned int devfn = pci_addrs[0].addr.a_hi & 0xff00;
7452 -               unsigned int cell_size;
7453 -               struct device_node* np2;
7454 -               /* This is hackish, but is only used for BootX booting */
7455 -               cell_size = sizeof(struct pci_intr_map);
7456 -               np2 = np->parent;
7457 -               while(np2) {
7458 -                       if (device_is_compatible(np2, "uni-north")) {
7459 -                               cell_size += 4;
7460 -                               break;
7461 -                       }
7462 -                       np2 = np2->parent;
7463 -               }
7464                 np->n_intrs = 0;
7465                 np->intrs = (struct interrupt_info *) mem_start;
7466 -               for (i = 0; (ml -= cell_size) >= 0; ++i) {
7467 -                       if (imp->addr.a_hi == devfn) {
7468 -                               np->intrs[np->n_intrs].line = imp->intr;
7469 -                               np->intrs[np->n_intrs].sense = 0; /* FIXME */
7470 +               for (i = 0; (ml -= sizeof(struct pci_intr_map)) >= 0; ++i) {
7471 +                       if (imp[i].addr.a_hi == devfn) {
7472 +                               np->intrs[np->n_intrs].line = imp[i].intr;
7473 +                               np->intrs[np->n_intrs].sense = 0;
7474                                 ++np->n_intrs;
7475                         }
7476 -                       imp = (struct pci_intr_map *)(((unsigned int)imp)
7477 -                               + cell_size);
7478                 }
7479                 if (np->n_intrs == 0)
7480                         np->intrs = 0;
7481 @@ -1500,9 +1033,6 @@
7482                 mem_start += i * sizeof(struct address_range);
7483         }
7484  
7485 -       if (use_of_interrupt_tree)
7486 -               return mem_start;
7487 -
7488         ip = (int *) get_property(np, "AAPL,interrupts", &l);
7489         if (ip == 0)
7490                 ip = (int *) get_property(np, "interrupts", &l);
7491 @@ -1526,14 +1056,13 @@
7492         struct reg_property *rp;
7493         struct address_range *adr;
7494         unsigned long base_address;
7495 -       int i, l, keylargo, *ip;
7496 +       int i, l, *ip;
7497         struct device_node *db;
7498  
7499         base_address = 0;
7500         for (db = np->parent; db != NULL; db = db->parent) {
7501                 if (!strcmp(db->type, "mac-io") && db->n_addrs != 0) {
7502                         base_address = db->addrs[0].address;
7503 -                       keylargo = device_is_compatible(db, "Keylargo");
7504                         break;
7505                 }
7506         }
7507 @@ -1553,9 +1082,6 @@
7508                 mem_start += i * sizeof(struct address_range);
7509         }
7510  
7511 -       if (use_of_interrupt_tree)
7512 -               return mem_start;
7513 -
7514         ip = (int *) get_property(np, "interrupts", &l);
7515         if (ip == 0)
7516                 ip = (int *) get_property(np, "AAPL,interrupts", &l);
7517 @@ -1564,21 +1090,15 @@
7518                 if (_machine == _MACH_Pmac) {
7519                         /* for the iMac */
7520                         np->n_intrs = l / sizeof(int);
7521 -                       /* Hack for BootX on Core99 */
7522 -                       if (keylargo)
7523 -                               np->n_intrs = np->n_intrs/2;
7524                         for (i = 0; i < np->n_intrs; ++i) {
7525                                 np->intrs[i].line = *ip++;
7526 -                               if (keylargo)
7527 -                                       np->intrs[i].sense = *ip++;
7528 -                               else
7529 -                                       np->intrs[i].sense = 0;
7530 +                               np->intrs[i].sense = 0;
7531                         }
7532                 } else {
7533                         /* CHRP machines */
7534                         np->n_intrs = l / (2 * sizeof(int));
7535                         for (i = 0; i < np->n_intrs; ++i) {
7536 -                               np->intrs[i].line = (*ip++) + NUM_8259_INTERRUPTS;
7537 +                               np->intrs[i].line = openpic_to_irq(*ip++);
7538                                 np->intrs[i].sense = *ip++;
7539                         }
7540                 }
7541 @@ -1612,9 +1132,6 @@
7542                 mem_start += i * sizeof(struct address_range);
7543         }
7544  
7545 -       if (use_of_interrupt_tree)
7546 -               return mem_start;
7547
7548         ip = (int *) get_property(np, "interrupts", &l);
7549         if (ip != 0) {
7550                 np->intrs = (struct interrupt_info *) mem_start;
7551 @@ -1652,9 +1169,6 @@
7552                 mem_start += i * sizeof(struct address_range);
7553         }
7554  
7555 -       if (use_of_interrupt_tree)
7556 -               return mem_start;
7557 -
7558         ip = (int *) get_property(np, "AAPL,interrupts", &l);
7559         if (ip == 0)
7560                 ip = (int *) get_property(np, "interrupts", &l);
7561 @@ -1711,57 +1225,6 @@
7562         return head;
7563  }
7564  
7565 -/* Finds a device node given its PCI bus number, device number
7566 - * and function number
7567 - */
7568 -__openfirmware
7569 -struct device_node *
7570 -find_pci_device_OFnode(unsigned char bus, unsigned char dev_fn)
7571 -{
7572 -       struct device_node* np;
7573 -       unsigned int *reg;
7574 -       int l;
7575 -       
7576 -       for (np = allnodes; np != 0; np = np->allnext) {
7577 -               int in_macio = 0;
7578 -               struct device_node* parent = np->parent;
7579 -               while(parent) {
7580 -                       char *pname = (char *)get_property(parent, "name", &l);
7581 -                       if (pname && strcmp(pname, "mac-io") == 0) {
7582 -                               in_macio = 1;
7583 -                               break;
7584 -                       }
7585 -                       parent = parent->parent;
7586 -               }
7587 -               if (in_macio)
7588 -                       continue;
7589 -               reg = (unsigned int *) get_property(np, "reg", &l);
7590 -               if (reg == 0 || l < sizeof(struct reg_property))
7591 -                       continue;
7592 -               if (((reg[0] >> 8) & 0xff) == dev_fn && ((reg[0] >> 16) & 0xff) == bus)
7593 -                       break;
7594 -       }
7595 -       return np;
7596 -}
7597 -
7598 -/*
7599 - * Returns all nodes linked together
7600 - */
7601 -__openfirmware
7602 -struct device_node *
7603 -find_all_nodes(void)
7604 -{
7605 -       struct device_node *head, **prevp, *np;
7606 -
7607 -       prevp = &head;
7608 -       for (np = allnodes; np != 0; np = np->allnext) {
7609 -               *prevp = np;
7610 -               prevp = &np->next;
7611 -       }
7612 -       *prevp = 0;
7613 -       return head;
7614 -}
7615 -
7616  /* Checks if the given "compat" string matches one of the strings in
7617   * the device's "compatible" property
7618   */
7619 @@ -1851,7 +1314,7 @@
7620         struct property *pp;
7621  
7622         for (pp = np->properties; pp != 0; pp = pp->next)
7623 -               if (pp->name && strcmp(pp->name, name) == 0) {
7624 +               if (strcmp(pp->name, name) == 0) {
7625                         if (lenp != 0)
7626                                 *lenp = pp->length;
7627                         return pp->value;
7628 @@ -1963,63 +1426,18 @@
7629         prom_exit();
7630  }
7631  
7632 -/* Indicates whether the root node has a given value in its
7633 - * compatible property.
7634 - */
7635 -__openfirmware
7636 -int
7637 -machine_is_compatible(const char *compat)
7638 -{
7639 -       struct device_node *root;
7640 -       
7641 -       root = find_path_device("/");
7642 -       if (root == 0)
7643 -               return 0;
7644 -       return device_is_compatible(root, compat);
7645 -}
7646 -
7647 -
7648 -#ifdef CONFIG_BOOTX_TEXT
7649 -
7650 -/* Here's a small text engine to use during early boot or for debugging purposes
7651 - * 
7652 - * todo:
7653 - * 
7654 - *  - build some kind of vgacon with it to enable early printk
7655 - *  - move to a separate file
7656 - *  - add a few video driver hooks to keep in sync with display
7657 - *    changes.
7658 - */
7659 -
7660 +#ifdef CONFIG_XMON
7661  __init
7662  void
7663  map_bootx_text(void)
7664  {
7665 -       unsigned long base, offset, size;
7666 -       if (disp_bi == 0)
7667 +       if (boot_infos == 0)
7668                 return;
7669 -       base = ((unsigned long) disp_bi->dispDeviceBase) & 0xFFFFF000UL;
7670 -       offset = ((unsigned long) disp_bi->dispDeviceBase) - base;
7671 -       size = disp_bi->dispDeviceRowBytes * disp_bi->dispDeviceRect[3] + offset
7672 -               + disp_bi->dispDeviceRect[0];
7673 -       disp_bi->logicalDisplayBase = ioremap(base, size) + offset;
7674 -}
7675 -
7676 -__init
7677 -void
7678 -install_boot_console(void)
7679 -{
7680 -       register_console(&boot_cons);
7681 -       boot_cons_registered = 1;
7682 -}
7683 -
7684 -void
7685 -remove_boot_console(void)
7686 -{
7687 -       if (boot_cons_registered)
7688 -               unregister_console(&boot_cons);
7689 -       boot_cons_registered = 0;
7690 +       boot_infos->logicalDisplayBase =
7691 +               ioremap((unsigned long) boot_infos->dispDeviceBase,
7692 +                       boot_infos->dispDeviceRowBytes * boot_infos->dispDeviceRect[3]);
7693  }
7694 +#endif /* CONFIG_XMON */
7695  
7696  /* Calc the base address of a given point (x,y) */
7697  __pmac
7698 @@ -2041,7 +1459,7 @@
7699  clearscreen(void)
7700  {
7701         unsigned long offset    = reloc_offset();
7702 -       boot_infos_t* bi        = PTRRELOC(RELOC(disp_bi));
7703 +       boot_infos_t* bi        = PTRRELOC(RELOC(boot_infos));
7704         unsigned long *base     = (unsigned long *)calc_base(bi, 0, 0);
7705         unsigned long width     = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
7706                                         (bi->dispDeviceDepth >> 3)) >> 2;
7707 @@ -2066,7 +1484,7 @@
7708  flushscreen(void)
7709  {
7710         unsigned long offset    = reloc_offset();
7711 -       boot_infos_t* bi        = PTRRELOC(RELOC(disp_bi));
7712 +       boot_infos_t* bi        = PTRRELOC(RELOC(boot_infos));
7713         unsigned long *base     = (unsigned long *)calc_base(bi, 0, 0);
7714         unsigned long width     = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
7715                                         (bi->dispDeviceDepth >> 3)) >> 2;
7716 @@ -2083,22 +1501,68 @@
7717         }
7718  }
7719  
7720 +/* Indicates whether the root node has a given value in its
7721 + * compatible property.
7722 + */
7723 +__openfirmware
7724 +int
7725 +machine_is_compatible(const char *compat)
7726 +{
7727 +       struct device_node *root;
7728 +       
7729 +       root = find_path_device("/");
7730 +       if (root == 0)
7731 +               return 0;
7732 +       return device_is_compatible(root, compat);
7733 +}
7734 +
7735 +/* Finds a device node given its PCI bus number, device number
7736 + * and function number
7737 + */
7738 +__openfirmware
7739 +struct device_node *
7740 +find_pci_device_OFnode(unsigned char bus, unsigned char dev_fn)
7741 +{
7742 +       struct device_node* np;
7743 +       unsigned int *reg;
7744 +       int l;
7745 +       
7746 +       for (np = allnodes; np != 0; np = np->allnext) {
7747 +               int in_macio = 0;
7748 +               struct device_node* parent = np->parent;
7749 +               while(parent) {
7750 +                       char *pname = (char *)get_property(parent, "name", &l);
7751 +                       if (pname && strcmp(pname, "mac-io") == 0) {
7752 +                               in_macio = 1;
7753 +                               break;
7754 +                       }
7755 +                       parent = parent->parent;
7756 +               }
7757 +               if (in_macio)
7758 +                       continue;
7759 +               reg = (unsigned int *) get_property(np, "reg", &l);
7760 +               if (reg == 0 || l < sizeof(struct reg_property))
7761 +                       continue;
7762 +               if (((reg[0] >> 8) & 0xff) == dev_fn && ((reg[0] >> 16) & 0xff) == bus)
7763 +                       break;
7764 +       }
7765 +       return np;
7766 +}
7767 +
7768 +#ifdef CONFIG_BOOTX_TEXT
7769 +
7770  __pmac
7771  static void
7772  scrollscreen(void)
7773  {
7774         unsigned long offset            = reloc_offset();
7775 -       boot_infos_t* bi                = PTRRELOC(RELOC(disp_bi));
7776 +       boot_infos_t* bi                = PTRRELOC(RELOC(boot_infos));
7777         unsigned long *src              = (unsigned long *)calc_base(bi,0,16);
7778         unsigned long *dst              = (unsigned long *)calc_base(bi,0,0);
7779         unsigned long width             = ((bi->dispDeviceRect[2] - bi->dispDeviceRect[0]) *
7780                                                 (bi->dispDeviceDepth >> 3)) >> 2;
7781         int i,j;
7782 -
7783 -#ifdef CONFIG_POWERMAC
7784 -       pmu_suspend();
7785 -#endif
7786 -
7787 +       
7788         for (i=0; i<(bi->dispDeviceRect[3] - bi->dispDeviceRect[1] - 16); i++)
7789         {
7790                 unsigned long *src_ptr = src;
7791 @@ -2115,10 +1579,6 @@
7792                         *(dst_ptr++) = 0;
7793                 dst += (bi->dispDeviceRowBytes >> 2);
7794         }
7795 -
7796 -#ifdef CONFIG_POWERMAC
7797 -       pmu_resume();
7798 -#endif
7799  }
7800  
7801  __pmac
7802 @@ -2163,18 +1623,8 @@
7803                 drawchar(*c++);
7804  }
7805  
7806 -#ifdef CONFIG_BOOTX_TEXT
7807 -__pmac
7808 -static void boot_console_write(struct console *co, const char *s,
7809 -                                unsigned count)
7810 -{
7811 -       while(count--)
7812 -               drawchar(*s++);
7813 -}
7814 -#endif
7815 -
7816  __pmac
7817 -void
7818 +static void
7819  drawhex(unsigned long v)
7820  {
7821         static char hex_table[] = "0123456789abcdef";
7822 @@ -2196,20 +1646,19 @@
7823  draw_byte(unsigned char c, long locX, long locY)
7824  {
7825         unsigned long offset    = reloc_offset();
7826 -       boot_infos_t* bi        = PTRRELOC(RELOC(disp_bi));
7827 +       boot_infos_t* bi        = PTRRELOC(RELOC(boot_infos));
7828         unsigned char *base     = calc_base(bi, locX << 3, locY << 4);
7829         unsigned char *font     = &RELOC(vga_font)[((unsigned long)c) * 16];
7830 -       int rb                  = bi->dispDeviceRowBytes;
7831         
7832         switch(bi->dispDeviceDepth) {
7833                 case 32:
7834 -                       draw_byte_32(font, (unsigned long *)base, rb);
7835 +                       draw_byte_32(font, (unsigned long *)base);
7836                         break;
7837                 case 16:
7838 -                       draw_byte_16(font, (unsigned long *)base, rb);
7839 +                       draw_byte_16(font, (unsigned long *)base);
7840                         break;
7841                 case 8:
7842 -                       draw_byte_8(font, (unsigned long *)base, rb);
7843 +                       draw_byte_8(font, (unsigned long *)base);
7844                         break;
7845                 default:
7846                         break;
7847 @@ -2247,8 +1696,10 @@
7848  
7849  __pmac
7850  static void
7851 -draw_byte_32(unsigned char *font, unsigned long *base, int rb)
7852 +draw_byte_32(unsigned char *font, unsigned long *base)
7853  {
7854 +       unsigned long offset = reloc_offset();
7855 +       boot_infos_t* bi                = PTRRELOC(RELOC(boot_infos));
7856         int l, bits;    
7857         int fg = 0xFFFFFFFFUL;
7858         int bg = 0x00000000UL;
7859 @@ -2265,18 +1716,19 @@
7860                 base[5] = (-((bits >> 2) & 1) & fg) ^ bg;
7861                 base[6] = (-((bits >> 1) & 1) & fg) ^ bg;
7862                 base[7] = (-(bits & 1) & fg) ^ bg;
7863 -               base = (unsigned long *) ((char *)base + rb);
7864 +               base = (unsigned long *) ((char *)base + bi->dispDeviceRowBytes);
7865         }
7866  }
7867  
7868  __pmac
7869  static void
7870 -draw_byte_16(unsigned char *font, unsigned long *base, int rb)
7871 +draw_byte_16(unsigned char *font, unsigned long *base)
7872  {
7873 +       unsigned long offset = reloc_offset();
7874 +       boot_infos_t* bi                = PTRRELOC(RELOC(boot_infos));
7875         int l, bits;    
7876         int fg = 0xFFFFFFFFUL;
7877         int bg = 0x00000000UL;
7878 -       unsigned long offset = reloc_offset();
7879         unsigned long *eb = RELOC(expand_bits_16);
7880  
7881         for (l = 0; l < 16; ++l)
7882 @@ -2286,18 +1738,19 @@
7883                 base[1] = (eb[(bits >> 4) & 3] & fg) ^ bg;
7884                 base[2] = (eb[(bits >> 2) & 3] & fg) ^ bg;
7885                 base[3] = (eb[bits & 3] & fg) ^ bg;
7886 -               base = (unsigned long *) ((char *)base + rb);
7887 +               base = (unsigned long *) ((char *)base + bi->dispDeviceRowBytes);
7888         }
7889  }
7890  
7891  __pmac
7892  static void
7893 -draw_byte_8(unsigned char *font, unsigned long *base, int rb)
7894 +draw_byte_8(unsigned char *font, unsigned long *base)
7895  {
7896 +       unsigned long offset = reloc_offset();
7897 +       boot_infos_t* bi                = PTRRELOC(RELOC(boot_infos));
7898         int l, bits;    
7899         int fg = 0x0F0F0F0FUL;
7900         int bg = 0x00000000UL;
7901 -       unsigned long offset = reloc_offset();
7902         unsigned long *eb = RELOC(expand_bits_8);
7903  
7904         for (l = 0; l < 16; ++l)
7905 @@ -2305,7 +1758,7 @@
7906                 bits = *font++;
7907                 base[0] = (eb[bits >> 4] & fg) ^ bg;
7908                 base[1] = (eb[bits & 0xf] & fg) ^ bg;
7909 -               base = (unsigned long *) ((char *)base + rb);
7910 +               base = (unsigned long *) ((char *)base + bi->dispDeviceRowBytes);
7911         }
7912  }
7913  
7914 diff -urN linux.orig/arch/ppc/kernel/ptrace.c linux/arch/ppc/kernel/ptrace.c
7915 --- linux.orig/arch/ppc/kernel/ptrace.c Fri Nov  2 17:39:05 2001
7916 +++ linux/arch/ppc/kernel/ptrace.c      Thu Jul 11 15:43:29 2002
7917 @@ -29,6 +29,7 @@
7918  #include <asm/uaccess.h>
7919  #include <asm/page.h>
7920  #include <asm/pgtable.h>
7921 +#include <asm/pf-compat.h>
7922  #include <asm/system.h>
7923  
7924  /*
7925 @@ -341,10 +342,10 @@
7926         lock_kernel();
7927         if (request == PTRACE_TRACEME) {
7928                 /* are we already being traced? */
7929 -               if (current->ptrace & PT_PTRACED)
7930 +               if (current->flags & PF_PTRACED)
7931                         goto out;
7932                 /* set the ptrace bit in the process flags. */
7933 -               current->ptrace |= PT_PTRACED;
7934 +               current->flags |= PF_PTRACED;
7935                 ret = 0;
7936                 goto out;
7937         }
7938 @@ -370,9 +371,9 @@
7939                     (current->gid != child->gid)) && !capable(CAP_SYS_PTRACE))
7940                         goto out;
7941                 /* the same process cannot be attached many times */
7942 -               if (child->ptrace & PT_PTRACED)
7943 +               if (child->flags & PF_PTRACED)
7944                         goto out;
7945 -               child->ptrace |= PT_PTRACED;
7946 +               child->flags |= PF_PTRACED;
7947  
7948                 write_lock_irqsave(&tasklist_lock, flags);
7949                 if (child->p_pptr != current) {
7950 @@ -387,7 +388,7 @@
7951                 goto out;
7952         }
7953         ret = -ESRCH;
7954 -       if (!(child->ptrace & PT_PTRACED))
7955 +       if (!(child->flags & PF_PTRACED))
7956                 goto out;
7957         if (child->state != TASK_STOPPED) {
7958                 if (request != PTRACE_KILL)
7959 @@ -472,9 +473,9 @@
7960                         if ((unsigned long) data > _NSIG)
7961                                 goto out;
7962                         if (request == PTRACE_SYSCALL)
7963 -                               child->ptrace |= PT_TRACESYS;
7964 +                               child->flags |= PF_TRACESYS;
7965                         else
7966 -                               child->ptrace &= ~PT_TRACESYS;
7967 +                               child->flags &= ~PF_TRACESYS;
7968                         child->exit_code = data;
7969                         /* make sure the single step bit is not set. */
7970                         clear_single_step(child);
7971 @@ -503,7 +504,7 @@
7972                         ret = -EIO;
7973                         if ((unsigned long) data > _NSIG)
7974                                 goto out;
7975 -                       child->ptrace &= ~PT_TRACESYS;
7976 +                       child->flags &= ~PF_TRACESYS;
7977                         set_single_step(child);
7978                         child->exit_code = data;
7979                         /* give it a chance to run. */
7980 @@ -516,7 +517,7 @@
7981                         ret = -EIO;
7982                         if ((unsigned long) data > _NSIG)
7983                                 goto out;
7984 -                       child->ptrace &= ~(PT_PTRACED|PT_TRACESYS);
7985 +                       child->flags &= ~(PF_PTRACED|PF_TRACESYS);
7986                         child->exit_code = data;
7987                         write_lock_irqsave(&tasklist_lock, flags);
7988                         REMOVE_LINKS(child);
7989 @@ -541,8 +542,8 @@
7990  
7991  asmlinkage void syscall_trace(void)
7992  {
7993 -       if ((current->ptrace & (PT_PTRACED|PT_TRACESYS))
7994 -                       != (PT_PTRACED|PT_TRACESYS))
7995 +       if ((current->flags & (PF_PTRACED|PF_TRACESYS))
7996 +                       != (PF_PTRACED|PF_TRACESYS))
7997                 return;
7998         current->exit_code = SIGTRAP;
7999         current->state = TASK_STOPPED;
8000 diff -urN linux.orig/arch/ppc/kernel/setup.c linux/arch/ppc/kernel/setup.c
8001 --- linux.orig/arch/ppc/kernel/setup.c  Sun Mar 25 18:31:49 2001
8002 +++ linux/arch/ppc/kernel/setup.c       Thu Jul 11 15:47:12 2002
8003 @@ -31,7 +31,6 @@
8004  #endif
8005  #include <asm/bootx.h>
8006  #include <asm/machdep.h>
8007 -#include <asm/uaccess.h>
8008  
8009  extern void pmac_init(unsigned long r3,
8010                        unsigned long r4,
8011 @@ -69,10 +68,6 @@
8012                        unsigned long r6,
8013                        unsigned long r7);
8014  
8015 -#ifdef CONFIG_XMON
8016 -extern void xmon_map_scc(void);
8017 -#endif
8018 -
8019  extern boot_infos_t *boot_infos;
8020  extern char cmd_line[512];
8021  char saved_command_line[256];
8022 @@ -80,6 +75,10 @@
8023  
8024  struct ide_machdep_calls ppc_ide_md;
8025  
8026 +#ifdef CONFIG_MAGIC_SYSRQ
8027 +unsigned long SYSRQ_KEY;
8028 +#endif /* CONFIG_MAGIC_SYSRQ */
8029 +
8030  unsigned long ISA_DMA_THRESHOLD;
8031  unsigned long DMA_MODE_READ, DMA_MODE_WRITE;
8032  
8033 @@ -96,12 +95,6 @@
8034  
8035  struct machdep_calls ppc_md;
8036  
8037 -#ifdef CONFIG_MAGIC_SYSRQ
8038 -unsigned long SYSRQ_KEY;
8039 -#endif /* CONFIG_MAGIC_SYSRQ */
8040 -#ifdef CONFIG_VGA_CONSOLE
8041 -unsigned long vgacon_remap_base;
8042 -#endif
8043  
8044  /* copy of the residual data */
8045  #ifndef CONFIG_MBX
8046 @@ -267,9 +260,6 @@
8047                 case 10:
8048                         len += sprintf(len+buffer, "604ev5 (MachV)\n");
8049                         break;
8050 -               case 12:
8051 -                       len += sprintf(len+buffer, "7400 (G4)\n");
8052 -                       break;
8053                 case 50:
8054                         len += sprintf(len+buffer, "821\n");
8055                 case 80:
8056 @@ -322,6 +312,14 @@
8057                 bogosum += CD(loops_per_jiffy);
8058         }
8059  
8060 +#ifdef __SMP__
8061 +       if ( i )
8062 +               len += sprintf(buffer+len, "\n");
8063 +       len += sprintf(buffer+len,"total bogomips\t: %lu.%02lu\n",
8064 +                      (bogosum+2500)/500000,
8065 +                      (bogosum+2500)/5000 % 100);
8066 +#endif /* __SMP__ */
8067 +
8068         /*
8069          * Ooh's and aah's info about zero'd pages in idle task
8070          */ 
8071 @@ -486,21 +484,15 @@
8072  
8073         switch (_machine)
8074         {
8075 -#ifdef CONFIG_POWERMAC
8076         case _MACH_Pmac:
8077                  pmac_init(r3, r4, r5, r6, r7);
8078                 break;
8079 -#endif
8080 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_PREP)
8081         case _MACH_prep:
8082                  prep_init(r3, r4, r5, r6, r7);
8083                 break;
8084 -#endif
8085 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_CHRP)
8086         case _MACH_chrp:
8087                  chrp_init(r3, r4, r5, r6, r7);
8088                 break;
8089 -#endif
8090  #ifdef CONFIG_APUS
8091         case _MACH_apus:
8092                  apus_init(r3, r4, r5, r6, r7);
8093 @@ -554,13 +546,12 @@
8094  /* Checks "l2cr=xxxx" command-line option */
8095  void ppc_setup_l2cr(char *str, int *ints)
8096  {
8097 -       if ( ((_get_PVR() >> 16) == 8) || ((_get_PVR() >> 16) == 12) )
8098 +       if ( (_get_PVR() >> 16) == 8)
8099         {
8100                 unsigned long val = simple_strtoul(str, NULL, 0);
8101                 printk(KERN_INFO "l2cr set to %lx\n", val);
8102                 _set_L2CR(0);
8103 -               if (val)
8104 -                       _set_L2CR(val);
8105 +               _set_L2CR(val);
8106         }
8107  }
8108  
8109 @@ -581,16 +572,14 @@
8110         extern unsigned long find_available_memory(void);
8111         extern unsigned long *end_of_DRAM;
8112  
8113 -
8114  #ifdef CONFIG_XMON
8115 -       {
8116 -               char *p;
8117 +       extern void xmon_map_scc(void);
8118 +       char *p;
8119  
8120 -               xmon_map_scc();
8121 -               p = strstr(cmd_line, "xmon");
8122 -               if (p != NULL && (p == cmd_line || p[-1] == ' '))
8123 -                       xmon(0);
8124 -       }
8125 +       xmon_map_scc();
8126 +       p = strstr(cmd_line, "xmon");
8127 +       if (p != NULL && (p == cmd_line || p[-1] == ' '))
8128 +               xmon(0);
8129  #endif /* CONFIG_XMON */
8130   
8131         /* reboot on panic */   
8132 @@ -610,15 +599,7 @@
8133         *memory_end_p = (unsigned long) end_of_DRAM;
8134  
8135         ppc_md.setup_arch(memory_start_p, memory_end_p);
8136 -
8137 -       sort_exception_table();
8138 -}
8139 -
8140 -#ifndef CONFIG_POWERMAC
8141 -void note_bootable_part(kdev_t dev, int part, int goodness)
8142 -{
8143  }
8144 -#endif
8145  
8146  void ppc_generic_ide_fix_driveid(struct hd_driveid *id)
8147  {
8148 diff -urN linux.orig/arch/ppc/kernel/signal.c linux/arch/ppc/kernel/signal.c
8149 --- linux.orig/arch/ppc/kernel/signal.c Fri Nov  2 17:39:05 2001
8150 +++ linux/arch/ppc/kernel/signal.c      Thu Jul 11 15:43:29 2002
8151 @@ -14,16 +14,6 @@
8152   *  modify it under the terms of the GNU General Public License
8153   *  as published by the Free Software Foundation; either version
8154   *  2 of the License, or (at your option) any later version.
8155 - *
8156 - *
8157 - * 2000-04-7.
8158 - * Define a real-time signal frame with siginfo and ucontext
8159 - * structures (setup_rt_frame()).
8160 - * Stuck up a real-time signal frame when setting the signal
8161 - * frame with SA_SIGINFO flags.
8162 - * Add sys_rt_sigreturn() to undo the signal stack.
8163 - *
8164 - * Giovanna Ambrosini (ambrosini@lightning.ch)
8165   */
8166  
8167  #include <linux/sched.h>
8168 @@ -41,6 +31,7 @@
8169  #include <asm/ucontext.h>
8170  #include <asm/uaccess.h>
8171  #include <asm/pgtable.h>
8172 +#include <asm/pf-compat.h>
8173  
8174  #define DEBUG_SIG 0
8175  
8176 @@ -131,6 +122,13 @@
8177  }
8178  
8179  
8180 +asmlinkage int sys_rt_sigreturn(unsigned long __unused)
8181 +{
8182 +       printk("sys_rt_sigreturn(): %s/%d not yet implemented.\n",
8183 +              current->comm,current->pid);
8184 +       do_exit(SIGSEGV);
8185 +}
8186 +
8187  asmlinkage int
8188  sys_sigaltstack(const stack_t *uss, stack_t *uoss)
8189  {
8190 @@ -174,11 +172,13 @@
8191   * When we have signals to deliver, we set up on the
8192   * user stack, going down from the original stack pointer:
8193   *     a sigregs struct
8194 - * one or more sigcontext structs with
8195 + *     one or more sigcontext structs
8196   *     a gap of __SIGNAL_FRAMESIZE bytes
8197   *
8198   * Each of these things must be a multiple of 16 bytes in size.
8199   *
8200 + * XXX ultimately we will have to stack up a siginfo and ucontext
8201 + * for each rt signal.
8202   */
8203  struct sigregs {
8204         elf_gregset_t   gp_regs;
8205 @@ -189,15 +189,6 @@
8206         int             abigap[56];
8207  };
8208  
8209 -struct rt_sigframe
8210 -{
8211 - unsigned long _unused[2];
8212 - struct siginfo *pinfo;
8213 - void *puc;
8214 - struct siginfo info;
8215 - struct ucontext uc;
8216 -};
8217 -
8218  /*
8219   * Do a signal return; undo the signal stack.
8220   */
8221 @@ -230,10 +221,6 @@
8222                 sr = (struct sigregs *) sigctx.regs;
8223                 if (regs->msr & MSR_FP )
8224                         giveup_fpu(current);
8225 -#ifdef CONFIG_ALTIVEC
8226 -               if (regs->msr & MSR_VEC)
8227 -                       giveup_altivec(current);
8228 -#endif /* CONFIG_ALTIVEC */
8229                 if (copy_from_user(saved_regs, &sr->gp_regs,
8230                                    sizeof(sr->gp_regs)))
8231                         goto badframe;
8232 @@ -269,91 +256,6 @@
8233         do_exit(SIGSEGV);
8234  }      
8235  
8236 -
8237 -/*
8238 - *  When we have rt signals to deliver, we set up on the
8239 - *  user stack, going down from the original stack pointer:
8240 - *    a sigregs struct
8241 - *    one rt_sigframe struct (siginfo + ucontext)
8242 - *    a gap of __SIGNAL_FRAMESIZE bytes
8243 - *
8244 - *  Each of these things must be a multiple of 16 bytes in size.
8245 - *
8246 - */
8247 -asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
8248 -{
8249 - struct rt_sigframe *rt_sf;
8250 - struct sigcontext_struct sigctx;
8251 - struct sigregs *sr;
8252 - int ret;
8253 - elf_gregset_t saved_regs;  /* an array of ELF_NGREG unsigned longs */
8254 - sigset_t set;
8255 - stack_t st;
8256 - unsigned long prevsp;
8257 -
8258 - rt_sf = (struct rt_sigframe *)(regs->gpr[1] + __SIGNAL_FRAMESIZE);
8259 - if (copy_from_user(&sigctx, &rt_sf->uc.uc_mcontext, sizeof(sigctx))
8260 -     || copy_from_user(&set, &rt_sf->uc.uc_sigmask, sizeof(set))
8261 -     || copy_from_user(&st, &rt_sf->uc.uc_stack, sizeof(st)))
8262 -  goto badframe;
8263 - sigdelsetmask(&set, ~_BLOCKABLE);
8264 - spin_lock_irq(&current->sigmask_lock);
8265 - current->blocked = set;
8266 - recalc_sigpending(current);
8267 - spin_unlock_irq(&current->sigmask_lock);
8268 -
8269 - rt_sf++;   /* Look at next rt_sigframe */
8270 - if (rt_sf == (struct rt_sigframe *)(sigctx.regs)) {
8271 -  /* Last stacked signal - restore registers -
8272 -   * sigctx is initialized to point to the
8273 -   * preamble frame (where registers are stored)
8274 -   * see handle_signal()
8275 -   */
8276 -  sr = (struct sigregs *) sigctx.regs;
8277 -  if (regs->msr & MSR_FP )
8278 -   giveup_fpu(current);
8279 -  if (copy_from_user(saved_regs, &sr->gp_regs,
8280 -       sizeof(sr->gp_regs)))
8281 -   goto badframe;
8282 -  saved_regs[PT_MSR] = (regs->msr & ~MSR_USERCHANGE)
8283 -   | (saved_regs[PT_MSR] & MSR_USERCHANGE);
8284 -  memcpy(regs, saved_regs, GP_REGS_SIZE);
8285 -  if (copy_from_user(current->tss.fpr, &sr->fp_regs,
8286 -       sizeof(sr->fp_regs)))
8287 -   goto badframe;
8288 -  /* This function sets back the stack flags into
8289 -     the current task structure.  */
8290 -  sys_sigaltstack(&st, NULL);
8291 -
8292 -  ret = regs->result;
8293 - } else {
8294 -  /* More signals to go */
8295 -  /* Set up registers for next signal handler */
8296 -  regs->gpr[1] = (unsigned long)rt_sf - __SIGNAL_FRAMESIZE;
8297 -  if (copy_from_user(&sigctx, &rt_sf->uc.uc_mcontext, sizeof(sigctx)))
8298 -   goto badframe;
8299 -  sr = (struct sigregs *) sigctx.regs;
8300 -  regs->gpr[3] = ret = sigctx.signal;
8301 -  /* Get the siginfo   */
8302 -  get_user(regs->gpr[4], (unsigned long *)&rt_sf->pinfo);
8303 -  /* Get the ucontext */
8304 -  get_user(regs->gpr[5], (unsigned long *)&rt_sf->puc);
8305 -  regs->gpr[6] = (unsigned long) rt_sf;
8306 -
8307 -  regs->link = (unsigned long) &sr->tramp;
8308 -  regs->nip = sigctx.handler;
8309 -  if (get_user(prevsp, &sr->gp_regs[PT_R1])
8310 -      || put_user(prevsp, (unsigned long *) regs->gpr[1]))
8311 -   goto badframe;
8312 - }
8313 - return ret;
8314 -
8315 -badframe:
8316 - lock_kernel();
8317 - do_exit(SIGSEGV);
8318 -}
8319 -
8320 -
8321  /*
8322   * Set up a signal frame.
8323   */
8324 @@ -367,10 +269,6 @@
8325                 goto badframe;
8326         if (regs->msr & MSR_FP)
8327                 giveup_fpu(current);
8328 -#ifdef CONFIG_ALTIVEC
8329 -       if (regs->msr & MSR_VEC)
8330 -               giveup_altivec(current);
8331 -#endif /* CONFIG_ALTIVEC */
8332         if (__copy_to_user(&frame->gp_regs, regs, GP_REGS_SIZE)
8333             || __copy_to_user(&frame->fp_regs, current->tss.fpr,
8334                               ELF_NFPREG * sizeof(double))
8335 @@ -400,57 +298,6 @@
8336         do_exit(SIGSEGV);
8337  }
8338  
8339 -
8340 -static void
8341 -setup_rt_frame(struct pt_regs *regs, struct sigregs *frame,
8342 -        signed long newsp)
8343 -{
8344 - struct rt_sigframe *rt_sf = (struct rt_sigframe *) newsp;
8345 -
8346 - /* Set up preamble frame */
8347 - if (verify_area(VERIFY_WRITE, frame, sizeof(*frame)))
8348 -  goto badframe;
8349 - if (regs->msr & MSR_FP)
8350 -  giveup_fpu(current);
8351 - if (__copy_to_user(&frame->gp_regs, regs, GP_REGS_SIZE)
8352 -     || __copy_to_user(&frame->fp_regs, current->tss.fpr,
8353 -         ELF_NFPREG * sizeof(double))
8354 - /* Set up to return from user space.
8355 -    It calls the sc exception at offset 0x9999
8356 -    for sys_rt_sigreturn().
8357 - */
8358 -     || __put_user(0x38006666UL, &frame->tramp[0]) /* li r0,0x6666 */
8359 -     || __put_user(0x44000002UL, &frame->tramp[1])) /* sc */
8360 -  goto badframe;
8361 - flush_icache_range((unsigned long) &frame->tramp[0],
8362 -      (unsigned long) &frame->tramp[2]);
8363 -
8364 - /* Retrieve rt_sigframe from stack and
8365 -    set up registers for signal handler
8366 - */
8367 - newsp -= __SIGNAL_FRAMESIZE;
8368 - if (put_user(regs->gpr[1], (unsigned long *)newsp)
8369 -     || get_user(regs->nip, &rt_sf->uc.uc_mcontext.handler)
8370 -     || get_user(regs->gpr[3], &rt_sf->uc.uc_mcontext.signal)
8371 -     || get_user(regs->gpr[4], (unsigned long *)&rt_sf->pinfo)
8372 -     || get_user(regs->gpr[5], (unsigned long *)&rt_sf->puc))
8373 -  goto badframe;
8374 -
8375 - regs->gpr[1] = newsp;
8376 - regs->gpr[6] = (unsigned long) rt_sf;
8377 - regs->link = (unsigned long) frame->tramp;
8378 -
8379 - return;
8380 -
8381 -badframe:
8382 -#if DEBUG_SIG
8383 - printk("badframe in setup_rt_frame, regs=%p frame=%p newsp=%lx\n",
8384 -        regs, frame, newsp);
8385 -#endif
8386 - lock_kernel();
8387 - do_exit(SIGSEGV);
8388 -}
8389 -
8390  /*
8391   * OK, we're invoking a handler
8392   */
8393 @@ -460,7 +307,6 @@
8394               unsigned long *newspp, unsigned long frame)
8395  {
8396         struct sigcontext_struct *sc;
8397 - struct rt_sigframe *rt_sf;
8398  
8399         if (regs->trap == 0x0C00 /* System Call! */
8400             && ((int)regs->result == -ERESTARTNOHAND ||
8401 @@ -468,47 +314,20 @@
8402                  !(ka->sa.sa_flags & SA_RESTART))))
8403                 regs->result = -EINTR;
8404  
8405 - /* Set up Signal Frame */
8406 - if (ka->sa.sa_flags & SA_SIGINFO) {
8407 -  /* Put a Real Time Context onto stack */
8408 -  *newspp -= sizeof(*rt_sf);
8409 -  rt_sf = (struct rt_sigframe *) *newspp;
8410 -  if (verify_area(VERIFY_WRITE, rt_sf, sizeof(*rt_sf)))
8411 -   goto badframe;
8412 -
8413 -  if (__put_user((unsigned long) ka->sa.sa_handler, &rt_sf->uc.uc_mcontext.handler)
8414 -      || __put_user(&rt_sf->info, &rt_sf->pinfo)
8415 -      || __put_user(&rt_sf->uc, &rt_sf->puc)
8416 -      /* Put the siginfo */
8417 -      || __copy_to_user(&rt_sf->info, info, sizeof(*info))
8418 -      /* Create the ucontext */
8419 -      || __put_user(0, &rt_sf->uc.uc_flags)
8420 -      || __put_user(0, &rt_sf->uc.uc_link)
8421 -      || __put_user(current->sas_ss_sp, &rt_sf->uc.uc_stack.ss_sp)
8422 -      || __put_user(sas_ss_flags(regs->gpr[1]),
8423 -      &rt_sf->uc.uc_stack.ss_flags)
8424 -      || __put_user(current->sas_ss_size, &rt_sf->uc.uc_stack.ss_size)
8425 -      || __copy_to_user(&rt_sf->uc.uc_sigmask, oldset, sizeof(*oldset))
8426 -      /* mcontext.regs points to preamble register frame */
8427 -      || __put_user((struct pt_regs *)frame, &rt_sf->uc.uc_mcontext.regs)
8428 -      || __put_user(sig, &rt_sf->uc.uc_mcontext.signal))
8429 -   goto badframe;
8430 - } else {
8431 -  /* Put another sigcontext on the stack */
8432 -  *newspp -= sizeof(*sc);
8433 -  sc = (struct sigcontext_struct *) *newspp;
8434 -  if (verify_area(VERIFY_WRITE, sc, sizeof(*sc)))
8435 -   goto badframe;
8436 +       /* Put another sigcontext on the stack */
8437 +       *newspp -= sizeof(*sc);
8438 +       sc = (struct sigcontext_struct *) *newspp;
8439 +       if (verify_area(VERIFY_WRITE, sc, sizeof(*sc)))
8440 +               goto badframe;
8441  
8442 -  if (__put_user((unsigned long) ka->sa.sa_handler, &sc->handler)
8443 -      || __put_user(oldset->sig[0], &sc->oldmask)
8444 +       if (__put_user((unsigned long) ka->sa.sa_handler, &sc->handler)
8445 +           || __put_user(oldset->sig[0], &sc->oldmask)
8446  #if _NSIG_WORDS > 1
8447 -      || __put_user(oldset->sig[1], &sc->_unused[3])
8448 +           || __put_user(oldset->sig[1], &sc->_unused[3])
8449  #endif
8450 -      || __put_user((struct pt_regs *)frame, &sc->regs)
8451 -      || __put_user(sig, &sc->signal))
8452 -   goto badframe;
8453 - }
8454 +           || __put_user((struct pt_regs *)frame, &sc->regs)
8455 +           || __put_user(sig, &sc->signal))
8456 +               goto badframe;
8457  
8458         if (ka->sa.sa_flags & SA_ONESHOT)
8459                 ka->sa.sa_handler = SIG_DFL;
8460 @@ -558,7 +377,7 @@
8461                 if (!signr)
8462                         break;
8463  
8464 -               if ((current->ptrace & PT_PTRACED) && signr != SIGKILL) {
8465 +               if ((current->flags & PF_PTRACED) && signr != SIGKILL) {
8466                         /* Let the debugger run.  */
8467                         current->exit_code = signr;
8468                         current->state = TASK_STOPPED;
8469 @@ -664,10 +483,7 @@
8470         if (newsp == frame)
8471                 return 0;               /* no signals delivered */
8472  
8473 - if (ka->sa.sa_flags & SA_SIGINFO)
8474 -  setup_rt_frame(regs, (struct sigregs *) frame, newsp);
8475 - else
8476 -  setup_frame(regs, (struct sigregs *) frame, newsp);
8477 +       setup_frame(regs, (struct sigregs *) frame, newsp);
8478         return 1;
8479  
8480  }
8481 diff -urN linux.orig/arch/ppc/kernel/sleep.S linux/arch/ppc/kernel/sleep.S
8482 --- linux.orig/arch/ppc/kernel/sleep.S  Sun Mar 25 18:37:30 2001
8483 +++ linux/arch/ppc/kernel/sleep.S       Thu Jul 11 15:43:29 2002
8484 @@ -1,6 +1,6 @@
8485  /*
8486   * This file contains sleep low-level functions for PowerBook G3.
8487 - *    Copyright (C) 1999 Benjamin Herrenschmidt (benh@kernel.crashing.org)
8488 + *    Copyright (C) 1999 Benjamin Herrenschmidt (bh40@calva.net)
8489   *    and Paul Mackerras (paulus@cs.anu.edu.au).
8490   *
8491   * This program is free software; you can redistribute it and/or
8492 @@ -113,8 +113,8 @@
8493         stw     r4,SL_HID0(r1)
8494  
8495         /* Set up stuff at address 0 */
8496 -       lis     r5,grackle_wake_up@ha
8497 -       addi    r5,r5,grackle_wake_up@l
8498 +       lis     r5,wake_up@ha
8499 +       addi    r5,r5,wake_up@l
8500         tophys(r5,r5)
8501         stw     r5,SL_PC(r1)
8502         lis     r4,KERNELBASE@h
8503 @@ -124,28 +124,22 @@
8504         addi    r6,r6,MAGIC@l
8505         stw     r5,0(r4)
8506         stw     r6,4(r4)
8507 -       /* Setup stuffs at 0x80-0x84 for Core99 */
8508 -       lis     r3,core99_wake_up@ha
8509 -       addi    r3,r3,core99_wake_up@l
8510 -       tophys(r3,r3)
8511 -       stw     r3,0x80(r4)
8512 -       stw     r5,0x84(r4)
8513  
8514  /*
8515 - * Flush the L1 data cache by reading the first 128kB of RAM
8516 + * Flush the L1 data cache by reading the first 64kB of RAM
8517   * and then flushing the same area with the dcbf instruction.
8518   * The L2 cache has already been disabled.
8519   */
8520 -       li      r4,0x1000       /* 128kB / 32B */
8521 +       li      r4,0x0800       /* 64kB / 32B */
8522         mtctr   r4
8523         lis     r4,KERNELBASE@h
8524  1:
8525         lwz     r0,0(r4)
8526 -       addi    r4,r4,0x0020    /* Go to start of next cache line */
8527 +       addi    r4,r4,0x0020            /* Go to start of next cache line */
8528         bdnz    1b
8529         sync
8530         
8531 -       li      r4,0x1000       /* 128kB / 32B */
8532 +       li      r4,0x0800       /* 64k */
8533         mtctr   r4
8534         lis     r4,KERNELBASE@h
8535  1:
8536 @@ -154,14 +148,6 @@
8537         bdnz    1b
8538         sync
8539  
8540 -/* Turn off L1 (necessary ?) */
8541 -       mfspr   r3,HID0
8542 -       ori     r3,r3, HID0_ICE|HID0_DCE
8543 -       xori    r3,r3, HID0_ICE|HID0_DCE
8544 -       mtspr   HID0,r3
8545 -       sync
8546 -       isync
8547 -
8548  /*
8549   * Set the HID0 and MSR for sleep.
8550   */
8551 @@ -177,50 +163,20 @@
8552  1:     sync
8553         mtmsr   r2
8554         isync
8555 -       b       1b              
8556 +       b       1b
8557  
8558 -       
8559  /* 
8560   * Here is the resume code.
8561 - * Core99 machines resume here
8562 - * r4 has the physical address of SL_PC(sp).
8563 - */
8564 -
8565 -core99_wake_up:
8566 -       mr      r1,r4
8567 -       mfspr   r3,HID0
8568 -       /* use rlwinm ... */
8569 -       oris    r3,r3,HID0_SLEEP@h
8570 -       xoris   r3,r3,HID0_SLEEP@h
8571 -       mtspr   HID0,r3
8572 -       sync
8573 -       isync
8574 -       
8575 -       /* sanitize MSR */
8576 -       mfmsr   r3
8577 -       ori     r3,r3,MSR_EE|MSR_IP
8578 -       xori    r3,r3,MSR_EE|MSR_IP
8579 -       mtmsr   r3
8580 -       sync
8581 -       isync
8582 -               
8583 -/* 
8584 - * Here is the resume code for older machines.
8585   * r1 has the physical address of SL_PC(sp).
8586   */
8587         
8588 -grackle_wake_up:
8589 -       /* Enable and then Flash inval the instruction cache */
8590 +wake_up:
8591 +       /* Flash inval the instruction cache */
8592         mfspr   r3,HID0
8593 -       ori     r3,r3, HID0_ICE|HID0_ICFI|HID0_DCE|HID0_DCI
8594 -       sync
8595 -       isync
8596 -       mtspr   HID0,r3
8597 -       xori    r3,r3, HID0_ICFI|HID0_DCI
8598 +       ori     r3,r3, HID0_ICFI
8599         mtspr   HID0,r3
8600 -       sync
8601 -       
8602 -       /* Restore the remaining bits of the HID0 register. */
8603 +       isync
8604 +       /* Restore the HID0 register.  This turns on the L1 caches. */
8605         subi    r1,r1,SL_PC
8606         lwz     r3,SL_HID0(r1)
8607         sync
8608 @@ -283,13 +239,6 @@
8609         lwz     r4,SL_IBAT3+4(r1)
8610         mtibatl 3,r4
8611  
8612 -       /* Flush all TLBs */
8613 -       lis     r4, 0x1000
8614 -1:     addic.  r4, r4, -0x1000
8615 -       tlbie   r4
8616 -       blt     1b
8617 -       sync
8618 -
8619         /* restore the MSR and turn on the MMU */
8620         lwz     r3,SL_MSR(r1)
8621         bl      turn_on_mmu     
8622 @@ -298,8 +247,6 @@
8623         tovirt(r1,r1)
8624  
8625         /* Restore TB */
8626 -       lis r3,0
8627 -       mttbl   r3
8628         lwz     r3,SL_TB(r1)
8629         lwz     r4,SL_TB+4(r1)
8630         mttbu   r3
8631 @@ -320,4 +267,3 @@
8632         mtsrr1  r3
8633         sync
8634         rfi
8635 -       sync
8636 diff -urN linux.orig/arch/ppc/kernel/smp.c linux/arch/ppc/kernel/smp.c
8637 --- linux.orig/arch/ppc/kernel/smp.c    Sun Mar 25 18:31:49 2001
8638 +++ linux/arch/ppc/kernel/smp.c Thu Jul 11 16:28:25 2002
8639 @@ -7,9 +7,7 @@
8640   * deal of code from the sparc and intel versions.
8641   *
8642   * Support for PReP (Motorola MTX/MVME) SMP by Troy Benjegerdes
8643 - * (troy@blacklablinux.com, hozer@drgw.net)
8644 - * Support for PReP (Motorola MTX/MVME) and Macintosh G4 SMP 
8645 - * by Troy Benjegerdes (hozer@drgw.net)
8646 + * (troy@microux.com, hozer@drgw.net)
8647   */
8648  
8649  #include <linux/kernel.h>
8650 @@ -38,8 +36,8 @@
8651  #include <asm/prom.h>
8652  #include <asm/gemini.h>
8653  #include <asm/residual.h>
8654 -#include <asm/time.h>
8655 -#include <asm/feature.h>
8656 +
8657 +#include "time.h"
8658  #include "open_pic.h"
8659  
8660  int first_cpu_booted = 0;
8661 @@ -49,8 +47,7 @@
8662  struct cpuinfo_PPC cpu_data[NR_CPUS];
8663  struct klock_info_struct klock_info = { KLOCK_CLEAR, 0 };
8664  volatile unsigned char active_kernel_processor = NO_PROC_ID;   /* Processor holding kernel spinlock            */
8665 -atomic_t ipi_recv;
8666 -atomic_t ipi_sent;
8667 +volatile unsigned long ipi_count;
8668  spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED;
8669  unsigned int prof_multiplier[NR_CPUS];
8670  unsigned int prof_counter[NR_CPUS];
8671 @@ -68,9 +65,6 @@
8672  extern unsigned long *MotSave_SmpIar;
8673  extern unsigned char *MotSave_CpusState[2];
8674  
8675 -/* l2 cache stuff for dual G4 macs */
8676 -extern void core99_init_l2(void);
8677
8678  /* register for interrupting the secondary processor on the powersurge */
8679  #define PSURGE_INTR    ((volatile unsigned *)0xf80000c0)
8680  
8681 @@ -121,7 +115,7 @@
8682  
8683  void smp_message_recv(int msg)
8684  {
8685 -       atomic_inc(&ipi_recv);
8686 +       ipi_count++;
8687         
8688         switch( msg )
8689         {
8690 @@ -143,7 +137,6 @@
8691         }
8692  }
8693  
8694 -#ifdef CONFIG_POWERMAC
8695  /*
8696   * As it is now, if we're sending two message at the same time
8697   * we have race conditions on Pmac.  The PowerSurge doesn't easily
8698 @@ -155,10 +148,10 @@
8699   * rather than this.
8700   *  -- Cort
8701   */
8702 -int psurge_smp_message[NR_CPUS];
8703 -void psurge_smp_message_recv(void)
8704 +int pmac_smp_message[NR_CPUS];
8705 +void pmac_smp_message_recv(void)
8706  {
8707 -       int msg = psurge_smp_message[smp_processor_id()];
8708 +       int msg = pmac_smp_message[smp_processor_id()];
8709  
8710         /* clear interrupt */
8711         out_be32(PSURGE_INTR, ~0);
8712 @@ -169,9 +162,9 @@
8713         smp_message_recv(msg);
8714  
8715         /* reset message */
8716 -       psurge_smp_message[smp_processor_id()] = -1;
8717 +       pmac_smp_message[smp_processor_id()] = -1;
8718  }
8719 -#endif /* powermac */
8720 +
8721  
8722  /*
8723   * 750's don't broadcast tlb invalidates so
8724 @@ -203,65 +196,49 @@
8725         smp_message_pass(MSG_ALL_BUT_SELF, MSG_STOP_CPU, 0, 0);
8726  }
8727  
8728 -#ifdef CONFIG_POWERMAC
8729 -static void psurge_message_pass(int target, int msg, unsigned long data, int wait)
8730 +void smp_message_pass(int target, int msg, unsigned long data, int wait)
8731  {
8732         int i;
8733         
8734 -       /*
8735 -        * IPI's on the Pmac are a hack but without reasonable
8736 -        * IPI hardware SMP on Pmac is a hack.
8737 -        *
8738 -        * We assume here that the msg is not -1.  If it is,
8739 -        * the recipient won't know the message was destined
8740 -        * for it. -- Cort
8741 -        */
8742 -       for ( i = 0; i <= smp_num_cpus ; i++ )
8743 -               psurge_smp_message[i] = -1;
8744 -       switch( target )
8745 -       {
8746 -       case MSG_ALL:
8747 -               psurge_smp_message[smp_processor_id()] = msg;
8748 -               /* fall through */
8749 -       case MSG_ALL_BUT_SELF:
8750 -               for ( i = 0 ; i < smp_num_cpus ; i++ )
8751 -                       if ( i != smp_processor_id () )
8752 -                               psurge_smp_message[i] = msg;
8753 -               break;
8754 -       default:
8755 -               psurge_smp_message[target] = msg;
8756 -               break;
8757 -       }
8758 -       /* interrupt secondary processor */
8759 -       out_be32(PSURGE_INTR, ~0);
8760 -       out_be32(PSURGE_INTR, 0);
8761 -       /*
8762 -        * Assume for now that the secondary doesn't send
8763 -        * IPI's -- Cort
8764 -        * Could be fixed with 2.4 code from Paulus -- BenH
8765 -        */
8766 -       /* interrupt primary */
8767 -       /**(volatile unsigned long *)(0xf3019000);*/
8768 -}
8769 -#endif /* powermac */
8770 -
8771 -void smp_message_pass(int target, int msg, unsigned long data, int wait)
8772 -{
8773 -       atomic_inc(&ipi_sent);
8774 -
8775         if ( !(_machine & (_MACH_Pmac|_MACH_chrp|_MACH_prep|_MACH_gemini)) )
8776                 return;
8777  
8778         switch (_machine) {
8779 -#ifdef CONFIG_POWERMAC
8780         case _MACH_Pmac:
8781 -               /* Hack, 2.4 does it cleanly */
8782 -               if (OpenPIC == NULL) {
8783 -                       psurge_message_pass(target, msg, data, wait);
8784 +               /*
8785 +                * IPI's on the Pmac are a hack but without reasonable
8786 +                * IPI hardware SMP on Pmac is a hack.
8787 +                *
8788 +                * We assume here that the msg is not -1.  If it is,
8789 +                * the recipient won't know the message was destined
8790 +                * for it. -- Cort
8791 +                */
8792 +               for ( i = 0; i <= smp_num_cpus ; i++ )
8793 +                       pmac_smp_message[i] = -1;
8794 +               switch( target )
8795 +               {
8796 +               case MSG_ALL:
8797 +                       pmac_smp_message[smp_processor_id()] = msg;
8798 +                       /* fall through */
8799 +               case MSG_ALL_BUT_SELF:
8800 +                       for ( i = 0 ; i < smp_num_cpus ; i++ )
8801 +                               if ( i != smp_processor_id () )
8802 +                                       pmac_smp_message[i] = msg;
8803                         break;
8804 -               } 
8805 -               /* else fall through and do something sane --Troy */
8806 -#endif
8807 +               default:
8808 +                       pmac_smp_message[target] = msg;
8809 +                       break;
8810 +               }
8811 +               /* interrupt secondary processor */
8812 +               out_be32(PSURGE_INTR, ~0);
8813 +               out_be32(PSURGE_INTR, 0);
8814 +               /*
8815 +                * Assume for now that the secondary doesn't send
8816 +                * IPI's -- Cort
8817 +                */
8818 +               /* interrupt primary */
8819 +               /**(volatile unsigned long *)(0xf3019000);*/
8820 +               break;
8821         case _MACH_chrp:
8822         case _MACH_prep:
8823         case _MACH_gemini:
8824 @@ -285,52 +262,6 @@
8825         }
8826  }
8827  
8828 -#ifdef CONFIG_POWERMAC
8829 -static void pmac_core99_kick_cpu(int nr)
8830 -{
8831 -       extern void __secondary_start_psurge(void);
8832 -
8833 -       unsigned long save_int;
8834 -       unsigned long flags;
8835 -       volatile unsigned long *vector
8836 -                = ((volatile unsigned long *)(KERNELBASE+0x500));
8837 -
8838 -       if (nr != 1)
8839 -               return;
8840 -
8841 -       __save_flags(flags);
8842 -       __cli();
8843 -       
8844 -       /* Save EE vector */
8845 -       save_int = *vector;
8846 -       
8847 -       /* Setup fake EE vector that does         
8848 -        *   b __secondary_start_psurge - KERNELBASE
8849 -        */   
8850 -       *vector = 0x48000002 +
8851 -               ((unsigned long)__secondary_start_psurge - KERNELBASE);
8852 -       
8853 -       /* flush data cache and inval instruction cache */
8854 -       flush_icache_range((unsigned long) vector, (unsigned long) vector + 4);
8855 -
8856 -       /* Put some life in our friend */
8857 -       feature_core99_kick_cpu1();
8858 -       
8859 -       /* FIXME: We wait a bit for the CPU to take the exception, I should
8860 -        * instead wait for the entry code to set something for me. Well,
8861 -        * ideally, all that crap will be done in prom.c and the CPU left
8862 -        * in a RAM-based wait loop like CHRP.
8863 -        */
8864 -       mdelay(1);
8865 -       
8866 -       /* Restore our exception vector */
8867 -       *vector = save_int;
8868 -       flush_icache_range((unsigned long) vector, (unsigned long) vector + 4);
8869 -
8870 -       __restore_flags(flags);
8871 -}
8872 -#endif /* powermac */
8873 -
8874  void __init smp_boot_cpus(void)
8875  {
8876         extern struct task_struct *current_set[NR_CPUS];
8877 @@ -367,21 +298,15 @@
8878  
8879         switch ( _machine )
8880         {
8881 -#ifdef CONFIG_POWERMAC
8882         case _MACH_Pmac:
8883 -               /* assum e powersurge board - 2 processors -- Cort */
8884 -               /* or a dual G4 -- Troy */
8885 +               /* assume powersurge board - 2 processors -- Cort */
8886                 cpu_nr = 2;
8887                 break;
8888 -#endif
8889 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_CHRP)
8890         case _MACH_chrp:
8891                 cpu_nr = ((openpic_read(&OpenPIC->Global.Feature_Reporting0)
8892                                  & OPENPIC_FEATURE_LAST_PROCESSOR_MASK) >>
8893                                 OPENPIC_FEATURE_LAST_PROCESSOR_SHIFT)+1;
8894                 break;
8895 -#endif
8896 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_PREP)
8897         case _MACH_prep:
8898                 /* assume 2 for now == fix later -- Johnnie */
8899                 if ( mot_multi )
8900 @@ -389,13 +314,10 @@
8901                         cpu_nr = 2;
8902                         break;
8903                 }
8904 -#endif
8905 -#ifdef CONFIG_GEMINI
8906         case _MACH_gemini:
8907                  cpu_nr = (readb(GEMINI_CPUSTAT) & GEMINI_CPU_COUNT_MASK)>>2;
8908                  cpu_nr = (cpu_nr == 0) ? 4 : cpu_nr;
8909                 break;
8910 -#endif
8911         default:
8912                 printk("SMP not supported on this machine.\n");
8913                 return;
8914 @@ -426,41 +348,30 @@
8915                 /* wake up cpus */
8916                 switch ( _machine )
8917                 {
8918 -#ifdef CONFIG_POWERMAC
8919                 case _MACH_Pmac:
8920 -                       if (OpenPIC == NULL) {
8921 -                               /* setup entry point of secondary processor */
8922 -                               *(volatile unsigned long *)(0xf2800000) =
8923 -                                       (unsigned long)__secondary_start_psurge-KERNELBASE;
8924 -                               eieio();
8925 -                               /* interrupt secondary to begin executing code */
8926 -                               out_be32(PSURGE_INTR, ~0);
8927 -                               out_be32(PSURGE_INTR, 0);
8928 -                       } else
8929 -                               pmac_core99_kick_cpu(i);
8930 +                       /* setup entry point of secondary processor */
8931 +                       *(volatile unsigned long *)(0xf2800000) =
8932 +                               (unsigned long)__secondary_start_psurge-KERNELBASE;
8933 +                       eieio();
8934 +                       /* interrupt secondary to begin executing code */
8935 +                       out_be32(PSURGE_INTR, ~0);
8936 +                       out_be32(PSURGE_INTR, 0);
8937                         break;
8938 -#endif
8939 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_CHRP)
8940                 case _MACH_chrp:
8941                         *(unsigned long *)KERNELBASE = i;
8942                         asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory");
8943                         break;
8944 -#endif
8945 -#if defined(CONFIG_ALL_PPC) || defined(CONFIG_PREP)
8946                 case _MACH_prep:
8947                         *MotSave_SmpIar = (unsigned long)__secondary_start_psurge - KERNELBASE;
8948                         *MotSave_CpusState[1] = CPU_GOOD;
8949                         printk("CPU1 reset, waiting\n");
8950                         break;
8951 -#endif
8952 -#ifdef CONFIG_GEMINI
8953                 case _MACH_gemini:
8954                         openpic_init_processor( 1<<i );
8955                         openpic_init_processor( 0 );
8956                         break;
8957 -#endif
8958                 }
8959 -
8960 +               
8961                 /*
8962                  * wait to see if the cpu made a callin (is actually up).
8963                  * use this value that I found through experimentation.
8964 @@ -481,9 +392,9 @@
8965                 }
8966         }
8967         
8968 -       if (OpenPIC)
8969 +       if ( _machine & (_MACH_gemini|_MACH_chrp|_MACH_prep) )
8970                 do_openpic_setup_cpu();
8971 -       else if ( _machine == _MACH_Pmac )
8972 +       if ( _machine == _MACH_Pmac )
8973         {
8974                 /* reset the entry point so if we get another intr we won't
8975                  * try to startup again */
8976 @@ -529,17 +440,10 @@
8977          * place to stick it for now.
8978          *  -- Cort
8979          */
8980 -       if (OpenPIC) {
8981 +       if ( _machine & (_MACH_gemini|_MACH_chrp|_MACH_prep) )
8982                 do_openpic_setup_cpu();
8983 -#ifdef CONFIG_POWERMAC
8984 -               if ( _machine == _MACH_Pmac )
8985 -                       core99_init_l2();
8986 -#endif
8987 -       }
8988 -#ifdef CONFIG_GEMINI
8989         if ( _machine == _MACH_gemini )
8990                 gemini_init_l2();
8991 -#endif
8992         while(!smp_commenced)
8993                 barrier();
8994         __sti();
8995 diff -urN linux.orig/arch/ppc/kernel/syscalls.c linux/arch/ppc/kernel/syscalls.c
8996 --- linux.orig/arch/ppc/kernel/syscalls.c       Sun Mar 25 18:31:49 2001
8997 +++ linux/arch/ppc/kernel/syscalls.c    Thu Jul 11 15:43:29 2002
8998 @@ -199,7 +199,6 @@
8999         struct file * file = NULL;
9000         int ret = -EBADF;
9001  
9002 -       down(&current->mm->mmap_sem);
9003         lock_kernel();
9004         if (!(flags & MAP_ANONYMOUS)) {
9005                 if (fd >= NR_OPEN || !(file = current->files->fd[fd]))
9006 @@ -210,7 +209,6 @@
9007         ret = do_mmap(file, addr, len, prot, flags, offset);
9008  out:
9009         unlock_kernel();
9010 -       up(&current->mm->mmap_sem);
9011         return ret;
9012  }
9013  
9014 @@ -248,14 +246,9 @@
9015  
9016  asmlinkage int sys_uname(struct old_utsname * name)
9017  {
9018 -       int err;
9019 -       
9020 -       if (!name)
9021 -               return -EFAULT;
9022 -       down(&uts_sem);
9023 -       err = copy_to_user(name, &system_utsname, sizeof (*name));
9024 -       up(&uts_sem);
9025 -       return err ? -EFAULT : 0;
9026 +       if (name && !copy_to_user(name, &system_utsname, sizeof (*name)))
9027 +               return 0;
9028 +       return -EFAULT;
9029  }
9030  
9031  asmlinkage int sys_olduname(struct oldold_utsname * name)
9032 @@ -267,7 +260,6 @@
9033         if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname)))
9034                 return -EFAULT;
9035    
9036 -       down(&uts_sem);
9037         error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN);
9038         error -= __put_user(0,name->sysname+__OLD_UTS_LEN);
9039         error -= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN);
9040 @@ -279,18 +271,6 @@
9041         error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
9042         error = __put_user(0,name->machine+__OLD_UTS_LEN);
9043         error = error ? -EFAULT : 0;
9044 -       up(&uts_sem);
9045  
9046         return error;
9047  }
9048 -
9049 -#ifndef CONFIG_PCI
9050 -/*
9051 - * Those are normally defined in arch/ppc/kernel/pci.c. But when CONFIG_PCI is
9052 - * not defined, this file is not linked at all, so here are the "empty" versions
9053 - */
9054 -asmlinkage int sys_pciconfig_read() { return -ENOSYS; }
9055 -asmlinkage int sys_pciconfig_write() { return -ENOSYS; }
9056 -asmlinkage long sys_pciconfig_iobase() { return -ENOSYS; }
9057 -#endif
9058 -
9059 diff -urN linux.orig/arch/ppc/kernel/time.c linux/arch/ppc/kernel/time.c
9060 --- linux.orig/arch/ppc/kernel/time.c   Sun Mar 25 18:31:49 2001
9061 +++ linux/arch/ppc/kernel/time.c        Thu Jul 11 15:43:29 2002
9062 @@ -46,7 +46,7 @@
9063  #endif
9064  #include <asm/machdep.h>
9065  
9066 -#include <asm/time.h>
9067 +#include "time.h"
9068  
9069  void smp_local_timer_interrupt(struct pt_regs *);
9070  
9071 @@ -71,7 +71,7 @@
9072  {
9073         int dval, d;
9074         unsigned long cpu = smp_processor_id();
9075 -
9076 +       
9077         hardirq_enter(cpu);
9078  #ifdef __SMP__
9079         {
9080 @@ -106,13 +106,6 @@
9081                 if ( !smp_processor_id() )
9082                 {
9083                         do_timer(regs);
9084 -#if 0
9085 -       /* -- BenH -- I'm removing this for now since it can cause various
9086 -        *            troubles with local-time RTCs. Now that we have a
9087 -        *            /dev/rtc that uses ppc_md.set_rtc_time() on mac, it
9088 -        *            should be possible to program the RTC from userland
9089 -        *            in all cases.
9090 -        */
9091                         /*
9092                          * update the rtc when needed
9093                          */
9094 @@ -126,7 +119,6 @@
9095                                         /* do it again in 60 s */
9096                                         last_rtc_update = xtime.tv_sec;
9097                         }
9098 -#endif                 
9099                 }
9100         }
9101  #ifdef __SMP__
9102 @@ -192,10 +184,10 @@
9103  
9104  __initfunc(void time_init(void))
9105  {
9106 -       long time_offset = 0;
9107 -
9108          if (ppc_md.time_init != NULL)
9109 -                time_offset = ppc_md.time_init();
9110 +        {
9111 +                ppc_md.time_init();
9112 +        }
9113  
9114         if ((_get_PVR() >> 16) == 1) {
9115                 /* 601 processor: dec counts down by 128 every 128ns */
9116 @@ -208,12 +200,6 @@
9117  
9118          xtime.tv_sec = ppc_md.get_rtc_time();
9119          xtime.tv_usec = 0;
9120 -        if (time_offset) {
9121 -               struct timezone tz;
9122 -               tz.tz_minuteswest = time_offset/60;
9123 -               tz.tz_dsttime = 0; /* Not handled correctly by the kernel anyway */
9124 -               do_sys_settimeofday(NULL, &tz);
9125 -        }
9126  
9127         set_dec(decrementer_count);
9128         /* allow updates right away */
9129 diff -urN linux.orig/arch/ppc/kernel/time.h linux/arch/ppc/kernel/time.h
9130 --- linux.orig/arch/ppc/kernel/time.h   Thu Jan  1 01:00:00 1970
9131 +++ linux/arch/ppc/kernel/time.h        Thu Jul 11 15:43:29 2002
9132 @@ -0,0 +1,34 @@
9133 +/*
9134 + * $Id$
9135 + * Common time prototypes and such for all ppc machines.
9136 + *
9137 + * Written by Cort Dougan (cort@cs.nmt.edu) to merge
9138 + * Paul Mackerras' version and mine for PReP and Pmac.
9139 + */
9140 +
9141 +#include <linux/mc146818rtc.h>
9142 +
9143 +/* time.c */
9144 +extern unsigned decrementer_count;
9145 +extern unsigned count_period_num;
9146 +extern unsigned count_period_den;
9147 +extern unsigned long mktime(unsigned int, unsigned int, unsigned int,
9148 +                           unsigned int, unsigned int, unsigned int);
9149 +extern void to_tm(int tim, struct rtc_time * tm);
9150 +extern time_t last_rtc_update;
9151 +
9152 +int via_calibrate_decr(void);
9153 +
9154 +/* Accessor functions for the decrementer register. */
9155 +static __inline__ unsigned int get_dec(void)
9156 +{
9157 +       unsigned int ret;
9158 +
9159 +       asm volatile("mfspr %0,22" : "=r" (ret) :);
9160 +       return ret;
9161 +}
9162 +
9163 +static __inline__ void set_dec(unsigned int val)
9164 +{
9165 +       asm volatile("mtspr 22,%0" : : "r" (val));
9166 +}
9167 diff -urN linux.orig/arch/ppc/kernel/traps.c linux/arch/ppc/kernel/traps.c
9168 --- linux.orig/arch/ppc/kernel/traps.c  Sun Mar 25 18:31:48 2001
9169 +++ linux/arch/ppc/kernel/traps.c       Thu Jul 11 15:43:29 2002
9170 @@ -100,27 +100,26 @@
9171                         return;
9172                 }
9173  #endif
9174 -               printk("Machine check in kernel mode.  (regs at %p)\n", regs);
9175 -               printk("Caused by (from srr1): ");
9176 -               switch( regs->msr & 0x001F0000) {
9177 -               case 0x100000:
9178 -                       printk("L2 data cache parity error\n");
9179 +               printk("Machine check in kernel mode.\n");
9180 +               printk("Caused by (from msr): ");
9181 +               printk("regs %p ",regs);
9182 +               switch( regs->msr & 0x0000F000)
9183 +               {
9184 +               case (1<<12) :
9185 +                       printk("Machine check signal - probably due to mm fault\n"
9186 +                               "with mmu off\n");
9187                         break;
9188 -               case 0x80000:
9189 -                       printk("Machine check signal\n");
9190 -                       printk("(probably due to access of bad physical address\n");
9191 -                       break;
9192 -               case 0x40000:
9193 +               case (1<<13) :
9194                         printk("Transfer error ack signal\n");
9195                         break;
9196 -               case 0x20000:
9197 +               case (1<<14) :
9198                         printk("Data parity signal\n");
9199                         break;
9200 -               case 0x10000:
9201 +               case (1<<15) :
9202                         printk("Address parity signal\n");
9203                         break;
9204                 default:
9205 -                       printk("Unknown values in srr1\n");
9206 +                       printk("Unknown values in msr\n");
9207                 }
9208                 show_regs(regs);
9209  #if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
9210 @@ -156,52 +155,9 @@
9211         _exception(SIGTRAP, regs);      
9212  }
9213  
9214 -/* Illegal instruction emulation support.  Originally written to
9215 - * provide the PVR to user applications using the mfspr rd, PVR.
9216 - * Return non-zero if we can't emulate, or EFAULT if the associated
9217 - * memory access caused an access fault.  Return zero on success.
9218 - *
9219 - * There are a couple of ways to do this, either "decode" the instruction
9220 - * or directly match lots of bits.  In this case, matching lots of
9221 - * bits is faster and easier.
9222 - *
9223 - */
9224 -#define INST_MFSPR_PVR         0x7c1f42a6
9225 -#define INST_MFSPR_PVR_MASK    0xfc1fffff
9226 -
9227 -static int
9228 -emulate_instruction(struct pt_regs *regs)
9229 -{
9230 -       uint    instword;
9231 -       uint    rd;
9232 -       int    retval;
9233 -
9234 -       retval = EINVAL;
9235 -       if (!user_mode(regs))
9236 -               return retval;
9237 -
9238 -       retval = EFAULT;
9239 -       if (get_user(instword, (uint *)(regs->nip)))
9240 -               return retval;
9241 -
9242 -       /* Emulate the mfspr rD, PVR.
9243 -        */
9244 -       retval = EINVAL;
9245 -       if ((instword & INST_MFSPR_PVR_MASK) == INST_MFSPR_PVR) {
9246 -               rd = (instword >> 21) & 0x1f;
9247 -               regs->gpr[rd] = _get_PVR();
9248 -               retval = 0;
9249 -       }
9250 -       if (retval == 0)
9251 -               regs->nip += 4;
9252 -       return(retval);
9253 -}
9254 -
9255  void
9256  ProgramCheckException(struct pt_regs *regs)
9257  {
9258 -       int errcode;
9259 -
9260         if (regs->msr & 0x100000) {
9261                 /* IEEE FP exception */
9262                 _exception(SIGFPE, regs);
9263 @@ -213,13 +169,7 @@
9264  #endif
9265                 _exception(SIGTRAP, regs);
9266         } else {
9267 -               /* Try to emulate it if we should. */
9268 -               if ((errcode = emulate_instruction(regs))) {
9269 -                       if (errcode == EFAULT)
9270 -                               _exception(SIGBUS, regs);
9271 -                       else
9272 -                               _exception(SIGILL, regs);
9273 -               }
9274 +               _exception(SIGILL, regs);
9275         }
9276  }
9277  
9278 diff -urN linux.orig/arch/ppc/lib/string.S linux/arch/ppc/lib/string.S
9279 --- linux.orig/arch/ppc/lib/string.S    Sun Mar 25 18:31:49 2001
9280 +++ linux/arch/ppc/lib/string.S Thu Jul 11 15:43:29 2002
9281 @@ -12,11 +12,6 @@
9282  #include <asm/processor.h>
9283  #include <asm/errno.h>
9284  
9285 -CACHELINE_BYTES = 32
9286 -LG_CACHELINE_BYTES = 5
9287 -CACHELINE_MASK = 0x1f
9288 -CACHELINE_WORDS = 8
9289 -
9290         .globl  strcpy
9291  strcpy:
9292         addi    r5,r3,-1
9293 @@ -87,35 +82,7 @@
9294         andi.   r0,r6,3
9295         add     r5,r0,r5
9296         subf    r6,r0,r6
9297 -#if 0  /* Clever, but breaks fb stuff -- paulus */
9298 -/*
9299 - * Use dcbz on the complete cache lines in the destination if
9300 - * we are setting to zero.  This requires that the destination
9301 - * area is cacheable.  -- paulus
9302 - */
9303 -       cmpwi   0,r4,0
9304 -       bne     2f
9305 -       clrlwi  r7,r6,32-LG_CACHELINE_BYTES
9306 -       add     r8,r7,r5
9307 -       srwi    r9,r8,LG_CACHELINE_BYTES
9308 -       addic.  r9,r9,-1        /* total number of complete cachelines */
9309 -       ble     2f
9310 -       xori    r0,r7,CACHELINE_MASK & ~3
9311 -       srwi.   r0,r0,2
9312 -       beq     3f
9313 -       mtctr   r0
9314 -4:     stwu    r4,4(r6)
9315 -       bdnz    4b
9316 -3:     mtctr   r9
9317 -       li      r7,4
9318 -10:    dcbz    r7,r6
9319 -       addi    r6,r6,CACHELINE_BYTES
9320 -       bdnz    10b
9321 -       clrlwi  r5,r8,32-LG_CACHELINE_BYTES
9322 -       addi    r5,r5,4
9323 -2:
9324 -#endif
9325 -       srwi    r0,r5,2
9326 +       rlwinm  r0,r5,32-2,2,31
9327         mtctr   r0
9328         bdz     6f
9329  1:     stwu    r4,4(r6)
9330 @@ -140,94 +107,11 @@
9331  memmove:
9332         cmplw   0,r3,r4
9333         bgt     backwards_memcpy
9334 -       b       forwards_memcpy
9335 +       /* fall through */
9336  
9337         .globl  memcpy
9338  memcpy:
9339 -#if 0  /* Clever, but will probably break fb stuff -- paulus */
9340 -/*
9341 - * This version uses dcbz on the complete cache lines in the
9342 - * destination area to reduce memory traffic.  This requires that
9343 - * the destination area is cacheable.
9344 - * We only use this version if the source and dest don't overlap.
9345 - * -- paulus.
9346 - */
9347 -       add     r7,r3,r5                /* test if the src & dst overlap */
9348 -       add     r8,r4,r5
9349 -       cmplw   0,r4,r7
9350 -       cmplw   1,r3,r8
9351 -       crand   0,0,4                   /* cr0.lt &= cr1.lt */
9352 -       blt     forwards_memcpy         /* if regions overlap */
9353 -
9354 -       addi    r4,r4,-4
9355 -       addi    r6,r3,-4
9356 -       neg     r0,r3
9357 -       andi.   r0,r0,CACHELINE_MASK    /* # bytes to start of cache line */
9358 -       beq     58f
9359 -
9360 -       cmplw   0,r5,r0                 /* is this more than total to do? */
9361 -       blt     63f                     /* if not much to do */
9362 -       andi.   r8,r0,3                 /* get it word-aligned first */
9363 -       subf    r5,r0,r5
9364 -       mtctr   r8
9365 -       beq+    61f
9366 -70:    lbz     r9,4(r4)                /* do some bytes */
9367 -       stb     r9,4(r6)
9368 -       addi    r4,r4,1
9369 -       addi    r6,r6,1
9370 -       bdnz    70b
9371 -61:    srwi.   r0,r0,2
9372 -       mtctr   r0
9373 -       beq     58f
9374 -72:    lwzu    r9,4(r4)                /* do some words */
9375 -       stwu    r9,4(r6)
9376 -       bdnz    72b
9377 -
9378 -58:    srwi.   r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */
9379 -       clrlwi  r5,r5,32-LG_CACHELINE_BYTES
9380 -       li      r11,4
9381 -       mtctr   r0
9382 -       beq     63f
9383 -53:    dcbz    r11,r6
9384 -       lwz     r7,4(r4)
9385 -       lwz     r8,8(r4)
9386 -       lwz     r9,12(r4)
9387 -       lwzu    r10,16(r4)
9388 -       stw     r7,4(r6)
9389 -       stw     r8,8(r6)
9390 -       stw     r9,12(r6)
9391 -       stwu    r10,16(r6)
9392 -       lwz     r7,4(r4)
9393 -       lwz     r8,8(r4)
9394 -       lwz     r9,12(r4)
9395 -       lwzu    r10,16(r4)
9396 -       stw     r7,4(r6)
9397 -       stw     r8,8(r6)
9398 -       stw     r9,12(r6)
9399 -       stwu    r10,16(r6)
9400 -       bdnz    53b
9401 -
9402 -63:    srwi.   r0,r5,2
9403 -       mtctr   r0
9404 -       beq     64f
9405 -30:    lwzu    r0,4(r4)
9406 -       stwu    r0,4(r6)
9407 -       bdnz    30b
9408 -
9409 -64:    andi.   r0,r5,3
9410 -       mtctr   r0
9411 -       beq+    65f
9412 -40:    lbz     r0,4(r4)
9413 -       stb     r0,4(r6)
9414 -       addi    r4,r4,1
9415 -       addi    r6,r6,1
9416 -       bdnz    40b
9417 -65:    blr
9418 -#endif
9419 -
9420 -       .global forwards_memcpy
9421 -forwards_memcpy:
9422 -       srwi.   r7,r5,3
9423 +       rlwinm. r7,r5,32-3,3,31         /* r0 = r5 >> 3 */
9424         addi    r6,r3,-4
9425         addi    r4,r4,-4
9426         beq     2f                      /* if less than 8 bytes to do */
9427 @@ -334,167 +218,106 @@
9428  
9429         .globl  __copy_tofrom_user
9430  __copy_tofrom_user:
9431 -       addi    r4,r4,-4
9432 +       srwi.   r7,r5,3
9433         addi    r6,r3,-4
9434 -       neg     r0,r3
9435 -       andi.   r0,r0,CACHELINE_MASK    /* # bytes to start of cache line */
9436 -       beq     58f
9437 -
9438 -       cmplw   0,r5,r0                 /* is this more than total to do? */
9439 -       blt     63f                     /* if not much to do */
9440 -       andi.   r8,r0,3                 /* get it word-aligned first */
9441 -       mtctr   r8
9442 -       beq+    61f
9443 -70:    lbz     r9,4(r4)                /* do some bytes */
9444 -71:    stb     r9,4(r6)
9445 -       addi    r4,r4,1
9446 -       addi    r6,r6,1
9447 -       bdnz    70b
9448 -61:    subf    r5,r0,r5
9449 -       srwi.   r0,r0,2
9450 -       mtctr   r0
9451 -       beq     58f
9452 -72:    lwzu    r9,4(r4)                /* do some words */
9453 -73:    stwu    r9,4(r6)
9454 -       bdnz    72b
9455 -
9456 -58:    srwi.   r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */
9457 -       clrlwi  r5,r5,32-LG_CACHELINE_BYTES
9458 -       li      r11,4
9459 -       mtctr   r0
9460 -       beq     63f
9461 -53:    dcbz    r11,r6
9462 -10:    lwz     r7,4(r4)
9463 -11:    lwz     r8,8(r4)
9464 -12:    lwz     r9,12(r4)
9465 -13:    lwzu    r10,16(r4)
9466 -14:    stw     r7,4(r6)
9467 -15:    stw     r8,8(r6)
9468 -16:    stw     r9,12(r6)
9469 -17:    stwu    r10,16(r6)
9470 -20:    lwz     r7,4(r4)
9471 -21:    lwz     r8,8(r4)
9472 -22:    lwz     r9,12(r4)
9473 -23:    lwzu    r10,16(r4)
9474 -24:    stw     r7,4(r6)
9475 -25:    stw     r8,8(r6)
9476 -26:    stw     r9,12(r6)
9477 -27:    stwu    r10,16(r6)
9478 -       bdnz    53b
9479 -
9480 -63:    srwi.   r0,r5,2
9481 -       mtctr   r0
9482 -       beq     64f
9483 -30:    lwzu    r0,4(r4)
9484 -31:    stwu    r0,4(r6)
9485 -       bdnz    30b
9486 -
9487 -64:    andi.   r0,r5,3
9488 -       mtctr   r0
9489 -       beq+    65f
9490 -40:    lbz     r0,4(r4)
9491 -41:    stb     r0,4(r6)
9492 +       addi    r4,r4,-4
9493 +       li      r3,0            /* success return value */
9494 +       beq     2f              /* if less than 8 bytes to do */
9495 +       andi.   r0,r6,3         /* get dest word aligned */
9496 +       mtctr   r7
9497 +       bne     5f
9498 +1:     lwz     r7,4(r4)
9499 +11:    lwzu    r8,8(r4)
9500 +12:    stw     r7,4(r6)
9501 +13:    stwu    r8,8(r6)
9502 +       bdnz    1b
9503 +       andi.   r5,r5,7
9504 +2:     cmplwi  0,r5,4
9505 +       blt     3f
9506 +14:    lwzu    r0,4(r4)
9507 +       addi    r5,r5,-4
9508 +15:    stwu    r0,4(r6)
9509 +3:     cmpwi   0,r5,0          /* do 1 byte at a time for the remainder */
9510 +       beqlr
9511 +       mtctr   r5
9512 +       addi    r4,r4,3
9513 +       addi    r6,r6,3
9514 +4:     lbzu    r0,1(r4)
9515 +16:    stbu    r0,1(r6)
9516 +       bdnz    4b
9517 +       blr
9518 +5:     subfic  r0,r0,4         /* copy bytes until we have the */
9519 +       mtctr   r0              /* destination 4-byte aligned */
9520 +       subf    r5,r0,r5
9521 +6:     lbz     r7,4(r4)
9522         addi    r4,r4,1
9523 +17:    stb     r7,4(r6)
9524         addi    r6,r6,1
9525 -       bdnz    40b
9526 -65:    li      r3,0
9527 -       blr
9528 -
9529 -/* read fault, initial single-byte copy */
9530 -100:   li      r4,0
9531 -       b       90f
9532 -/* write fault, initial single-byte copy */
9533 -101:   li      r4,1
9534 -90:    subf    r5,r8,r5
9535 -       li      r3,0
9536 -       b       99f
9537 -/* read fault, initial word copy */
9538 -102:   li      r4,0
9539 -       b       91f
9540 -/* write fault, initial word copy */
9541 -103:   li      r4,1
9542 -91:    li      r3,2
9543 -       b       99f
9544 -/* read fault in 2nd half of cacheline loop */
9545 -106:   addi    r5,r5,-16
9546 -/* read fault in 1st half of cacheline loop */
9547 -104:   li      r4,0
9548 -       b       92f
9549 -/* write fault in 2nd half of cacheline loop */
9550 -107:   addi    r5,r5,-16
9551 -/* fault on dcbz (effectively a write fault) */
9552 -/* or write fault in 1st half of cacheline loop */
9553 -105:   li      r4,1
9554 -92:    li      r3,LG_CACHELINE_BYTES
9555 -       b       99f
9556 -/* read fault in final word loop */
9557 -108:   li      r4,0
9558 -       b       93f
9559 -/* write fault in final word loop */
9560 -109:   li      r4,1
9561 -93:    andi.   r5,r5,3
9562 -       li      r3,2
9563 -       b       99f
9564 -/* read fault in final byte loop */
9565 -110:   li      r4,0
9566 -       b       94f
9567 -/* write fault in final byte loop */
9568 -111:   li      r4,1
9569 -94:    li      r5,0
9570 -       li      r3,0
9571 -/*
9572 - * At this stage the number of bytes not copied is
9573 - * r5 + (ctr << r3), and r4 is 0 for read or 1 for write.
9574 - */
9575 -99:    mfctr   r0
9576 -       slw     r3,r0,r3
9577 +       bdnz    6b
9578 +       srwi.   r7,r5,3
9579 +       beq     2b
9580 +       mtctr   r7
9581 +       b       1b
9582 +/* we come here on a fault in the 8-byte-at-a-time loop */
9583 +88:    subi    r4,r4,8         /* compensate for the lwzu */
9584 +98:    mfctr   r0
9585 +       rlwimi  r5,r0,3,0,28    /* use the byte-at-a-time loop to */
9586 +       b       3b              /* copy up to the byte at fault */
9587 +/* here on a write fault in the single-word copy */
9588 +96:    subi    r4,r4,4
9589 +       b       3b
9590 +/* here on a read fault in the initial single-byte copy */
9591 +90:    mfctr   r3
9592         add     r3,r3,r5
9593 -       cmpwi   0,r4,0
9594 -       bne     120f
9595 -/* for read fault, clear out the destination: r3 bytes starting at 4(r6) */
9596 -       srwi.   r0,r3,2
9597 -       li      r9,0
9598 -       mtctr   r0
9599 -       beq     113f
9600 -112:   stwu    r9,4(r6)
9601 -       bdnz    112b
9602 -113:   andi.   r0,r3,3
9603 -       mtctr   r0
9604 -       beq     120f
9605 -114:   stb     r9,4(r6)
9606 +       b       70f
9607 +/* here on a read fault in the final single-byte copy */
9608 +99:    mfctr   r3
9609 +       subi    r6,r6,3
9610 +/* clear out the rest of the destination: r3 bytes starting at 4(r6) */
9611 +70:    li      r0,0
9612 +       mr.     r5,r3
9613 +       beq     76f
9614 +71:    andi.   r4,r6,3
9615 +       beq     72f
9616 +77:    stb     r0,4(r6)
9617         addi    r6,r6,1
9618 -       bdnz    114b
9619 -120:   blr
9620 +       addic.  r5,r5,-1
9621 +       bne     71b
9622 +72:    srwi.   r7,r5,2
9623 +       beq     73f
9624 +       mtctr   r7
9625 +74:    stwu    r0,4(r6)
9626 +       bdnz    74b
9627 +73:    andi.   r5,r5,3
9628 +       beq     76f
9629 +       mtctr   r5
9630 +       addi    r6,r6,3
9631 +75:    stbu    r0,1(r6)
9632 +       bdnz    75b
9633 +76:    blr
9634 +/* here on a write fault in the initial single-byte copy */
9635 +80:    mfctr   r3
9636 +       add     r3,r3,r5
9637 +       blr
9638 +/* here on a write fault in the final single-byte copy */
9639 +81:    mfctr   r3
9640 +       blr
9641  
9642  .section __ex_table,"a"
9643         .align  2
9644 -       .long   70b,100b
9645 -       .long   71b,101b
9646 -       .long   72b,102b
9647 -       .long   73b,103b
9648 -       .long   53b,105b
9649 -       .long   10b,104b
9650 -       .long   11b,104b
9651 -       .long   12b,104b
9652 -       .long   13b,104b
9653 -       .long   14b,105b
9654 -       .long   15b,105b
9655 -       .long   16b,105b
9656 -       .long   17b,105b
9657 -       .long   20b,106b
9658 -       .long   21b,106b
9659 -       .long   22b,106b
9660 -       .long   23b,106b
9661 -       .long   24b,107b
9662 -       .long   25b,107b
9663 -       .long   26b,107b
9664 -       .long   27b,107b
9665 -       .long   30b,108b
9666 -       .long   31b,109b
9667 -       .long   40b,110b
9668 -       .long   41b,111b
9669 -       .long   112b,120b
9670 -       .long   114b,120b
9671 +       .long   1b,98b
9672 +       .long   11b,98b
9673 +       .long   12b,88b
9674 +       .long   13b,88b
9675 +       .long   14b,3b
9676 +       .long   15b,96b
9677 +       .long   4b,99b
9678 +       .long   16b,81b
9679 +       .long   6b,90b
9680 +       .long   17b,80b
9681 +       .long   77b,76b
9682 +       .long   74b,76b
9683 +       .long   75b,76b
9684  .text
9685  
9686         .globl  __clear_user
9687 @@ -511,6 +334,7 @@
9688         andi.   r0,r6,3
9689         add     r4,r0,r4
9690         subf    r6,r0,r6
9691 +       /*rlwinm        r0,r4,32-2,2,31*/
9692         srwi    r0,r4,2
9693         mtctr   r0
9694         bdz     6f
9695 diff -urN linux.orig/arch/ppc/mm/extable.c linux/arch/ppc/mm/extable.c
9696 --- linux.orig/arch/ppc/mm/extable.c    Sun Mar 25 18:31:48 2001
9697 +++ linux/arch/ppc/mm/extable.c Thu Jul 11 15:43:29 2002
9698 @@ -7,43 +7,8 @@
9699  #include <linux/module.h>
9700  #include <asm/uaccess.h>
9701  
9702 -extern struct exception_table_entry __start___ex_table[];
9703 -extern struct exception_table_entry __stop___ex_table[];
9704 -
9705 -/*
9706 - * The exception table needs to be sorted because we use the macros
9707 - * which put things into the exception table in a variety of segments
9708 - * such as the prep, pmac, chrp, etc. segments as well as the init
9709 - * segment and the main kernel text segment.
9710 - */
9711 -static inline void
9712 -sort_ex_table(struct exception_table_entry *start,
9713 -             struct exception_table_entry *finish)
9714 -{
9715 -       struct exception_table_entry el, *p, *q;
9716 -
9717 -       /* insertion sort */
9718 -       for (p = start + 1; p < finish; ++p) {
9719 -               /* start .. p-1 is sorted */
9720 -               if (p[0].insn < p[-1].insn) {
9721 -                       /* move element p down to its right place */
9722 -                       el = *p;
9723 -                       q = p;
9724 -                       do {
9725 -                               /* el comes before q[-1], move q[-1] up one */
9726 -                               q[0] = q[-1];
9727 -                               --q;
9728 -                       } while (q > start && el.insn < q[-1].insn);
9729 -                       *q = el;
9730 -               }
9731 -       }
9732 -}
9733 -
9734 -void
9735 -sort_exception_table(void)
9736 -{
9737 -       sort_ex_table(__start___ex_table, __stop___ex_table);
9738 -}
9739 +extern const struct exception_table_entry __start___ex_table[];
9740 +extern const struct exception_table_entry __stop___ex_table[];
9741  
9742  static inline unsigned long
9743  search_one_table(const struct exception_table_entry *first,
9744 @@ -71,7 +36,7 @@
9745  {
9746         unsigned long ret;
9747  
9748 -#ifndef CONFIG_MODULES
9749 +#if 1 /*ndef CONFIG_MODULES*/
9750         /* There is only the kernel to search.  */
9751         ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr);
9752         if (ret) return ret;
9753 diff -urN linux.orig/arch/ppc/mm/fault.c linux/arch/ppc/mm/fault.c
9754 --- linux.orig/arch/ppc/mm/fault.c      Sun Mar 25 18:31:48 2001
9755 +++ linux/arch/ppc/mm/fault.c   Thu Jul 11 15:43:29 2002
9756 @@ -71,10 +71,7 @@
9757                (error_code&0x80000000)?"I/O ":"",
9758                (regs->trap == 0x400)?"instr":"data"
9759                );*/
9760 -
9761 -       if (regs->trap == 0x400)
9762 -               error_code &= 0x48200000;
9763 -
9764 +              
9765  #if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
9766         if (debugger_fault_handler && regs->trap == 0x300) {
9767                 debugger_fault_handler(regs);
9768 diff -urN linux.orig/arch/ppc/mm/init.c linux/arch/ppc/mm/init.c
9769 --- linux.orig/arch/ppc/mm/init.c       Sun Mar 25 18:31:48 2001
9770 +++ linux/arch/ppc/mm/init.c    Thu Jul 11 15:43:30 2002
9771 @@ -416,12 +416,7 @@
9772  
9773  void iounmap(void *addr)
9774  {
9775 -       /* For support of dynamic hot swap on the cPCI bus this routine
9776 -          is now necessary.  This has been well tested on a Motorola
9777 -          MPC750 (Mesquite) processor board.  Johnnie Peters
9778 -       */
9779 -       if (addr > high_memory && (unsigned long) addr < ioremap_bot)
9780 -               return vfree((void *) (PAGE_MASK & (unsigned long) addr));
9781 +       /* XXX todo */
9782  }
9783  
9784  unsigned long iopa(unsigned long addr)
9785 @@ -933,21 +928,15 @@
9786                                 /* On the powerpc, no user access
9787                                    forces R/W kernel access */
9788                                 f |= _PAGE_USER;
9789 -                       map_page(v, p, f);
9790 -                       v += PAGE_SIZE;
9791 -                       p += PAGE_SIZE;
9792 -               }
9793 -       }
9794 -
9795  #else  /* CONFIG_8xx */
9796 -       for (i = 0; i < phys_mem.n_regions; ++i) {
9797 -               v = (ulong)__va(phys_mem.regions[i].address);
9798 -               p = phys_mem.regions[i].address;
9799 -               for (s = 0; s < phys_mem.regions[i].size; s += PAGE_SIZE) {
9800 +            for (i = 0; i < phys_mem.n_regions; ++i) {
9801 +                    v = (ulong)__va(phys_mem.regions[i].address);
9802 +                    p = phys_mem.regions[i].address;
9803 +                    for (s = 0; s < phys_mem.regions[i].size; s += PAGE_SIZE) {
9804                          /* On the MPC8xx, we want the page shared so we
9805                           * don't get ASID compares on kernel space.
9806                           */
9807 -                       f = _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_SHARED;
9808 +                            f = _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_SHARED;
9809  
9810                          /* I don't really need the rest of this code, but
9811                           * I grabbed it because I think the line:
9812 @@ -957,14 +946,14 @@
9813                           * the MPC8xx, the PAGE_DIRTY takes care of that
9814                           * for us (along with the RW software state).
9815                           */
9816 -                       if ((char *) v < _stext || (char *) v >= etext)
9817 -                               f |= _PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE;
9818 +                            if ((char *) v < _stext || (char *) v >= etext)
9819 +                                    f |= _PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE;
9820 +#endif /* CONFIG_8xx */
9821                         map_page(v, p, f);
9822                         v += PAGE_SIZE;
9823                         p += PAGE_SIZE;
9824                 }
9825 -       }
9826 -#endif /* CONFIG_8xx */
9827 +       }           
9828  }
9829  
9830  /* This can get called from ioremap, so don't make it an initfunc, OK? */
9831 @@ -1044,9 +1033,6 @@
9832   * still be merged.
9833   * -- Cort
9834   */
9835 -#ifdef CONFIG_BOOTX_TEXT
9836 -extern boot_infos_t *disp_bi;
9837 -#endif
9838  __initfunc(void MMU_init(void))
9839  {
9840  #ifdef __SMP__
9841 @@ -1066,6 +1052,7 @@
9842  #endif /* CONFIG_GEMINI        */
9843         else /* prep */
9844                 end_of_DRAM = prep_find_end_of_memory();
9845 +*(unsigned long *)(KERNELBASE) = 0xdeadbeef;   
9846          hash_init();
9847          _SDR1 = __pa(Hash) | (Hash_mask >> 10);
9848         ioremap_base = 0xf8000000;
9849 @@ -1095,13 +1082,7 @@
9850                         struct device_node *macio = find_devices("mac-io");
9851                         if (macio && macio->n_addrs)
9852                                 base = macio->addrs[0].address;
9853 -                       /* Hrm... we have it at 0x80000000 on some machines
9854 -                        * and this is covered by the userland segment
9855 -                        * registers. Isn't that bad ? Well, the BAT takes
9856 -                        * precedence, but I don't like it. --BenH
9857 -                        */
9858 -                       if (base >= 0xf0000000)
9859 -                               setbat(0, base, base, 0x100000, IO_PAGE);
9860 +                       setbat(0, base, base, 0x100000, IO_PAGE);
9861                         ioremap_base = 0xf0000000;
9862                 }
9863                 break;
9864 @@ -1140,10 +1121,6 @@
9865          ioremap(0x80000000, 0x4000);
9866          ioremap(0x81000000, 0x4000);
9867  #endif /* CONFIG_8xx */
9868 -#ifdef CONFIG_BOOTX_TEXT
9869 -       if (_machine == _MACH_Pmac)
9870 -               map_bootx_text();
9871 -#endif
9872  }
9873  
9874  /*
9875 @@ -1275,8 +1252,8 @@
9876  #endif /* CONFIG_BLK_DEV_INITRD */
9877  #ifndef CONFIG_8xx               
9878                         if ( !rtas_data ||
9879 -                            addr < (rtas_data + KERNELBASE) ||
9880 -                            addr >= (rtas_data + KERNELBASE + rtas_size))
9881 +                            addr < (rtas_data & PAGE_MASK) ||
9882 +                            addr >= (rtas_data+rtas_size))
9883  #endif /* CONFIG_8xx */
9884                                 free_page(addr);
9885         }
9886 @@ -1337,7 +1314,6 @@
9887         return ret;
9888  }
9889  #endif /* CONFIG_MBX */
9890 -
9891  #ifndef CONFIG_8xx
9892  /*
9893   * On systems with Open Firmware, collect information about
9894 @@ -1404,7 +1380,6 @@
9895         if (boot_infos == 0) {
9896                 /* record which bits the prom is using */
9897                 get_mem_prop("available", &phys_avail);
9898 -               remove_mem_piece(&phys_avail, __max_memory, ~__max_memory, 0);
9899                 prom_mem = phys_mem;
9900                 for (i = 0; i < phys_avail.n_regions; ++i)
9901                         remove_mem_piece(&prom_mem,
9902 diff -urN linux.orig/arch/ppc/pmac_defconfig linux/arch/ppc/pmac_defconfig
9903 --- linux.orig/arch/ppc/pmac_defconfig  Sun Mar 25 18:31:50 2001
9904 +++ linux/arch/ppc/pmac_defconfig       Thu Jul 11 15:43:30 2002
9905 @@ -253,7 +253,6 @@
9906  CONFIG_NET_ETHERNET=y
9907  CONFIG_MACE=y
9908  CONFIG_BMAC=y
9909 -CONFIG_GMAC=y
9910  # CONFIG_NET_VENDOR_3COM is not set
9911  # CONFIG_LANCE is not set
9912  # CONFIG_NET_VENDOR_SMC is not set
9913 @@ -340,7 +339,6 @@
9914  CONFIG_FB_PLATINUM=y
9915  CONFIG_FB_VALKYRIE=y
9916  CONFIG_FB_ATY=y
9917 -CONFIG_FB_ATY128=y
9918  CONFIG_FB_IMSTT=y
9919  CONFIG_FB_CT65550=y
9920  # CONFIG_FB_S3TRIO is not set
9921 diff -urN linux.orig/arch/ppc/xmon/start.c linux/arch/ppc/xmon/start.c
9922 --- linux.orig/arch/ppc/xmon/start.c    Sun Mar 25 18:31:50 2001
9923 +++ linux/arch/ppc/xmon/start.c Thu Jul 11 15:43:30 2002
9924 @@ -11,30 +11,16 @@
9925  #include <asm/prom.h>
9926  #include <asm/bootx.h>
9927  #include <asm/pmu.h>
9928 -#include <asm/feature.h>
9929  
9930  static volatile unsigned char *sccc, *sccd;
9931  unsigned long TXRDY, RXRDY;
9932  extern void xmon_printf(const char *fmt, ...);
9933 +extern void map_bootx_text(void);
9934  extern void drawchar(char);
9935  extern void drawstring(const char *str);
9936 -static int xmon_expect(const char *str, unsigned int timeout);
9937  
9938  static int console = 0;
9939  static int use_screen = 0;
9940 -static int via_modem = 0;
9941 -static int xmon_use_sccb = 0;
9942 -static struct device_node *macio_node;
9943 -
9944 -#define TB_SPEED       25000000
9945 -
9946 -static inline unsigned int readtb(void)
9947 -{
9948 -       unsigned int ret;
9949 -
9950 -       asm volatile("mftb %0" : "=r" (ret) :);
9951 -       return ret;
9952 -}
9953  
9954  void buf_access(void)
9955  {
9956 @@ -50,18 +36,17 @@
9957         if ( _machine == _MACH_Pmac )
9958         {
9959                 struct device_node *np;
9960 +               extern boot_infos_t *boot_infos;
9961                 unsigned long addr;
9962 -#ifdef CONFIG_BOOTX_TEXT
9963 -               extern boot_infos_t *disp_bi;
9964  
9965 -               /* needs to be hacked if xmon_printk is to be used
9966 -                  from within find_via_pmu() */
9967 -               if (!via_modem && disp_bi && find_via_pmu()) {
9968 +#ifdef CONFIG_BOOTX_TEXT
9969 +               if (boot_infos != 0 && find_via_pmu()) {
9970                         printk(KERN_INFO "xmon uses screen and keyboard\n");
9971                         use_screen = 1;
9972 +                       map_bootx_text();
9973 +                       return;
9974                 }
9975  #endif
9976 -
9977  #ifdef CHRP_ESCC
9978                 addr = 0xc1013020;
9979  #else
9980 @@ -72,13 +57,18 @@
9981                 
9982                 np = find_devices("mac-io");
9983                 if (np && np->n_addrs) {
9984 -                       macio_node = np;
9985 -                       addr = np->addrs[0].address + 0x13020;
9986 +                       addr = np->addrs[0].address + 0x13000;
9987 +                       /* use the B channel on the iMac, A channel on others */
9988 +                       if (addr >= 0xf0000000)
9989 +                               addr += 0x20; /* use A channel */
9990                 }
9991 -               base = (volatile unsigned char *)
9992 -                       ioremap(addr & PAGE_MASK, PAGE_SIZE);
9993 +               base = (volatile unsigned char *) ioremap(addr & PAGE_MASK, PAGE_SIZE);
9994                 sccc = base + (addr & ~PAGE_MASK);
9995 -               sccd = sccc + 0x10;
9996 +#ifdef CHRP_ESCC
9997 +               sccd = sccc + (0xc1013030 - 0xc1013020);
9998 +#else
9999 +               sccd = sccc + (0xf3013030 - 0xf3013020);
10000 +#endif
10001         }
10002         else
10003         {
10004 @@ -99,7 +89,7 @@
10005  xmon_write(void *handle, void *ptr, int nb)
10006  {
10007      char *p = ptr;
10008 -    int i, c, ct;
10009 +    int i, ct;
10010  
10011  #ifdef CONFIG_BOOTX_TEXT
10012      if (use_screen) {
10013 @@ -111,23 +101,19 @@
10014  #endif
10015      if (!scc_initialized)
10016         xmon_init_scc();
10017 -    ct = 0;
10018      for (i = 0; i < nb; ++i) {
10019         while ((*sccc & TXRDY) == 0)
10020             if (adb_hardware == ADB_VIAPMU)
10021                 pmu_poll();
10022 -       c = p[i];
10023 -       if (c == '\n' && !ct) {
10024 -           c = '\r';
10025 -           ct = 1;
10026 -           --i;
10027 -       } else {
10028 -           if (console)
10029 -               printk("%c", c);
10030 -           ct = 0;
10031 -       }
10032         buf_access();
10033 -       *sccd = c;
10034 +       if ( console && (*p != '\r'))
10035 +               printk("%c", *p);
10036 +       ct = 0;
10037 +       if ( *p == '\n')
10038 +               ct = 1;
10039 +       *sccd = *p++;
10040 +       if ( ct )
10041 +               xmon_write(handle, "\r", 1);
10042      }
10043      return i;
10044  }
10045 @@ -213,30 +199,23 @@
10046             if (adb_hardware == ADB_VIAPMU)
10047                 pmu_poll();
10048         buf_access();
10049 -       *p++ = *sccd;
10050 +#if 0  
10051 +       if ( 0/*console*/ )
10052 +               *p++ = ppc_md.kbd_getkeycode();
10053 +       else
10054 +#endif         
10055 +               *p++ = *sccd;
10056      }
10057      return i;
10058  }
10059  
10060 -int
10061 -xmon_read_poll(void)
10062 -{
10063 -       if ((*sccc & RXRDY) == 0) {
10064 -               if (adb_hardware == ADB_VIAPMU)
10065 -                       pmu_poll();
10066 -               return -1;
10067 -       }
10068 -       buf_access();
10069 -       return *sccd;
10070 -}
10071 -
10072  static unsigned char scc_inittab[] = {
10073      13, 0,             /* set baud rate divisor */
10074      12, 1,
10075      14, 1,             /* baud rate gen enable, src=rtxc */
10076      11, 0x50,          /* clocks = br gen */
10077 -    5,  0xea,          /* tx 8 bits, assert DTR & RTS */
10078 -    4,  0x46,          /* x16 clock, 1 stop */
10079 +    5,  0x6a,          /* tx 8 bits, assert RTS */
10080 +    4,  0x44,          /* x16 clock, 1 stop */
10081      3,  0xc1,          /* rx enable, 8 bits */
10082  };
10083  
10084 @@ -256,21 +235,6 @@
10085         {
10086                 int i, x;
10087  
10088 -               if (macio_node != 0) {
10089 -                       unsigned int t0;
10090 -
10091 -                       feature_set(macio_node, FEATURE_Serial_enable);
10092 -                       if (via_modem) {
10093 -                               feature_set(macio_node, FEATURE_Modem_power);
10094 -                               t0 = readtb();
10095 -                               while (readtb() - t0 < 3*TB_SPEED)
10096 -                                       eieio();
10097 -                       }
10098 -               }
10099 -               if (xmon_use_sccb) {
10100 -                       sccc -= 0x20;
10101 -                       sccd -= 0x20;
10102 -               }
10103                 for (i = 20000; i != 0; --i) {
10104                         x = *sccc; eieio();
10105                 }
10106 @@ -282,18 +246,6 @@
10107                 }
10108         }
10109         scc_initialized = 1;
10110 -       if (via_modem) {
10111 -               for (;;) {
10112 -                       xmon_write(0, "ATE1V1\r", 7);
10113 -                       if (xmon_expect("OK", 5)) {
10114 -                               xmon_write(0, "ATA\r", 4);
10115 -                               if (xmon_expect("CONNECT", 40))
10116 -                                       break;
10117 -                       }
10118 -                       xmon_write(0, "+++", 3);
10119 -                       xmon_expect("OK", 3);
10120 -               }
10121 -       }
10122  }
10123  
10124  #if 0
10125 @@ -366,35 +318,6 @@
10126  static char *lineptr;
10127  static int lineleft;
10128  
10129 -int xmon_expect(const char *str, unsigned int timeout)
10130 -{
10131 -       int c;
10132 -       unsigned int t0;
10133 -
10134 -       timeout *= TB_SPEED;
10135 -       t0 = readtb();
10136 -       do {
10137 -               lineptr = line;
10138 -               for (;;) {
10139 -                       c = xmon_read_poll();
10140 -                       if (c == -1) {
10141 -                               if (readtb() - t0 > timeout) {
10142 -                                       printk("timeout\n");
10143 -                                       return 0;
10144 -                               }
10145 -                               continue;
10146 -                       }
10147 -                       if (c == '\n')
10148 -                               break;
10149 -                       printk("%c", c);
10150 -                       if (c != '\r' && lineptr < &line[sizeof(line) - 1])
10151 -                               *lineptr++ = c;
10152 -               }
10153 -               *lineptr = 0;
10154 -       } while (strstr(line, str) == NULL);
10155 -       return 1;
10156 -}
10157 -
10158  int
10159  xmon_getchar(void)
10160  {
10161 @@ -467,15 +390,3 @@
10162      *p = 0;
10163      return str;
10164  }
10165 -
10166 -void
10167 -xmon_enter(void)
10168 -{
10169 -       pmu_suspend();
10170 -}
10171 -
10172 -void
10173 -xmon_leave(void)
10174 -{
10175 -       pmu_resume();
10176 -}
10177 diff -urN linux.orig/arch/ppc/xmon/xmon.c linux/arch/ppc/xmon/xmon.c
10178 --- linux.orig/arch/ppc/xmon/xmon.c     Sun Mar 25 18:31:50 2001
10179 +++ linux/arch/ppc/xmon/xmon.c  Thu Jul 11 15:43:30 2002
10180 @@ -86,9 +86,6 @@
10181  extern int setjmp(u_int *);
10182  extern void longjmp(u_int *, int);
10183  
10184 -extern void xmon_enter(void);
10185 -extern void xmon_leave(void);
10186 -
10187  #define GETWORD(v)     (((v)[0] << 24) + ((v)[1] << 16) + ((v)[2] << 8) + (v)[3])
10188  
10189  static char *help_string = "\
10190 @@ -142,7 +139,6 @@
10191         msr = get_msr();
10192         set_msr(msr & ~0x8000); /* disable interrupts */
10193         remove_bpts();
10194 -       xmon_enter();
10195         excprint(excp);
10196         cmd = cmds(excp);
10197         if (cmd == 's') {
10198 @@ -155,7 +151,6 @@
10199                 xmon_trace = 0;
10200                 insert_bpts();
10201         }
10202 -       xmon_leave();
10203         set_msr(msr);           /* restore interrupt enable */
10204  }
10205  
10206 diff -urN linux.orig/include/asm-ppc/irq-compat.h linux/include/asm-ppc/irq-compat.h
10207 --- linux.orig/include/asm-ppc/irq-compat.h     Thu Jan  1 01:00:00 1970
10208 +++ linux/include/asm-ppc/irq-compat.h  Thu Jul 11 15:43:30 2002
10209 @@ -0,0 +1,8 @@
10210 +#include <asm/irq.h>
10211 +
10212 +//#define NUM_8259_INTERRUPTS  16
10213 +//#define NUM_OPENPIC_INTERRUPTS       20
10214 +//#define is_8259_irq(n)               ((n) < NUM_8259_INTERRUPTS)
10215 +#define openpic_to_irq(n)      ((n)+NUM_8259_INTERRUPTS)
10216 +//#define irq_to_openpic(n)    ((n)-NUM_8259_INTERRUPTS)
10217 +//#define IRQ_8259_CASCADE     NUM_8259_INTERRUPTS
10218 diff -urN linux.orig/include/asm-ppc/ohare-compat.h linux/include/asm-ppc/ohare-compat.h
10219 --- linux.orig/include/asm-ppc/ohare-compat.h   Thu Jan  1 01:00:00 1970
10220 +++ linux/include/asm-ppc/ohare-compat.h        Thu Jul 11 15:43:30 2002
10221 @@ -0,0 +1,7 @@
10222 +#define OH_BAY_RESET           2       /* a guess */
10223 +#define OH_IDE_ENABLE          0x20
10224 +#define OH_IDE_POWER           0x40    /* a guess */
10225 +#define OH_BAY_ENABLE          0x80
10226 +#define OH_IDE_RESET           0x100   /* 0-based, a guess */
10227 +#define OH_VIA_ENABLE          0x10000
10228 +#define OH_IDECD_POWER         0x800000
10229 diff -urN linux.orig/include/asm-ppc/page.h linux/include/asm-ppc/page.h
10230 --- linux.orig/include/asm-ppc/page.h   Sun Mar 25 18:37:39 2001
10231 +++ linux/include/asm-ppc/page.h        Thu Jul 11 15:43:30 2002
10232 @@ -77,7 +77,7 @@
10233  #define PAGE_ALIGN(addr)       (((addr)+PAGE_SIZE-1)&PAGE_MASK)
10234  
10235  extern void clear_page(unsigned long page);
10236 -extern void copy_page(unsigned long to, unsigned long from);
10237 +#define copy_page(to,from)     memcpy((void *)(to), (void *)(from), PAGE_SIZE)
10238  
10239  /* map phys->virtual and virtual->phys for RAM pages */
10240  #ifdef CONFIG_APUS
10241 diff -urN linux.orig/include/asm-ppc/pf-compat.h linux/include/asm-ppc/pf-compat.h
10242 --- linux.orig/include/asm-ppc/pf-compat.h      Thu Jan  1 01:00:00 1970
10243 +++ linux/include/asm-ppc/pf-compat.h   Thu Jul 11 15:43:30 2002
10244 @@ -0,0 +1,2 @@
10245 +#define PF_TRACESYS    0x00000020      /* tracing system calls */
10246 +#define PF_PTRACED     0x00000010      /* set if ptrace (0) has been called */
This page took 0.851727 seconds and 3 git commands to generate.