diff options
Diffstat (limited to 'release/src/linux/linux/arch')
7 files changed, 146 insertions, 193 deletions
diff --git a/release/src/linux/linux/arch/mips/Makefile b/release/src/linux/linux/arch/mips/Makefile index fb3caa33..34111451 100644 --- a/release/src/linux/linux/arch/mips/Makefile +++ b/release/src/linux/linux/arch/mips/Makefile @@ -636,10 +636,12 @@ archclean: $(MAKE) -C arch/$(ARCH)/tools clean $(MAKE) -C arch/mips/baget clean $(MAKE) -C arch/mips/lasat clean + $(MAKE) -C arch/mips/brcm-boards/bcm947xx/compressed clean archmrproper: @$(MAKEBOOT) mrproper $(MAKE) -C arch/$(ARCH)/tools mrproper + $(MAKE) -C arch/mips/brcm-boards/bcm947xx/compressed mrproper archdep: if [ ! -f $(TOPDIR)/include/asm-$(ARCH)/offset.h ]; then \ diff --git a/release/src/linux/linux/arch/mips/brcm-boards/bcm947xx/prom-orig.c b/release/src/linux/linux/arch/mips/brcm-boards/bcm947xx/prom-orig.c new file mode 100644 index 00000000..706dfbf1 --- /dev/null +++ b/release/src/linux/linux/arch/mips/brcm-boards/bcm947xx/prom-orig.c @@ -0,0 +1,41 @@ +/* + * Early initialization code for BCM94710 boards + * + * Copyright 2006, Broadcom Corporation + * All Rights Reserved. + * + * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY + * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * + * $Id$ + */ + +#include <linux/config.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/types.h> +#include <asm/bootinfo.h> + +void __init +prom_init(int argc, const char **argv) +{ + unsigned long mem; + + mips_machgroup = MACH_GROUP_BRCM; + mips_machtype = MACH_BCM947XX; + + /* Figure out memory size by finding aliases */ + for (mem = (1 << 20); mem < (128 << 20); mem += (1 << 20)) { + if (*(unsigned long *)((unsigned long)(prom_init) + mem) == + *(unsigned long *)(prom_init)) + break; + } + add_memory_region(0, mem, BOOT_MEM_RAM); +} + +void __init +prom_free_prom_memory(void) +{ +} diff --git a/release/src/linux/linux/arch/mips/brcm-boards/bcm947xx/prom.c b/release/src/linux/linux/arch/mips/brcm-boards/bcm947xx/prom.c index 242dafb9..cb35926d 100644 --- a/release/src/linux/linux/arch/mips/brcm-boards/bcm947xx/prom.c +++ b/release/src/linux/linux/arch/mips/brcm-boards/bcm947xx/prom.c @@ -1,7 +1,7 @@ /* * Early initialization code for BCM94710 boards * - * Copyright 2005, Broadcom Corporation + * Copyright 2006, Broadcom Corporation * All Rights Reserved. * * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY @@ -9,7 +9,7 @@ * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. * - * $Id: prom.c,v 1.1.1.7 2005/03/07 07:30:37 kanki Exp $ + * $Id$ */ #include <linux/config.h> @@ -18,24 +18,39 @@ #include <linux/types.h> #include <asm/bootinfo.h> -void __init -prom_init(int argc, const char **argv) +void __init prom_init(int argc, char **argv, char **envp, int *prom_vec) { - unsigned long mem; + unsigned long mem, before, offset; - mips_machgroup = MACH_GROUP_BRCM; - mips_machtype = MACH_BCM947XX; + mips_machgroup = MACH_GROUP_BRCM; + mips_machtype = MACH_BCM947XX; - /* Figure out memory size by finding aliases */ - for (mem = (1 << 20); mem < (128 << 20); mem += (1 << 20)) { - if (*(unsigned long *)((unsigned long)(prom_init) + mem) == - *(unsigned long *)(prom_init)) + /* Figure out memory size by finding aliases. + * + * We assume that there will be no more than 128 MB of memory, + * and that the memory size will be a multiple of 1 MB. + * + * We set 'before' to be the amount of memory (in MB) before this + * function, i.e. one MB less than the number of MB of memory that we + * *know* we have. And we set 'offset' to be the address of 'prominit' + * minus 'before', so that KSEG0 or KSEG1 base + offset < 1 MB. + * This prevents us from overrunning 128 MB and causing a bus error. + */ + before = ((unsigned long) &prom_init) & (127 << 20); + offset = ((unsigned long) &prom_init) - before; + for (mem = before + (1 << 20); mem < (128 << 20); mem += (1 << 20)) + if (*(unsigned long *)(offset + mem) == + *(unsigned long *)(prom_init)) { + /* + * We may already be well past the end of memory at + * this point, so we'll have to compensate for it. + */ + mem -= before; break; - } + } add_memory_region(0, mem, BOOT_MEM_RAM); } -void __init -prom_free_prom_memory(void) +void __init prom_free_prom_memory(void) { } diff --git a/release/src/linux/linux/arch/mips/brcm-boards/bcm947xx/setup.c b/release/src/linux/linux/arch/mips/brcm-boards/bcm947xx/setup.c index c4983dc2..dc55be85 100644 --- a/release/src/linux/linux/arch/mips/brcm-boards/bcm947xx/setup.c +++ b/release/src/linux/linux/arch/mips/brcm-boards/bcm947xx/setup.c @@ -3,7 +3,7 @@ * * Copyright 2005, Broadcom Corporation * All Rights Reserved. - * + * * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS @@ -38,8 +38,6 @@ #include <sbutils.h> #include <trxhdr.h> -#include <cy_conf.h> - extern void bcm947xx_time_init(void); extern void bcm947xx_timer_setup(struct irqaction *irq); @@ -53,9 +51,6 @@ extern void breakpoint(void); extern struct ide_ops std_ide_ops; #endif -#ifdef MULTILANG_SUPPORT -#endif - /* Global SB handle */ void *bcm947xx_sbh = NULL; spinlock_t bcm947xx_sbh_lock = SPIN_LOCK_UNLOCKED; @@ -139,9 +134,9 @@ brcm_setup(void) /* Initialize clocks and interrupts */ sb_mips_init(sbh); - /* - * Now that the sbh is inited set the proper PFC value - */ + /* + * Now that the sbh is inited set the proper PFC value + */ pfc_val = sb_mips_get_pfc(sbh); printk("Setting the PFC value as 0x%x\n", pfc_val); check_enable_mips_pfc(pfc_val); @@ -184,197 +179,97 @@ bus_error_init(void) #ifdef CONFIG_MTD_PARTITIONS + +/* + new layout -- zzz 04/2006 + + +--------------+ + | boot | + +---+----------+ < search for HDR0 + | | | + | | (kernel) | + | l | | + | i +----------+ < + trx->offset[1] + | n | | + | u | rootfs | + | x | | + + +----------+ < + trx->len + | | jffs2 | + +--------------+ < size - NVRAM_SPACE + | nvram | + +--------------+ < size +*/ + static struct mtd_partition bcm947xx_parts[] = { - //{ name: "pmon", offset: 0, size: 0, /*mask_flags: MTD_WRITEABLE,*/ }, - { name: "boot", offset: 0, size: 0, /*mask_flags: MTD_WRITEABLE,*/ }, - { name: "linux", offset: 0, size: 0, }, - { name: "rootfs", offset: 0, size: 0, /*mask_flags: MTD_WRITEABLE,*/ }, -#ifdef MULTILANG_SUPPORT - { name: "lang", offset: 0, size: 0, /*mask_flags: MTD_WRITEABLE,*/ }, /* for multilang*/ -#endif - { name: "nvram", offset: 0, size: 0, }, + { name: "pmon", offset: 0, size: 0, mask_flags: MTD_WRITEABLE, }, + { name: "linux", offset: 0, size: 0, }, + { name: "rootfs", offset: 0, size: 0, mask_flags: MTD_WRITEABLE, }, + { name: "jffs2", offset: 0, size: 0, }, + { name: "nvram", offset: 0, size: 0, }, { name: NULL, }, }; +#define PART_BOOT 0 +#define PART_LINUX 1 +#define PART_ROOTFS 2 +#define PART_JFFS2 3 +#define PART_NVRAM 4 + struct mtd_partition * __init init_mtd_partitions(struct mtd_info *mtd, size_t size) { - struct minix_super_block *minixsb; - struct ext2_super_block *ext2sb; - struct romfs_super_block *romfsb; - struct cramfs_super *cramfsb; - struct squashfs_super_block *squashfsb; struct trx_header *trx; unsigned char buf[512]; - int off; -#ifdef MULTILANG_SUPPORT - struct lang_header *lang; /* for multilang */ - int off1; -#endif + size_t off; size_t len; + size_t trxsize; - minixsb = (struct minix_super_block *) buf; - ext2sb = (struct ext2_super_block *) buf; - romfsb = (struct romfs_super_block *) buf; - cramfsb = (struct cramfs_super *) buf; - squashfsb = (struct squashfs_super_block *) buf; - trx = (struct trx_header *) buf; -#ifdef MULTILANG_SUPPORT - lang = (struct lang_header *) buf; /* for multilang */ -#endif - - /* Look at every 64 KB boundary */ - for (off = 0; off < size; off += (64 * 1024)) { - memset(buf, 0xe5, sizeof(buf)); + bcm947xx_parts[PART_NVRAM].offset = size - ROUNDUP(NVRAM_SPACE, mtd->erasesize); + bcm947xx_parts[PART_NVRAM].size = size - bcm947xx_parts[PART_NVRAM].offset; - /* - * Read block 0 to test for romfs and cramfs superblock - */ - if (MTD_READ(mtd, off, sizeof(buf), &len, buf) || - len != sizeof(buf)) - continue; + trxsize = 0; + trx = (struct trx_header *) buf; + for (off = 0; off < size; off += mtd->erasesize) { + if ((MTD_READ(mtd, off, sizeof(buf), &len, buf)) || (len != sizeof(buf))) continue; - /* Try looking at TRX header for rootfs offset */ if (le32_to_cpu(trx->magic) == TRX_MAGIC) { - bcm947xx_parts[1].offset = off; - if (le32_to_cpu(trx->offsets[1]) > off) - off = le32_to_cpu(trx->offsets[1]); - continue; - } - - /* romfs is at block zero too */ - if (romfsb->word0 == ROMSB_WORD0 && - romfsb->word1 == ROMSB_WORD1) { - printk(KERN_NOTICE - "%s: romfs filesystem found at block %d\n", - mtd->name, off / BLOCK_SIZE); - goto done; - } - - /* so is cramfs */ - if (cramfsb->magic == CRAMFS_MAGIC) { - printk(KERN_NOTICE - "%s: cramfs filesystem found at block %d\n", - mtd->name, off / BLOCK_SIZE); - goto done; - } - - /* squashfs is at block zero too */ - if (squashfsb->s_magic == SQUASHFS_MAGIC) { - printk(KERN_NOTICE - "%s: squashfs filesystem found at block %d\n", - mtd->name, off / BLOCK_SIZE); - goto done; - } - - /* - * Read block 1 to test for minix and ext2 superblock - */ - if (MTD_READ(mtd, off + BLOCK_SIZE, sizeof(buf), &len, buf) || - len != sizeof(buf)) - continue; - - /* Try minix */ - if (minixsb->s_magic == MINIX_SUPER_MAGIC || - minixsb->s_magic == MINIX_SUPER_MAGIC2) { - printk(KERN_NOTICE - "%s: Minix filesystem found at block %d\n", - mtd->name, off / BLOCK_SIZE); - goto done; - } - - /* Try ext2 */ - if (ext2sb->s_magic == cpu_to_le16(EXT2_SUPER_MAGIC)) { - printk(KERN_NOTICE - "%s: ext2 filesystem found at block %d\n", - mtd->name, off / BLOCK_SIZE); - goto done; + bcm947xx_parts[PART_BOOT].size = off; + + bcm947xx_parts[PART_LINUX].offset = off; + bcm947xx_parts[PART_LINUX].size = bcm947xx_parts[PART_NVRAM].offset - off; + + trxsize = ROUNDUP(le32_to_cpu(trx->len), mtd->erasesize); // kernel + rootfs + + bcm947xx_parts[PART_ROOTFS].offset = trx->offsets[1] + off; + bcm947xx_parts[PART_ROOTFS].size = trxsize - trx->offsets[1]; + + bcm947xx_parts[PART_JFFS2].offset = off + trxsize; + bcm947xx_parts[PART_JFFS2].size = bcm947xx_parts[PART_NVRAM].offset - bcm947xx_parts[PART_JFFS2].offset; + break; } } - printk(KERN_NOTICE - "%s: Couldn't find valid ROM disk image\n", - mtd->name); - - done: -#if MULTILANG_SUPPORT -/* below for multilang */ - /* Look at every 64 KB boundary */ - for (off1 = 0; off1 < size; off1 += (64 * 1024)) { - memset(buf, 0xe5, sizeof(buf)); - - /* - * Read block 0 to test for romfs and cramfs superblock - */ - if (MTD_READ(mtd, off1, sizeof(buf), &len, buf) || - len != sizeof(buf)) - continue; - - /* Try looking at TRX header for rootfs offset */ - if (le32_to_cpu(trx->magic) == TRX_MAGIC) { - printk("le32_to_cpu(trx->magic)=0x%lx trx->magic=0x%lx\n", le32_to_cpu(trx->magic), trx->magic); - //bcm947xx_parts[1].offset = off1; - printk("bcm947xx_parts[1].offset=0x%lx trx->offsets[1]=0x%lx off\n", bcm947xx_parts[2].offset); - if (le32_to_cpu(trx->offsets[2]) > off1) { - off1 = le32_to_cpu(trx->offsets[2]); - printk("ok1 off1=0x%lx\n", off1); - } - continue; - } - - /* so is cramfs */ - if (cramfsb->magic == CRAMFS_MAGIC) { - printk(KERN_NOTICE - "%s: lang cramfs filesystem found at block %d (0x%lx)\n", - mtd->name, off1 / BLOCK_SIZE, off1); - goto done1; - } - - /* squashfs is at block zero too */ - if (squashfsb->s_magic == SQUASHFS_MAGIC) { - printk(KERN_NOTICE - "%s: lang squashfs filesystem found at block %d (0x%lx)\n", - mtd->name, off1 / BLOCK_SIZE, off1); - goto done1; - } - + if (trxsize == 0) { + // uh, now what... + printk(KERN_NOTICE "%s: Unable to find a valid linux partition\n", mtd->name); } -done1: - printk("off=0x%lx off1=0x%lx size=0x%lx\n", off, off1, size); - if(off1 == 0 || off1 == size ) - { - off1 = size - 0x60000; // 0x3d0000 only lang.js - printk("(Not Found Lang Block)off=0x%lx off1=0x%lx size=0x%lx\n", off, off1, size); + +#if 0 + int i; + for (i = 0; bcm947xx_parts[i].name; ++i) { + printk(KERN_NOTICE "%8x %8x (%8x) %s\n", + bcm947xx_parts[i].offset, + (bcm947xx_parts[i].offset + bcm947xx_parts[i].size) - 1, + bcm947xx_parts[i].size, + bcm947xx_parts[i].name); } -/* for multilang -> */ - bcm947xx_parts[4].offset = size - ROUNDUP(NVRAM_SPACE, mtd->erasesize); - bcm947xx_parts[4].size = size - bcm947xx_parts[4].offset; - printk("nvram: offset=0x%lx size=0x%lx\n", bcm947xx_parts[4].offset, bcm947xx_parts[4].size); - - bcm947xx_parts[3].offset = off1; - bcm947xx_parts[3].size = bcm947xx_parts[4].offset - bcm947xx_parts[3].offset; -/* <- for multilang */ -#else - /* Find and size nvram */ - bcm947xx_parts[3].offset = size - ROUNDUP(NVRAM_SPACE, mtd->erasesize); - bcm947xx_parts[3].size = size - bcm947xx_parts[3].offset; #endif - /* Find and size rootfs */ - if (off < size) { - bcm947xx_parts[2].offset = off; - bcm947xx_parts[2].size = bcm947xx_parts[3].offset - bcm947xx_parts[2].offset; - } - - /* Size linux (kernel and rootfs) */ - bcm947xx_parts[1].size = bcm947xx_parts[3].offset - bcm947xx_parts[1].offset; - - /* Size pmon */ - bcm947xx_parts[0].size = bcm947xx_parts[1].offset - bcm947xx_parts[0].offset; return bcm947xx_parts; } + EXPORT_SYMBOL(init_mtd_partitions); #endif diff --git a/release/src/linux/linux/arch/mips/kernel/branch.c b/release/src/linux/linux/arch/mips/kernel/branch.c index 8165789c..738ae74f 100644 --- a/release/src/linux/linux/arch/mips/kernel/branch.c +++ b/release/src/linux/linux/arch/mips/kernel/branch.c @@ -170,7 +170,7 @@ int __compute_return_epc(struct pt_regs *regs) bit = (insn.i_format.rt >> 2); bit += (bit != 0); bit += 23; - switch (insn.i_format.rt) { + switch (insn.i_format.rt & 3) { case 0: /* bc1f */ case 2: /* bc1fl */ if (~fcr31 & (1 << bit)) diff --git a/release/src/linux/linux/arch/mips/kernel/mips_ksyms.c b/release/src/linux/linux/arch/mips/kernel/mips_ksyms.c index a76613d1..3f07ed47 100644 --- a/release/src/linux/linux/arch/mips/kernel/mips_ksyms.c +++ b/release/src/linux/linux/arch/mips/kernel/mips_ksyms.c @@ -52,6 +52,7 @@ EXPORT_SYMBOL(EISA_bus); */ EXPORT_SYMBOL_NOVERS(memcmp); EXPORT_SYMBOL_NOVERS(memset); +EXPORT_SYMBOL_NOVERS(memchr); EXPORT_SYMBOL_NOVERS(memcpy); EXPORT_SYMBOL_NOVERS(memmove); EXPORT_SYMBOL_NOVERS(strcat); diff --git a/release/src/linux/linux/arch/mips/math-emu/cp1emu.c b/release/src/linux/linux/arch/mips/math-emu/cp1emu.c index be1f732a..07f25d74 100644 --- a/release/src/linux/linux/arch/mips/math-emu/cp1emu.c +++ b/release/src/linux/linux/arch/mips/math-emu/cp1emu.c @@ -528,9 +528,8 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx) if (MIPSInst_FUNC(ir) != movc_op) return SIGILL; cond = fpucondbit[MIPSInst_RT(ir) >> 2]; - if (((ctx->sr & cond) != 0) != ((MIPSInst_RT(ir) & 1) != 0)) - return 0; - xcp->regs[MIPSInst_RD(ir)] = xcp->regs[MIPSInst_RS(ir)]; + if (((ctx->sr & cond) != 0) == ((MIPSInst_RT(ir) & 1) != 0)) + xcp->regs[MIPSInst_RD(ir)] = xcp->regs[MIPSInst_RS(ir)]; break; #endif |