* Re: powerpc 476, Little-endian, pte fault
2011-10-31 11:23 ` Benjamin Herrenschmidt
@ 2011-11-01 3:02 ` Santosh Kumar
2011-11-01 13:44 ` Peter Bergner
0 siblings, 1 reply; 11+ messages in thread
From: Santosh Kumar @ 2011-11-01 3:02 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: Michael Neuling, linuxppc-dev, Ian Munsie, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2302 bytes --]
I have attached the patch with only the relevant changes.
The patch is not based on uLIBC patch.
Glibc doesnt support little endian for PPC, but after minor changes to
makefile i got it working. With the compiler i am using i could get
2.6.31 on ppc440 working. I am using the same compiler as 476 & 440
instruction is almost the same.
Thanks
Santosh Kumar .A
Vision without Action is a daydream... Action without Vision is a nightmare...
On 31 October 2011 16:53, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Mon, 2011-10-31 at 20:49 +1100, Michael Neuling wrote:
>> > I have built a cross compiler for ppc440 in little endian mode and
>> > using it to build the kernel.
>> >
>> > Yes i am running Linux in Little-Endian. This is the first user space
>> > process. I wrote the below program and running it as init from
>> > /sbin/init. I have also set the permissions with chmod +s.
>> >
>> > main()
>> > {
>> >
>> > while(1){
>> > printf("hello world");
>> > sleep(1);
>> > }
>> > }
>>
>> Does libc even support little endian on PPC?
>
> Ian did a port a while back for uClibc, is that at least partially based
> on it ?
>
>> > I have attached the patch.
>>
>> This is a pretty huge patch:
>>
>> 115 files changed, 44479 insertions(+), 7398 deletions(-)
>>
>> It seems to include a new platform as well as a bunch of unrelated junk.
>>
>> I suggest you need to break this down into something more digestible.
>> Like remove all the junk in the patch. Then add the support for the new
>> platform (invader? platform). Then start looking at little endian.
>> Unless you do this, it's unlikely anyone here is going to be able to
>> help.
>>
>> When you get to the little endian work, you might want to take a look at
>> this patch series from Ian Munsie:
>>
>> http://lists.ozlabs.org/pipermail/linuxppc-dev/2010-October/086165.html
>
> Right, the new patch should be if possible based on Ian's series or at
> least a cleaned / rebased variant of it. Then split in bits so we can
> review it properly.
>
> Cheers,
> Ben.
>
>> Mikey
>> _______________________________________________
>> Linuxppc-dev mailing list
>> Linuxppc-dev@lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
>
>
[-- Attachment #2: linux_ppc_476.patch --]
[-- Type: application/octet-stream, Size: 42386 bytes --]
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/boot/div64.S ../linux-2.6.39.4/arch/powerpc/boot/div64.S
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/boot/div64.S 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/boot/div64.S 2011-10-22 14:16:46.616117143 +0530
@@ -17,8 +17,13 @@
.globl __div64_32
__div64_32:
+#ifdef CONFIG_INVADER
+ lwz r5,4(r3) # get the dividend into r5/r6
+ lwz r6,0(r3)
+#else
lwz r5,0(r3) # get the dividend into r5/r6
lwz r6,4(r3)
+#endif
cmplw r5,r4
li r7,0
li r8,0
@@ -53,7 +58,12 @@
mullw r10,r0,r4 # and get the remainder
add r8,r8,r0
subf r6,r10,r6
+#ifdef CONFIG_INVADER
4: stw r7,0(r3) # return the quotient in *r3
stw r8,4(r3)
+#else
+4: stw r7,0(r3) # return the quotient in *r3
+ stw r8,4(r3)
+#endif
mr r3,r6 # return the remainder in r3
blr
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/boot/Makefile ../linux-2.6.39.4/arch/powerpc/boot/Makefile
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/boot/Makefile 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/boot/Makefile 2011-10-22 06:47:05.354137527 +0530
@@ -37,7 +37,7 @@
DTC_FLAGS ?= -p 1024
-$(obj)/4xx.o: BOOTCFLAGS += -mcpu=405
+$(obj)/4xx.o: BOOTCFLAGS += -mcpu=440
$(obj)/ebony.o: BOOTCFLAGS += -mcpu=405
$(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405
$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/boot/wrapper ../linux-2.6.39.4/arch/powerpc/boot/wrapper
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/boot/wrapper 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/boot/wrapper 2011-10-22 06:38:26.286134445 +0530
@@ -38,6 +38,7 @@
dts=
cacheit=
binary=
+gzip=
gzip=.gz
# cross-compilation prefix
@@ -50,7 +51,6 @@
object=arch/powerpc/boot
objbin=$object
dtc=scripts/dtc/dtc
-
# directory for working files
tmpdir=.
@@ -260,7 +260,6 @@
vmz="$vmz.$$"
fi
fi
-
vmz="$vmz$gzip"
# Extract kernel version information, some platforms want to include
@@ -277,12 +276,13 @@
case "$platform" in
uboot)
rm -f "$ofile"
- ${MKIMAGE} -A ppc -O linux -T kernel -C gzip -a $membase -e $membase \
+ ${MKIMAGE} -A ppc -O linux -T kernel -a $membase -e $membase \
$uboot_version -d "$vmz" "$ofile"
if [ -z "$cacheit" ]; then
rm -f "$vmz"
fi
exit 0
+ echo "not exiting"
;;
esac
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/include/asm/bitops.h ../linux-2.6.39.4/arch/powerpc/include/asm/bitops.h
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/include/asm/bitops.h 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/include/asm/bitops.h 2011-10-22 06:38:25.203141637 +0530
@@ -318,13 +318,34 @@
return __test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
}
+static inline unsigned long find_next_zero_bit_le(const void *addr,
+ unsigned long size, unsigned long offset)
+{
+ return find_next_zero_bit(addr, size, offset);
+}
+
+static inline unsigned long find_next_bit_le(const void *addr,
+ unsigned long size, unsigned long offset)
+{
+ return find_next_bit(addr, size, offset);
+}
+
+static inline unsigned long find_first_zero_bit_le(const void *addr,
+ unsigned long size)
+{
+ return find_first_zero_bit(addr, size);
+}
+
#define find_first_zero_bit_le(addr, size) \
find_next_zero_bit_le((addr), (size), 0)
+/*
unsigned long find_next_zero_bit_le(const void *addr,
unsigned long size, unsigned long offset);
unsigned long find_next_bit_le(const void *addr,
unsigned long size, unsigned long offset);
+*/
+
/* Bitmap functions for the ext2 filesystem */
#define ext2_set_bit_atomic(lock, nr, addr) \
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/include/asm/byteorder.h ../linux-2.6.39.4/arch/powerpc/include/asm/byteorder.h
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/include/asm/byteorder.h 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/include/asm/byteorder.h 2011-10-22 06:38:25.254182204 +0530
@@ -7,6 +7,12 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
+
+#ifdef CONFIG_INVADER
+#include <linux/byteorder/little_endian.h>
+#else
#include <linux/byteorder/big_endian.h>
+#endif
+
#endif /* _ASM_POWERPC_BYTEORDER_H */
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/include/asm/elf.h ../linux-2.6.39.4/arch/powerpc/include/asm/elf.h
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/include/asm/elf.h 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/include/asm/elf.h 2011-10-22 06:38:25.140139532 +0530
@@ -118,13 +118,21 @@
# define ELF_GREG_TYPE elf_greg_t32
# define ELF_ARCH EM_PPC
# define ELF_CLASS ELFCLASS32
+#ifdef CONFIG_INVADER
+# define ELF_DATA ELFDATA2LSB
+#else
# define ELF_DATA ELFDATA2MSB
+#endif
#endif /* __powerpc64__ */
#ifndef ELF_ARCH
# define ELF_ARCH EM_PPC64
# define ELF_CLASS ELFCLASS64
+#ifdef CONFIG_INVADER
+# define ELF_DATA ELFDATA2LSB
+#else
# define ELF_DATA ELFDATA2MSB
+#endif
typedef elf_greg_t64 elf_greg_t;
typedef elf_gregset_t64 elf_gregset_t;
#else
iff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/include/asm/pgtable-ppc32.h ../linux-2.6.39.4/arch/powerpc/include/asm/pgtable-ppc32.h
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/include/asm/pgtable-ppc32.h 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/include/asm/pgtable-ppc32.h 2011-10-28 13:54:33.350779238 +0530
@@ -63,8 +63,12 @@
#ifdef CONFIG_HIGHMEM
#define KVIRT_TOP PKMAP_BASE
#else
+#ifdef CONFIG_INVADER
+#define KVIRT_TOP (0xbe000000UL)
+#else
#define KVIRT_TOP (0xfe000000UL) /* for now, could be FIXMAP_BASE ? */
#endif
+#endif
/*
* ioremap_bot starts at that address. Early ioremaps move down from there,
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/include/asm/prom.h ../linux-2.6.39.4/arch/powerpc/include/asm/prom.h
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/include/asm/prom.h 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/include/asm/prom.h 2011-10-22 06:38:25.211141792 +0530
@@ -20,6 +20,10 @@
#include <asm/irq.h>
#include <asm/atomic.h>
+#ifdef CONFIG_INVADER
+#include <asm/io.h>
+#endif
+
#define HAVE_ARCH_DEVTREE_FIXUPS
#ifdef CONFIG_PPC32
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/include/asm/reg.h ../linux-2.6.39.4/arch/powerpc/include/asm/reg.h
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/include/asm/reg.h 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/include/asm/reg.h 2011-10-22 06:38:25.222139709 +0530
@@ -839,7 +839,11 @@
#define PVR_403GC 0x00200200
#define PVR_403GCX 0x00201400
#define PVR_405GP 0x40110000
+#ifdef CONFIG_INVADER
+#define PVR_476 0x7ff52080
+#else
#define PVR_476 0x11a52000
+#endif
#define PVR_STB03XXX 0x40310000
#define PVR_NP405H 0x41410000
#define PVR_NP405L 0x41610000
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/cacheinfo.c ../linux-2.6.39.4/arch/powerpc/kernel/cacheinfo.c
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/cacheinfo.c 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/kernel/cacheinfo.c 2011-10-24 17:02:11.354148243 +0530
@@ -203,7 +203,12 @@
if (!cache_size)
return -ENODEV;
+ printk("cache size: 0x%u\n", be32_to_cpup(cache_size));
+#ifdef CONFIG_INVADER
+ *ret = be32_to_cpup(cache_size);
+#else
*ret = *cache_size;
+#endif
return 0;
}
@@ -238,7 +243,12 @@
if (!line_size)
return -ENODEV;
+ printk("lne size: 0x%u\n", be32_to_cpup(line_size));
+#ifdef CONFIG_INVADER
+ *ret = be32_to_cpup(line_size);
+#else
*ret = *line_size;
+#endif
return 0;
}
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/cputable.c ../linux-2.6.39.4/arch/powerpc/kernel/cputable.c
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/cputable.c 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/kernel/cputable.c 2011-10-22 06:38:27.763108473 +0530
@@ -1853,6 +1853,22 @@
.machine_check = machine_check_47x,
.platform = "ppc470",
},
+#ifdef CONFIG_INVADER
+ { /* 476 others */
+ .pvr_mask = 0xffffffff,
+ .pvr_value = 0x7ff52080,
+ .cpu_name = "476fp",
+ .cpu_features = CPU_FTRS_47X,
+ .cpu_user_features = COMMON_USER_BOOKE |
+ PPC_FEATURE_HAS_FPU,
+ .mmu_features = MMU_FTR_TYPE_47x |
+ MMU_FTR_USE_TLBIVAX_BCAST | MMU_FTR_LOCK_BCAST_INVAL,
+ .icache_bsize = 32,
+ .dcache_bsize = 32,
+ .machine_check = machine_check_47x,
+ .platform = "ppc470",
+ },
+#endif
{ /* default match */
.pvr_mask = 0x00000000,
.pvr_value = 0x00000000,
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/head_44x.S ../linux-2.6.39.4/arch/powerpc/kernel/head_44x.S
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/head_44x.S 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/kernel/head_44x.S 2011-10-30 16:00:57.409103255 +0530
@@ -259,8 +259,14 @@
/* Compute pte address */
rlwimi r12, r10, PPC44x_PTE_ADD_SHIFT, PPC44x_PTE_ADD_MASK_BIT, 28
+
+#ifdef CONFIG_INVADER
+ lwz r11, 4(r12) /* Get high word of pte entry */
+ lwz r12, 0(r12) /* Get low word of pte entry */
+#else
lwz r11, 0(r12) /* Get high word of pte entry */
lwz r12, 4(r12) /* Get low word of pte entry */
+#endif
lis r10,tlb_44x_index@ha
@@ -355,8 +361,13 @@
/* Compute pte address */
rlwimi r12, r10, PPC44x_PTE_ADD_SHIFT, PPC44x_PTE_ADD_MASK_BIT, 28
+#ifdef CONFIG_INVADER
+ lwz r11, 4(r12) /* Get high word of pte entry */
+ lwz r12, 0(r12) /* Get low word of pte entry */
+#else
lwz r11, 0(r12) /* Get high word of pte entry */
lwz r12, 4(r12) /* Get low word of pte entry */
+#endif
lis r10,tlb_44x_index@ha
@@ -508,8 +519,12 @@
/* Compute pte address */
rlwimi r12,r10,PPC44x_PTE_ADD_SHIFT,PPC44x_PTE_ADD_MASK_BIT,28
beq 2f /* Bail if no table */
- lwz r11,0(r12) /* Get high word of pte entry */
+#ifdef CONFIG_INVADER
+ lwz r11,4(r12) /* Get high word of pte entry */
+#else
+ lwz r11,0(r12) /* Get high word of pte entry */
+#endif
/* XXX can we do better ? maybe insert a known 0 bit from r11 into the
* bottom of r12 to create a data dependency... We can also use r10
* as destination nowadays
@@ -517,8 +532,12 @@
#ifdef CONFIG_SMP
lwsync
#endif
- lwz r12,4(r12) /* Get low word of pte entry */
+#ifdef CONFIG_INVADER
+ lwz r12,0(r12) /* Get low word of pte entry */
+#else
+ lwz r12,4(r12) /* Get low word of pte entry */
+#endif
andc. r13,r13,r12 /* Check permission */
/* Jump to common tlb load */
@@ -592,15 +611,23 @@
rlwimi r12,r10,PPC44x_PTE_ADD_SHIFT,PPC44x_PTE_ADD_MASK_BIT,28
beq 2f /* Bail if no table */
+#ifdef CONFIG_INVADER
+ lwz r11,4(r12) /* Get high word of pte entry */
+#else
lwz r11,0(r12) /* Get high word of pte entry */
+#endif
/* XXX can we do better ? maybe insert a known 0 bit from r11 into the
* bottom of r12 to create a data dependency... We can also use r10
* as destination nowadays
*/
-#ifdef CONFIG_SMP
+#ifndef CONFIG_SMP
lwsync
#endif
+#ifdef CONFIG_INVADER
+ lwz r11,0(r12) /* Get high word of pte entry */
+#else
lwz r12,4(r12) /* Get low word of pte entry */
+#endif
andc. r13,r13,r12 /* Check permission */
@@ -638,8 +665,12 @@
rlwimi r10,r12,29,30,30 /* DIRTY -> SW position */
and r11,r12,r10 /* Mask PTE bits to keep */
andi. r10,r12,_PAGE_USER /* User page ? */
+#ifdef CONFIG_INVADER
+ ori r11,r11,PPC47x_TLB2_E
+#endif
beq 1f /* nope, leave U bits empty */
rlwimi r11,r11,3,26,28 /* yes, copy S bits to U */
+
1: tlbwe r11,r13,2
/* Done...restore registers and get out of here.
@@ -935,6 +966,13 @@
*/
head_start_47x:
+// .align
+ nop
+ nop
+ nop
+
+ li r3, 0x3
+ rlwinm r23, r3, 1, 31, 31
/* Load our current PID->MMUCR TID and MSR IS->MMUCR STS */
mfspr r3,SPRN_PID /* Get PID */
mfmsr r4 /* Get MSR */
@@ -964,8 +1002,7 @@
clear_all_utlb_entries:
#; Set initial values.
-
- addis r3,0,0x8000
+ addis r3,0,0xa000 /* Invader change: quick fix?? */
addi r4,0,0
addi r5,0,0
b clear_utlb_entry
@@ -976,6 +1013,7 @@
clear_utlb_entry:
+// isync //not needed ??
tlbwe r4,r3,0
tlbwe r5,r3,1
tlbwe r5,r3,2
@@ -987,12 +1025,15 @@
cmpwi r4,0
bne clear_utlb_entry
- #; Restore original entry.
+ #; Restore original entry.
+#ifndef CONFIG_INVDER
+// Invader change
oris r23,r23,0x8000 /* specify the way */
tlbwe r24,r23,0
tlbwe r25,r23,1
tlbwe r26,r23,2
+#endif
/*
* Configure and load pinned entry into TLB for the kernel core
@@ -1018,7 +1059,12 @@
/* ERPN is 0 for first 4GB page */
/* Word 2 */
li r5,0
+#ifdef CONFIG_INVADER
+ ori r5,r5,(PPC47x_TLB2_S_RWX|PPC47x_TLB2_E)
+#else
ori r5,r5,PPC47x_TLB2_S_RWX
+#endif
+
#ifdef CONFIG_SMP
ori r5,r5,PPC47x_TLB2_M
#endif
@@ -1062,14 +1108,19 @@
/* Word 0 */
lis r3,PPC44x_EARLY_DEBUG_VIRTADDR@h
- ori r3,r3,PPC47x_TLB0_VALID | PPC47x_TLB0_TS | PPC47x_TLB0_1M
+ ori r3,r3, (PPC47x_TLB0_VALID | PPC47x_TLB0_TS | PPC47x_TLB0_1M)
/* Word 1 */
lis r4,CONFIG_PPC_EARLY_DEBUG_44x_PHYSLOW@h
ori r4,r4,CONFIG_PPC_EARLY_DEBUG_44x_PHYSHIGH
- /* Word 2 */
+#ifdef CONFIG_INVADER
+ /* Removing M flag as there is no SMP support for now*/
+ li r5,(PPC47x_TLB2_S_RW | PPC47x_TLB2_I | PPC47x_TLB2_G | PPC47x_TLB2_E)
+
+#else
li r5,(PPC47x_TLB2_S_RW | PPC47x_TLB2_IMG)
+#endif
/* Bolted in way 0, bolt slot 5, we -hope- we don't hit the same
* congruence class as the kernel, we need to make sure of it at
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/irq.c ../linux-2.6.39.4/arch/powerpc/kernel/irq.c
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/irq.c 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/kernel/irq.c 2011-10-24 16:36:08.295113827 +0530
@@ -757,7 +757,11 @@
/* If host has no translation, then we assume interrupt line */
if (host->ops->xlate == NULL)
+#ifdef CONFIG_INVADER
+ hwirq = be32_to_cpu(intspec[0]);
+#else
hwirq = intspec[0];
+#endif
else {
if (host->ops->xlate(host, controller, intspec, intsize,
&hwirq, &type))
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/misc_32.S ../linux-2.6.39.4/arch/powerpc/kernel/misc_32.S
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/misc_32.S 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/kernel/misc_32.S 2011-10-26 15:51:22.562068744 +0530
@@ -60,6 +60,32 @@
/*
* This returns the high 64 bits of the product of two 64-bit numbers.
*/
+
+#ifdef CONFIG_INVADER
+_GLOBAL(mulhdu)
+ cmpwi r5,0
+ cmpwi cr1,r4,0
+ mr r10,r3
+ mulhwu r3,r3,r6
+ beq 1f
+ mulhwu r0,r10,r5
+ mullw r7,r10,r6
+ addc r7,r0,r7
+ addze r3,r3
+1: beqlr cr1 /* all done if high part of A is 0 */
+ mr r10,r4
+ mullw r9,r4,r6
+ mulhwu r4,r4,r6
+ beq 2f
+ mullw r0,r10,r5
+ mulhwu r8,r10,r5
+ addc r7,r0,r7
+ adde r3,r3,r8
+ addze r4,r4
+2: addc r3,r3,r9
+ addze r4,r4
+ blr
+#else
_GLOBAL(mulhdu)
cmpwi r6,0
cmpwi cr1,r3,0
@@ -83,6 +109,7 @@
2: addc r4,r4,r9
addze r3,r3
blr
+#endif
/*
* sub_reloc_offset(x) returns x - reloc_offset().
@@ -605,6 +632,42 @@
* lshrdi3: logical right shift
* ashldi3: left shift
*/
+#ifdef CONFIG_INVADER
+_GLOBAL(__ashrdi3)
+ subfic r6,r5,32
+ srw r3,r3,r5 # LSW = count > 31 ? 0 : LSW >> count
+ addi r7,r5,32 # could be xori, or addi with -32
+ slw r6,r4,r6 # t1 = count > 31 ? 0 : MSW << (32-count)
+ rlwinm r8,r7,0,32 # t3 = (count < 32) ? 32 : 0
+ sraw r7,r4,r7 # t2 = MSW >> (count-32)
+ or r3,r3,r6 # LSW |= t1
+ slw r7,r7,r8 # t2 = (count < 32) ? 0 : t2
+ sraw r4,r4,r5 # MSW = MSW >> count
+ or r3,r3,r7 # LSW |= t2
+ blr
+
+_GLOBAL(__ashldi3)
+ subfic r6,r5,32
+ slw r4,r4,r5 # MSW = count > 31 ? 0 : MSW << count
+ addi r7,r5,32 # could be xori, or addi with -32
+ srw r6,r3,r6 # t1 = count > 31 ? 0 : LSW >> (32-count)
+ slw r7,r3,r7 # t2 = count < 32 ? 0 : LSW << (count-32)
+ or r4,r4,r6 # MSW |= t1
+ slw r3,r3,r5 # LSW = LSW << count
+ or r4,r4,r7 # MSW |= t2
+ blr
+
+_GLOBAL(__lshrdi3)
+ subfic r6,r5,32
+ srw r3,r3,r5 # LSW = count > 31 ? 0 : LSW >> count
+ addi r7,r5,32 # could be xori, or addi with -32
+ slw r6,r4,r6 # t1 = count > 31 ? 0 : MSW << (32-count)
+ srw r7,r4,r7 # t2 = count < 32 ? 0 : MSW >> (count-32)
+ or r3,r3,r6 # LSW |= t1
+ srw r4,r4,r5 # MSW = MSW >> count
+ or r3,r3,r7 # LSW |= t2
+ blr
+#else
_GLOBAL(__ashrdi3)
subfic r6,r5,32
srw r4,r4,r5 # LSW = count > 31 ? 0 : LSW >> count
@@ -639,6 +702,7 @@
srw r3,r3,r5 # MSW = MSW >> count
or r4,r4,r7 # LSW |= t2
blr
+#endif
/*
* 64-bit comparison: __ucmpdi2(u64 a, u64 b)
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/module_32.c ../linux-2.6.39.4/arch/powerpc/kernel/module_32.c
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/module_32.c 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/kernel/module_32.c 2011-10-22 06:38:27.155103324 +0530
@@ -46,9 +46,15 @@
r_addend = 0;
for (i = 0; i < num; i++)
/* Only count 24-bit relocs, others don't need stubs */
+#ifdef CONFIG_INVADER
+ if ( ((ELF32_R_TYPE(rela[i].r_info) == R_PPC_REL24) && (ELF32_R_TYPE(rela[i].r_info) == R_PPC_REL14) &&
+ (r_info != ELF32_R_SYM(rela[i].r_info) ||
+ r_addend != rela[i].r_addend)) ) {
+#else
if (ELF32_R_TYPE(rela[i].r_info) == R_PPC_REL24 &&
(r_info != ELF32_R_SYM(rela[i].r_info) ||
r_addend != rela[i].r_addend)) {
+#endif
_count_relocs++;
r_info = ELF32_R_SYM(rela[i].r_info);
r_addend = rela[i].r_addend;
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/prom.c ../linux-2.6.39.4/arch/powerpc/kernel/prom.c
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/prom.c 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/kernel/prom.c 2011-10-22 12:32:28.777113831 +0530
@@ -103,6 +103,8 @@
memcpy(p, initial_boot_params, size);
initial_boot_params = (struct boot_param_header *)p;
DBG("Moved device tree to 0x%p\n", p);
+// invader debug
+ printk("Moved device tree to 0x%p\n", p);
}
DBG("<- move_device_tree\n");
@@ -300,7 +302,7 @@
*/
if (initial_boot_params && initial_boot_params->version >= 2) {
if (intserv[i] ==
- initial_boot_params->boot_cpuid_phys) {
+ be32_to_cpu(initial_boot_params->boot_cpuid_phys)) {
found = 1;
break;
}
@@ -344,8 +346,14 @@
* it uses 0x0f000001.
*/
prop = of_get_flat_dt_prop(node, "cpu-version", NULL);
+ printk(KERN_DEBUG "INVADER PVR: 0x%x\n", be32_to_cpup(prop));
+#ifdef CONFIG_INVADER
+ if (prop && (be32_to_cpup(prop) & 0xff000000) == 0x0f000000)
+ identify_cpu(0, be32_to_cpup(prop));
+#else
if (prop && (*prop & 0xff000000) == 0x0f000000)
identify_cpu(0, *prop);
+#endif
identical_pvr_fixup(node);
}
@@ -478,6 +486,7 @@
if ((base + size) > 0x80000000ul)
size = 0x80000000ul - base;
}
+ printk(KERN_DEBUG "memblk Add1 base: 0x%llx, size: 0x%llx", base, size);
memblock_add(base, size);
} while (--rngs);
}
@@ -516,6 +525,7 @@
memstart_addr = min((u64)memstart_addr, base);
/* Add the chunk to the MEMBLOCK list */
+ printk(KERN_DEBUG "memblk Add2 base: 0x%llx, size: 0x%llx", base, size);
memblock_add(base, size);
}
@@ -541,12 +551,18 @@
unsigned long self_base;
unsigned long self_size;
+ // Invader Change
reserve_map = (u64 *)(((unsigned long)initial_boot_params) +
+#ifdef CONFIG_INVADER
+ be32_to_cpu(initial_boot_params->off_mem_rsvmap));
+#else
initial_boot_params->off_mem_rsvmap);
+#endif
/* before we do anything, lets reserve the dt blob */
self_base = __pa((unsigned long)initial_boot_params);
- self_size = initial_boot_params->totalsize;
+ self_size = be32_to_cpu(initial_boot_params->totalsize);
+
memblock_reserve(self_base, self_size);
#ifdef CONFIG_BLK_DEV_INITRD
@@ -560,13 +576,18 @@
* Handle the case where we might be booting from an old kexec
* image that setup the mem_rsvmap as pairs of 32-bit values
*/
- if (*reserve_map > 0xffffffffull) {
+ if (be64_to_cpu(*reserve_map) > 0xffffffffull) {
u32 base_32, size_32;
u32 *reserve_map_32 = (u32 *)reserve_map;
while (1) {
+#ifdef CONFIG_INVADER
+ base_32 = be32_to_cpu(*(reserve_map_32++));
+ size_32 = be32_to_cpu(*(reserve_map_32++));
+#else
base_32 = *(reserve_map_32++);
size_32 = *(reserve_map_32++);
+#endif
if (size_32 == 0)
break;
/* skip if the reservation is for the blob */
@@ -579,11 +600,17 @@
}
#endif
while (1) {
+// Invader Changes
+#ifdef CONFIG_INVADER
+ base = be64_to_cpu(*(reserve_map++));
+ size = be64_to_cpu(*(reserve_map++));
+#else
base = *(reserve_map++);
size = *(reserve_map++);
+#endif
if (size == 0)
break;
- DBG("reserving: %llx -> %llx\n", base, size);
+ DBG("reserving2: %llx -> %llx\n", base, size);
memblock_reserve(base, size);
}
}
@@ -912,8 +939,8 @@
{
struct dentry *d;
- flat_dt_blob.data = initial_boot_params;
- flat_dt_blob.size = initial_boot_params->totalsize;
+ flat_dt_blob.data = (initial_boot_params);
+ flat_dt_blob.size = be32_to_cpu(initial_boot_params->totalsize);
d = debugfs_create_blob("flat-device-tree", S_IFREG | S_IRUSR,
powerpc_debugfs_root, &flat_dt_blob);
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/prom_init.c ../linux-2.6.39.4/arch/powerpc/kernel/prom_init.c
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/prom_init.c 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/kernel/prom_init.c 2011-10-22 06:38:27.610103651 +0530
@@ -789,7 +789,11 @@
} fake_elf = {
.elfhdr = {
.e_ident = { 0x7f, 'E', 'L', 'F',
+#ifdef CONFIG_INVADER
+ ELFCLASS32, ELFDATA2LSB, EV_CURRENT },
+#else
ELFCLASS32, ELFDATA2MSB, EV_CURRENT },
+#endif
.e_type = ET_EXEC, /* yeah right */
.e_machine = EM_PPC,
.e_version = EV_CURRENT,
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/vmlinux.lds.S ../linux-2.6.39.4/arch/powerpc/kernel/vmlinux.lds.S
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/kernel/vmlinux.lds.S 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/kernel/vmlinux.lds.S 2011-10-22 06:38:27.713103244 +0530
@@ -34,11 +34,15 @@
jiffies = jiffies_64;
#else
OUTPUT_ARCH(powerpc:common)
+#ifdef CONFIG_INVADER
jiffies = jiffies_64 + 4;
+#else
+jiffies = jiffies_64 + 4;
+#endif
#endif
SECTIONS
{
- . = 0;
+ . = 0x00;
reloc_start = .;
. = KERNELBASE;
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/lib/div64.S ../linux-2.6.39.4/arch/powerpc/lib/div64.S
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/lib/div64.S 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/lib/div64.S 2011-10-22 06:38:28.053112501 +0530
@@ -17,8 +17,13 @@
#include <asm/processor.h>
_GLOBAL(__div64_32)
+#ifdef CONFIG_INVADER
+ lwz r5,4(r3) # get the dividend into r5/r6
+ lwz r6,0(r3)
+#else
lwz r5,0(r3) # get the dividend into r5/r6
lwz r6,4(r3)
+#endif
cmplw r5,r4
li r7,0
li r8,0
@@ -53,7 +58,12 @@
mullw r10,r0,r4 # and get the remainder
add r8,r8,r0
subf r6,r10,r6
+#ifdef CONFIG_INVADER
+4: stw r7,4(r3) # return the quotient in *r3
+ stw r8,0(r3)
+#else
4: stw r7,0(r3) # return the quotient in *r3
stw r8,4(r3)
+#endif
mr r3,r6 # return the remainder in r3
blr
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/Makefile ../linux-2.6.39.4/arch/powerpc/Makefile
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/Makefile 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/Makefile 2011-10-22 06:42:29.464137538 +0530
@@ -17,8 +17,8 @@
# Set default 32 bits cross compilers for vdso and boot wrapper
CROSS32_COMPILE ?=
-CROSS32CC := $(CROSS32_COMPILE)gcc
-CROSS32AR := $(CROSS32_COMPILE)ar
+CROSS32CC := $(CROSS32_COMPILE)gcc -mlittle-endian -mno-mfcrf
+CROSS32AR := $(CROSS32_COMPILE)ar -EL
ifeq ($(HAS_BIARCH),y)
ifeq ($(CROSS32_COMPILE),)
@@ -57,9 +57,9 @@
UTS_MACHINE := $(OLDARCH)
ifeq ($(HAS_BIARCH),y)
-override AS += -a$(CONFIG_WORD_SIZE)
-override LD += -m elf$(CONFIG_WORD_SIZE)ppc
-override CC += -m$(CONFIG_WORD_SIZE)
+override AS += -a$(CONFIG_WORD_SIZE) -mlittle-endian
+override LD += -m elf$(CONFIG_WORD_SIZE)ppc -EL
+override CC += -m$(CONFIG_WORD_SIZE) -mlittle-endian -mno-mfcrf
override AR := GNUTARGET=elf$(CONFIG_WORD_SIZE)-powerpc $(AR)
endif
@@ -68,10 +68,10 @@
LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-yy)
CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc
-CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiple
+CFLAGS-$(CONFIG_PPC32) := -ffixed-r2
KBUILD_CPPFLAGS += -Iarch/$(ARCH)
KBUILD_AFLAGS += -Iarch/$(ARCH)
-KBUILD_CFLAGS += -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y)
+KBUILD_CFLAGS += -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y)
CPP = $(CC) -E $(KBUILD_CFLAGS)
CHECKFLAGS += -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__
@@ -119,7 +119,7 @@
# Never use string load/store instructions as they are
# often slow when they are implemented at all
-KBUILD_CFLAGS += -mno-string
+#KBUILD_CFLAGS += -mno-string
ifeq ($(CONFIG_6xx),y)
KBUILD_CFLAGS += -mcpu=powerpc
@@ -130,7 +130,7 @@
KBUILD_CFLAGS += -mno-sched-epilog
endif
-cpu-as-$(CONFIG_4xx) += -Wa,-m405
+cpu-as-$(CONFIG_4xx) += -Wa,-m440
cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
cpu-as-$(CONFIG_POWER4) += -Wa,-maltivec
cpu-as-$(CONFIG_E500) += -Wa,-me500
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/mm/44x_mmu.c ../linux-2.6.39.4/arch/powerpc/mm/44x_mmu.c
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/mm/44x_mmu.c 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/mm/44x_mmu.c 2011-10-24 17:26:29.012226884 +0530
@@ -165,7 +165,12 @@
"tlbwe %0,%3,2\n"
:
: "r" (PPC47x_TLB2_SW | PPC47x_TLB2_SR |
+#ifdef CONFIG_INVADER
+ PPC47x_TLB2_SX | PPC47x_TLB2_E
+#else
PPC47x_TLB2_SX
+#endif
+
#ifdef CONFIG_SMP
| PPC47x_TLB2_M
#endif
@@ -223,6 +228,7 @@
*/
BUG_ON(first_memblock_base != 0);
+ printk(KERN_DEBUG "setup_initial_memory_limit: 0x%llx, 0x%llx\n", first_memblock_base, first_memblock_size);
/* 44x has a 256M TLB entry pinned at boot */
memblock_set_current_limit(min_t(u64, first_memblock_size, PPC_PIN_SIZE));
}
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/platforms/invader/invader_setup.c ../linux-2.6.39.4/arch/powerpc/platforms/invader/invader_setup.c
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/platforms/invader/invader_setup.c 1970-01-01 05:30:00.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/platforms/invader/invader_setup.c 2011-10-24 15:53:49.024532082 +0530
@@ -0,0 +1,87 @@
+/*
+ LSI HEADER ???
+*/
+
+#include <linux/init.h>
+#include <linux/of_platform.h>
+
+#include <asm/machdep.h>
+#include <asm/prom.h>
+#include <asm/udbg.h>
+#include <asm/time.h>
+#include <asm/mpic.h>
+#include <asm/ppc4xx.h>
+#include <asm/irq.h>
+#include <asm/pci-bridge.h>
+
+#define DEBUG 1
+
+static struct of_device_id invader_of_bus_ids[] = {
+ { .compatible = "ibm,plb6", },
+ { .compatible = "simple-bus", },
+ { .compatible = "chrp,open-pic", },
+ {},
+};
+
+static int __init invader_device_probe(void)
+{
+ of_platform_bus_probe(NULL, invader_of_bus_ids, NULL);
+
+ return 0;
+}
+machine_device_initcall(invader, invader_device_probe);
+
+static int __init invader_probe(void)
+{
+ unsigned long root = of_get_flat_dt_root();
+
+ if (!of_flat_dt_is_compatible(root, "LSI,Invader"))
+ return 0;
+
+ ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC);
+
+ return 1;
+}
+
+static void __init invader_init_irq(void)
+{
+ struct mpic *mpic;
+ struct resource r;
+ struct device_node *np = NULL;
+
+ /* Find top level interrupt controller */
+ for_each_node_with_property(np, "interrupt-controller") {
+ if (of_get_property(np, "interrupts", NULL) == NULL)
+ break;
+ }
+ if (np == NULL)
+ panic("Invader: Can't find top level interrupt controller");
+
+ if (of_device_is_compatible(np, "chrp,open-pic")) {
+ /* The MPIC driver will get everything it needs from the
+ * device-tree, just pass 0 to all arguments
+ */
+ mpic = mpic_alloc(np, 0, MPIC_PRIMARY|MPIC_WANTS_RESET, 0, 0, " MPIC ");
+ BUG_ON(mpic == NULL);
+ mpic_init(mpic);
+ ppc_md.get_irq = mpic_get_irq;
+ } else
+ panic("Invader: Unrecognized top level interrupt controller");
+
+ printk("\n\n\t\t\tMPIC initialized\n\n\n");
+}
+
+static void __init invader_progress(char *s, unsigned short hex)
+{
+ printk("*** %04x : %s\n", hex, s ? s : "");
+}
+
+define_machine(invader) {
+ .name = "Invader",
+ .probe = invader_probe,
+ .progress = invader_progress,
+ .init_IRQ = invader_init_irq,
+ .get_irq = mpic_get_irq,
+ .calibrate_decr = generic_calibrate_decr,
+ .restart = ppc4xx_reset_system,
+};
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/platforms/invader/Kconfig ../linux-2.6.39.4/arch/powerpc/platforms/invader/Kconfig
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/platforms/invader/Kconfig 1970-01-01 05:30:00.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/platforms/invader/Kconfig 2011-10-22 06:38:25.833134467 +0530
@@ -0,0 +1,8 @@
+config INVADER
+ bool "Invader"
+ depends on PPC_47x
+ help
+ This option enabled support for LSI PPC476 "Invader"
+ evaluation board.
+
+
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/platforms/invader/Makefile ../linux-2.6.39.4/arch/powerpc/platforms/invader/Makefile
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/platforms/invader/Makefile 1970-01-01 05:30:00.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/platforms/invader/Makefile 2011-10-22 06:38:25.828374811 +0530
@@ -0,0 +1 @@
+obj-$(CONFIG_INVADER) += invader_setup.o
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/platforms/Kconfig ../linux-2.6.39.4/arch/powerpc/platforms/Kconfig
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/platforms/Kconfig 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/platforms/Kconfig 2011-10-22 06:38:26.083147732 +0530
@@ -20,6 +20,7 @@
source "arch/powerpc/platforms/44x/Kconfig"
source "arch/powerpc/platforms/40x/Kconfig"
source "arch/powerpc/platforms/amigaone/Kconfig"
+source "arch/powerpc/platforms/invader/Kconfig"
config KVM_GUEST
bool "KVM Guest support"
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/platforms/Makefile ../linux-2.6.39.4/arch/powerpc/platforms/Makefile
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/platforms/Makefile 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/platforms/Makefile 2011-10-22 06:38:25.910151396 +0530
@@ -22,3 +22,4 @@
obj-$(CONFIG_PPC_PS3) += ps3/
obj-$(CONFIG_EMBEDDED6xx) += embedded6xx/
obj-$(CONFIG_AMIGAONE) += amigaone/
+obj-$(CONFIG_INVADER) += invader/
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/sysdev/dcr.c ../linux-2.6.39.4/arch/powerpc/sysdev/dcr.c
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/sysdev/dcr.c 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/sysdev/dcr.c 2011-10-24 16:41:24.331106125 +0530
@@ -133,7 +133,12 @@
if (dr == NULL || ds & 1 || index >= (ds / 8))
return 0;
+ printk(KERN_DEBUG " dcr-reg: 0x%x", be32_to_cpu(dr[index * 2]));
+#ifdef CONFIG_INVADER
+ return be32_to_cpu(dr[index * 2]);
+#else
return dr[index * 2];
+#endif
}
EXPORT_SYMBOL_GPL(dcr_resource_start);
@@ -145,7 +150,12 @@
if (dr == NULL || ds & 1 || index >= (ds / 8))
return 0;
+ printk(KERN_DEBUG " dcr-reg2: 0x%x", be32_to_cpu(dr[index * 2]+1));
+#ifdef CONFIG_INVADER
+ return be32_to_cpu(dr[index * 2 + 1]);
+#else
return dr[index * 2 + 1];
+#endif
}
EXPORT_SYMBOL_GPL(dcr_resource_len);
@@ -177,6 +187,8 @@
/* Maybe could do some better range checking here */
ret = of_translate_address(dp, p);
+
+ printk(KERN_DEBUG " translate-dcr-reg: 0x%llx", ret);
if (ret != OF_BAD_ADDR)
ret += (u64)(stride) * (u64)dcr_n;
if (out_stride)
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/sysdev/mpic.c ../linux-2.6.39.4/arch/powerpc/sysdev/mpic.c
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/sysdev/mpic.c 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/sysdev/mpic.c 2011-10-25 18:07:53.637770104 +0530
@@ -296,7 +296,7 @@
dbasep = of_get_property(node, "dcr-reg", NULL);
- rb->dhost = dcr_map(node, *dbasep + offset, size);
+ rb->dhost = dcr_map(node, be32_to_cpup(dbasep) + offset, size);
BUG_ON(!DCR_MAP_OK(rb->dhost));
}
@@ -1179,8 +1179,9 @@
*/
if (paddr == 0 && !(mpic->flags & MPIC_USES_DCR)) {
const u32 *reg = of_get_property(node, "reg", NULL);
+ printk(KERN_DEBUG "mpic: reg: 0x%x\n", *reg);
BUG_ON(reg == NULL);
- paddr = of_translate_address(node, reg);
+ paddr = be32_to_cpu(of_translate_address(node, reg));
BUG_ON(paddr == OF_BAD_ADDR);
}
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/sysdev/ppc4xx_soc.c ../linux-2.6.39.4/arch/powerpc/sysdev/ppc4xx_soc.c
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/arch/powerpc/sysdev/ppc4xx_soc.c 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/arch/powerpc/sysdev/ppc4xx_soc.c 2011-10-25 18:04:40.509769915 +0530
@@ -93,7 +93,11 @@
of_node_put(np);
return -ENODEV;
}
+#ifdef CONFIG_INVADER
+ l2_size = be32_to_cpu(prop[0]);
+#else
l2_size = prop[0];
+#endif
/* Map DCRs */
dcrreg = of_get_property(np, "dcr-reg", &len);
@@ -103,8 +107,13 @@
of_node_put(np);
return -ENODEV;
}
+#ifdef CONFIG_INVADER
+ dcrbase_isram = be32_to_cpu(dcrreg[0]);
+ dcrbase_l2c = be32_to_cpu(dcrreg[2]);
+#else
dcrbase_isram = dcrreg[0];
dcrbase_l2c = dcrreg[2];
+#endif
/* Get and map irq number from device tree */
irq = irq_of_parse_and_map(np, 0);
@@ -199,6 +208,7 @@
struct device_node *np;
u32 reset_type = DBCR0_RST_SYSTEM;
const u32 *prop;
+ u32 propVal=0;
np = of_find_node_by_type(NULL, "cpu");
if (np) {
@@ -210,8 +220,17 @@
* 2 - PPC4xx chip reset
* 3 - PPC4xx system reset (default)
*/
+#ifdef CONFIG_INVADER
+ if (prop)
+ {
+ propVal = be32_to_cpup(prop);
+ if (((propVal>= 1) && (propVal <= 3)))
+ reset_type = propVal << 28;
+ }
+#else
if ((prop) && ((prop[0] >= 1) && (prop[0] <= 3)))
reset_type = prop[0] << 28;
+#endif
}
mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | reset_type);
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/fs/ext2/balloc.c ../linux-2.6.39.4/fs/ext2/balloc.c
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/fs/ext2/balloc.c 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/fs/ext2/balloc.c 2011-10-22 06:38:04.625107806 +0530
@@ -18,6 +18,9 @@
#include <linux/buffer_head.h>
#include <linux/capability.h>
+#ifdef CONFIG_INVADER
+//#include <asm-generic/bitops/le.h>
+#endif
/*
* balloc.c contains the blocks allocation and deallocation routines
*/
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/include/asm-generic/bitops/non-atomic.h ../linux-2.6.39.4/include/asm-generic/bitops/non-atomic.h
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/include/asm-generic/bitops/non-atomic.h 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/include/asm-generic/bitops/non-atomic.h 2011-10-22 12:40:27.954406170 +0530
@@ -105,4 +105,25 @@
return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
}
+static inline int test_bit_dbg(int nr, const volatile unsigned long *addr, volatile unsigned long *ret, volatile unsigned long *ret1, volatile unsigned long *ret2)
+{
+ if(ret)
+ *ret = (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
+
+ if (ret1)
+ *ret1 = 1UL&(*ret);
+
+ if (ret2)
+ *ret2 = 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
+
+#ifdef CONFIG_INVADER
+ return (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
+#else
+ return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
+#endif
+}
+
+
+
+
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/init/main.c ../linux-2.6.39.4/init/main.c
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/init/main.c 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/init/main.c 2011-10-30 14:04:41.250103375 +0530
@@ -664,7 +664,8 @@
int count = preempt_count();
int ret;
- if (initcall_debug)
+// if (initcall_debug)
+ if (1)
ret = do_one_initcall_debug(fn);
else
ret = fn();
@@ -729,6 +730,7 @@
static void run_init_process(const char *init_filename)
{
argv_init[0] = init_filename;
+ printk(KERN_DEBUG "RUNNING run_init_process %s\n", init_filename);
kernel_execve(init_filename, argv_init, envp_init);
}
@@ -747,6 +749,7 @@
current->signal->flags |= SIGNAL_UNKILLABLE;
+ printk(KERN_DEBUG "ramdisk_execute_command: %s, execute_command: %s\n",ramdisk_execute_command ,execute_command);
if (ramdisk_execute_command) {
run_init_process(ramdisk_execute_command);
printk(KERN_WARNING "Failed to execute %s\n",
@@ -765,10 +768,10 @@
"defaults...\n", execute_command);
}
run_init_process("/sbin/init");
- run_init_process("/etc/init");
+/* run_init_process("/etc/init");
run_init_process("/bin/init");
run_init_process("/bin/sh");
-
+*/
panic("No init found. Try passing init= option to kernel. "
"See Linux Documentation/init.txt for guidance.");
}
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/kernel/printk.c ../linux-2.6.39.4/kernel/printk.c
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/kernel/printk.c 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/kernel/printk.c 2011-10-24 11:52:01.814164824 +0530
@@ -1485,7 +1485,9 @@
}
console_unlock();
console_sysfs_notify();
-
+#ifdef CONFIG_INVADER
+ keep_bootcon = 1;
+#endif
/*
* By unregistering the bootconsoles after we enable the real console
* we get the "console xxx enabled" message on all the consoles -
diff -uNr ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/Makefile ../linux-2.6.39.4/Makefile
--- ../../../crosscompiler_with_gdb_c_c++_objc/work/linux-2.6.39.4/Makefile 2011-08-04 01:13:28.000000000 +0530
+++ ../linux-2.6.39.4/Makefile 2011-10-22 06:39:21.397105230 +0530
@@ -237,6 +237,7 @@
HOSTCC = gcc
HOSTCXX = g++
+#Invader Changes
HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
HOSTCXXFLAGS = -O2
@@ -320,9 +321,9 @@
# Make variables (CC, etc...)
-AS = $(CROSS_COMPILE)as
-LD = $(CROSS_COMPILE)ld
-CC = $(CROSS_COMPILE)gcc
+AS = $(CROSS_COMPILE)as -mlittle-endian
+LD = $(CROSS_COMPILE)ld -EL
+CC = $(CROSS_COMPILE)gcc -mlittle-endian -mno-mfcrf
CPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nm
@@ -359,10 +360,12 @@
-fno-strict-aliasing -fno-common \
-Werror-implicit-function-declaration \
-Wno-format-security \
- -fno-delete-null-pointer-checks
+ -fno-delete-null-pointer-checks \
+ -mlittle-endian \
+ -fsigned-char
KBUILD_AFLAGS_KERNEL :=
KBUILD_CFLAGS_KERNEL :=
-KBUILD_AFLAGS := -D__ASSEMBLY__
+KBUILD_AFLAGS := -D__ASSEMBLY__ -mlittle-endian
KBUILD_AFLAGS_MODULE := -DMODULE
KBUILD_CFLAGS_MODULE := -DMODULE
KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
@@ -545,6 +548,7 @@
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += -Os
else
+#Invader Changes
KBUILD_CFLAGS += -O2
endif
^ permalink raw reply [flat|nested] 11+ messages in thread