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