Changeset 12400


Ignore:
Timestamp:
06/29/09 18:24:49 (4 years ago)
Author:
BrainSlayer
Message:

more flexible EOC5610 partition layout, small performance increase by module remapping, lzma decoder speed improvements

Location:
src/linux/ar531x/linux-2.6.23
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • src/linux/ar531x/linux-2.6.23/arch/mips/Makefile

    r9058 r12400  
    8484cflags-y                        += -msoft-float 
    8585LDFLAGS_vmlinux                 += -G 0 -static -n -nostdlib 
    86 MODFLAGS                        += -mlong-calls 
     86MODFLAGS                        += -mno-long-calls 
    8787 
    8888cflags-y += -ffreestanding 
  • src/linux/ar531x/linux-2.6.23/arch/mips/atheros/ar5315/board.c

    r11759 r12400  
    236236        /* reset the system */ 
    237237        sysRegWrite(AR5315_COLD_RESET,AR5317_RESET_SYSTEM); 
     238        mdelay(100); 
    238239        /* 
    239240         * Cold reset does not work on the AR2315/6, use the GPIO reset bits a workaround. 
  • src/linux/ar531x/linux-2.6.23/arch/mips/kernel/module.c

    r8169 r12400  
    3030#include <linux/module.h> 
    3131#include <linux/spinlock.h> 
     32#include <linux/mm.h> 
    3233#include <asm/pgtable.h>        /* MODULE_START */ 
    3334 
     
    4344static DEFINE_SPINLOCK(dbe_lock); 
    4445 
     46static void *alloc_phys(unsigned long size) 
     47{ 
     48        unsigned order; 
     49        struct page *page; 
     50        struct page *p; 
     51 
     52        size = PAGE_ALIGN(size); 
     53        order = get_order(size); 
     54 
     55        page = alloc_pages( 
     56                GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN | __GFP_THISNODE, 
     57                order); 
     58        if (!page) 
     59                return 0; 
     60 
     61        split_page(page, order); 
     62 
     63        for (p = page + (size >> PAGE_SHIFT); p < page + (1 << order); ++p) 
     64                __free_page(p); 
     65 
     66        return page_address(page); 
     67} 
     68 
     69static void free_phys(void *ptr, unsigned long size) 
     70{ 
     71        struct page *page; 
     72        struct page *end; 
     73 
     74        page = virt_to_page(ptr); 
     75        end = page + (PAGE_ALIGN(size) >> PAGE_SHIFT); 
     76 
     77        for (; page < end; ++page) 
     78                __free_pages(page, 0); 
     79} 
     80 
    4581void *module_alloc(unsigned long size) 
    4682{ 
     
    5894        return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL); 
    5995#else 
     96        unsigned addr; 
     97        void *ptr; 
     98 
     99        size = PAGE_ALIGN(size); 
    60100        if (size == 0) 
    61101                return NULL; 
    62         return vmalloc(size); 
     102 
     103        ptr = alloc_phys(size); 
     104        if (ptr) 
     105                return ptr; 
     106 
     107        /* try to allocate contiguos chunk of memory not spanning 256Mb 
     108           range, so all jump instructions can work */ 
     109        addr = VMALLOC_START; 
     110        while (addr < VMALLOC_END) { 
     111                unsigned end = ALIGN(addr + 1, 1u << 28); 
     112 
     113                if (addr + size <= end) { 
     114                        struct vm_struct *area 
     115                                = __get_vm_area(size, VM_ALLOC, addr, end); 
     116 
     117                        if (area) 
     118                                return __vmalloc_area( 
     119                                        area, GFP_KERNEL, PAGE_KERNEL); 
     120                } 
     121                addr = end; 
     122        } 
     123        return NULL; 
    63124#endif 
     125} 
     126 
     127static inline int is_phys(void *ptr) 
     128{ 
     129        unsigned addr = (unsigned) ptr; 
     130        return addr && (addr < VMALLOC_START || addr > VMALLOC_END); 
    64131} 
    65132 
     
    67134void module_free(struct module *mod, void *module_region) 
    68135{ 
     136        if (is_phys(module_region)) { 
     137                if (mod->module_init == module_region) 
     138                        free_phys(module_region, mod->init_size); 
     139                else if (mod->module_core == module_region) 
     140                        free_phys(module_region, mod->core_size); 
     141                else 
     142                    BUG(); 
     143                return; 
     144        } 
     145 
    69146        vfree(module_region); 
    70147        /* FIXME: If module_region == mod->init_region, trim exception 
     
    78155} 
    79156 
     157/* Get the potential trampolines size required of the init and 
     158   non-init sections */ 
     159static unsigned get_plt_size(const Elf32_Ehdr *hdr, 
     160                             const Elf32_Shdr *sechdrs, 
     161                             const char *secstrings, 
     162                             unsigned symindex, 
     163                             int is_init) 
     164{ 
     165        unsigned long ret = 0; 
     166        unsigned i, j; 
     167        Elf_Sym *syms; 
     168 
     169        /* Everything marked ALLOC (this includes the exported symbols) */ 
     170        for (i = 1; i < hdr->e_shnum; ++i) { 
     171                unsigned int info = sechdrs[i].sh_info; 
     172 
     173                if (sechdrs[i].sh_type != SHT_REL 
     174                    && sechdrs[i].sh_type != SHT_RELA) 
     175                        continue; 
     176 
     177                /* Not a valid relocation section? */ 
     178                if (info >= hdr->e_shnum) 
     179                        continue; 
     180 
     181                /* Don't bother with non-allocated sections */ 
     182                if (!(sechdrs[info].sh_flags & SHF_ALLOC)) 
     183                        continue; 
     184 
     185                /* If it's called *.init*, and we're not init, we're 
     186                   not interested */ 
     187                if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != 0) 
     188                    != is_init) 
     189                        continue; 
     190 
     191                syms = (Elf_Sym *) sechdrs[symindex].sh_addr; 
     192                if (sechdrs[i].sh_type == SHT_REL) { 
     193                        Elf_Mips_Rel *rel = (void *) sechdrs[i].sh_addr; 
     194                        unsigned size = sechdrs[i].sh_size / sizeof(*rel); 
     195 
     196                        for (j = 0; j < size; ++j) { 
     197                                Elf_Sym *sym; 
     198 
     199                                if (ELF_MIPS_R_TYPE(rel[j]) != R_MIPS_26) 
     200                                        continue; 
     201                                sym = syms + ELF_MIPS_R_SYM(rel[j]); 
     202                                if (!is_init && sym->st_shndx != SHN_UNDEF) 
     203                                        continue; 
     204 
     205                                ret += sizeof(unsigned[4]); 
     206                        } 
     207                } else { 
     208                        Elf_Mips_Rela *rela = (void *) sechdrs[i].sh_addr; 
     209                        unsigned size = sechdrs[i].sh_size / sizeof(*rela); 
     210 
     211                        for (j = 0; j < size; ++j) { 
     212                                Elf_Sym *sym; 
     213 
     214                                if (ELF_MIPS_R_TYPE(rela[j]) != R_MIPS_26) 
     215                                        continue; 
     216                                sym = syms + ELF_MIPS_R_SYM(rela[j]); 
     217                                if (!is_init && sym->st_shndx != SHN_UNDEF) 
     218                                        continue; 
     219 
     220                                ret += sizeof(unsigned[4]); 
     221                        } 
     222                } 
     223 
     224        } 
     225 
     226        return ret; 
     227} 
     228 
     229int module_relayout(Elf32_Ehdr *hdr, 
     230                    Elf32_Shdr *sechdrs, 
     231                    char *secstrings, 
     232                    unsigned symindex, 
     233                    struct module *me) 
     234{ 
     235        unsigned core_plt_size = get_plt_size( 
     236            hdr, sechdrs, secstrings, symindex, 0); 
     237        unsigned init_plt_size = get_plt_size( 
     238            hdr, sechdrs, secstrings, symindex, 1); 
     239 
     240        if (core_plt_size > 0) 
     241                me->core_size = PAGE_ALIGN(me->core_size); 
     242        me->arch.core_plt_offset = me->core_size; 
     243        me->core_size = me->core_size + core_plt_size; 
     244 
     245        me->arch.init_plt_offset = me->init_size; 
     246        me->init_size = me->init_size + init_plt_size; 
     247 
     248        return 0; 
     249} 
     250 
    80251static int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v) 
    81252{ 
     
    94265        *location = v; 
    95266 
     267        return 0; 
     268} 
     269 
     270static Elf_Addr add_plt_entry_to(unsigned *plt_offset, 
     271                                 void *start, unsigned size, Elf_Addr v) 
     272{ 
     273        unsigned *tramp = start + *plt_offset; 
     274        if (*plt_offset == size) return 0; 
     275 
     276        *plt_offset += sizeof(unsigned[4]); 
     277 
     278        /* adjust carry for addiu */ 
     279        if (v & 0x00008000)  
     280                v += 0x10000; 
     281         
     282        tramp[0] = 0x3c190000 | (v >> 16);      /* lui t9, hi16 */ 
     283        tramp[1] = 0x27390000 | (v & 0xffff);   /* addiu t9, t9, lo16 */ 
     284        tramp[2] = 0x03200008;                  /* jr t9 */ 
     285        tramp[3] = 0x00000000;                  /* nop */ 
     286         
     287        return (Elf_Addr) tramp; 
     288} 
     289 
     290static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v) 
     291{ 
     292        if (location >= me->module_core 
     293            && location < me->module_core + me->core_size) { 
     294                return add_plt_entry_to(&me->arch.core_plt_offset, 
     295                                        me->module_core, me->core_size, v); 
     296        } else if (location > me->module_init 
     297                   && location < me->module_init + me->init_size) { 
     298                return add_plt_entry_to(&me->arch.init_plt_offset, 
     299                                        me->module_init, me->init_size, v); 
     300        } else { 
     301                printk(KERN_ERR "module %s: " 
     302                       "relocation to unknown segment %u\n", 
     303                       me->name, v); 
     304        } 
    96305        return 0; 
    97306} 
     
    105314 
    106315        if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { 
     316                v = add_plt_entry(me, location, 
     317                                  v + ((*location & 0x03ffffff) << 2)); 
     318                if (v == 0) { 
    107319                printk(KERN_ERR 
    108320                       "module %s: relocation overflow\n", 
     
    110322                return -ENOEXEC; 
    111323        } 
     324                *location = (*location & ~0x03ffffff) | 
     325                            ((v >> 2) & 0x03ffffff); 
     326                return 0; 
     327        } 
    112328 
    113329        *location = (*location & ~0x03ffffff) | 
     
    125341 
    126342        if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { 
     343                v = add_plt_entry(me, location, v); 
     344                if (v == 0) { 
    127345                printk(KERN_ERR 
    128346                       "module %s: relocation overflow\n", 
    129347                       me->name); 
    130348                return -ENOEXEC; 
     349        } 
    131350        } 
    132351 
     
    400619                spin_unlock_irq(&dbe_lock); 
    401620        } 
     621 
     622        if (me->arch.core_plt_offset < me->core_size 
     623            && PAGE_ALIGN(me->arch.core_plt_offset) == me->arch.core_plt_offset 
     624            && is_phys(me->module_core)) { 
     625                free_phys(me->module_core + me->arch.core_plt_offset, 
     626                          me->core_size - me->arch.core_plt_offset); 
     627                me->core_size = me->arch.core_plt_offset; 
     628        } 
    402629        return 0; 
    403630} 
  • src/linux/ar531x/linux-2.6.23/arch/mips/kernel/scall32-o32.S

    r8169 r12400  
    647647        sys     sys_ppoll               5 
    648648        sys     sys_unshare             1 
    649         sys     sys_splice              4 
     649        sys     sys_splice              6 
    650650        sys     sys_sync_file_range     7       /* 4305 */ 
    651651        sys     sys_tee                 4 
  • src/linux/ar531x/linux-2.6.23/arch/mips/kernel/vmlinux.lds.S

    r8169 r12400  
    135135    *(.bss) 
    136136    *(COMMON) 
    137   } 
     137    . = (ALIGN(_PAGE_SIZE) - .) < 8 ? ALIGN(_PAGE_SIZE) + 4 : . ; 
     138 } 
    138139  __bss_stop = .; 
    139140 
  • src/linux/ar531x/linux-2.6.23/arch/mips/mm/c-r4k.c

    r11387 r12400  
    932932                c->dcache.waybit = __ffs(dcache_size/c->dcache.ways); 
    933933 
     934#ifdef CONFIG_CPU_HAS_PREFETCH 
    934935                c->options |= MIPS_CPU_PREFETCH; 
     936#endif 
    935937                break; 
    936938        } 
  • src/linux/ar531x/linux-2.6.23/crypto/api.c

    r8169 r12400  
    394394        return ERR_PTR(err); 
    395395} 
    396 EXPORT_SYMBOL_GPL(crypto_alloc_base); 
     396EXPORT_SYMBOL(crypto_alloc_base); 
    397397  
    398398/* 
     
    422422} 
    423423 
    424 EXPORT_SYMBOL_GPL(crypto_free_tfm); 
     424EXPORT_SYMBOL(crypto_free_tfm); 
    425425 
    426426int crypto_alg_available(const char *name, u32 flags) 
  • src/linux/ar531x/linux-2.6.23/drivers/mtd/devices/spiflash.c

    r9243 r12400  
    256256 
    257257        spiflash_regwrite32(SPI_FLASH_CTL, reg); 
     258 
    258259        busy_wait(spiflash_regread32(SPI_FLASH_CTL) & SPI_CTL_BUSY, 0); 
    259260  
  • src/linux/ar531x/linux-2.6.23/drivers/mtd/maps/eoc5610_flash.c

    r11767 r12400  
    66 * Copyright (C) 2006-2007 Tomas Dlabac <tomas@dlabac.net> 
    77*/ 
    8           
     8 
    99/* 
    1010 * 
     
    2222#include <linux/squashfs_fs.h> 
    2323 
    24  
    2524#ifdef CONFIG_MTD_PARTITIONS 
    2625#include <linux/mtd/partitions.h> 
     
    3130#define WINDOW_SIZE 0x00800000 
    3231 
    33  
    3432/* These ought to be somewhere common... */ 
    3533 
    3634#define AR531X_FLASHCTL 0x18400000 
    3735 
    38 #define FLASHCTL_MW     0x30000000      /* Memory width */ 
    39 #define FLASHCTL_MWx8   0x00000000      /* Memory width x8 */ 
    40 #define FLASHCTL_MWx16  0x10000000      /* Memory width x16 */ 
    41 #define FLASHCTL_MWx32  0x20000000      /* Memory width x32 (not supported) */ 
     36#define FLASHCTL_MW     0x30000000      /* Memory width */ 
     37#define FLASHCTL_MWx8   0x00000000      /* Memory width x8 */ 
     38#define FLASHCTL_MWx16  0x10000000      /* Memory width x16 */ 
     39#define FLASHCTL_MWx32  0x20000000      /* Memory width x32 (not supported) */ 
    4240 
    4341#define sysRegRead(phys) __raw_readl(KSEG1ADDR(phys)) 
    4442 
    45  
    4643static struct mtd_info *mymtd; 
    4744 
    4845#ifdef CONFIG_MTD_PARTITIONS 
    49 static const char *probes []={"cmdlinepart",NULL}; 
     46static const char *probes[] = { "cmdlinepart", NULL }; 
    5047#endif 
    5148 
    5249struct map_info ar531x_map = { 
    53         name: "ar531x", 
    54         size: WINDOW_SIZE 
     50      name:"ar531x", 
     51      size:WINDOW_SIZE 
    5552}; 
    5653 
    5754#ifdef CONFIG_MTD_PARTITIONS 
    5855static struct mtd_partition *mtd_parts = 0; 
    59 static int                   mtd_parts_nb = 0; 
     56static int mtd_parts_nb = 0; 
    6057 
    6158struct img_info { 
    6259        uint32_t lenght; 
    6360        uint32_t CRC; 
    64         }; 
    65  
    66 static struct mtd_partition ar531x_partitions[] = { 
    67         { 
    68                 name:           "RedBoot", 
    69                 size:           0x30000,                /* 64KB */ 
    70                 offset:         0, 
    71         }, { 
    72                 name:           "linux", 
    73                 size:           0x7A0000,        
    74                 offset:         0x30000, 
    75         }, { 
    76                 name:           "rootfs", 
    77                 size:           0x0,     
    78                 offset:         MTDPART_OFS_APPEND, 
    79         }, { 
    80                 name:           "ddwrt", 
    81                 size:           0x0,     
    82                 offset:         MTDPART_OFS_APPEND, 
    83         }, { 
    84                 name:           "nvram", 
    85                 size:           0x10000,         
    86                 offset:         0x7D0000, 
    87         }, { 
    88                 name:           "FIS directory", 
    89                 size:           0x10000,         
    90                 offset:         0x7E0000, 
    91         }, { 
    92                 name:           "board_config", 
    93                 size:           0x10000,                /* 64KB */ 
    94                 offset:         0x7F0000, 
    95         } 
    96  
    97 }; 
    98  
    99 #define NUM_PARTITIONS  (sizeof(ar531x_partitions)/sizeof(struct mtd_partition)) 
    100 #endif 
    101  
    102  
     61}; 
     62 
     63static struct mtd_partition dir_parts[] = { 
     64        { 
     65              name:"RedBoot", 
     66              size:0x30000,     /* 64KB */ 
     67              offset:0, 
     68         }, { 
     69              name:"linux", 
     70              size:0x7A0000, 
     71              offset:0x30000, 
     72             }, { 
     73              name:"rootfs", 
     74              size:0x0, 
     75              offset:MTDPART_OFS_APPEND, 
     76                 }, { 
     77              name: "ddwrt", 
     78              size: 0x0, 
     79              offset:MTDPART_OFS_APPEND, 
     80                     }, { 
     81              name:      "nvram", 
     82              size:      0x10000, 
     83              offset:    0x7D0000, 
     84                         }, { 
     85              name:          "FIS directory", 
     86              size:          0x10000, 
     87              offset:        0x7E0000, 
     88                             }, { 
     89              name:              "board_config", 
     90              size:              0x10000,       /* 64KB */ 
     91              offset:            0x7F0000, 
     92                                 } 
     93        , { 
     94              name:"fullflash", 
     95              size:0x800000,    /* 64KB */ 
     96              offset:0x000000, 
     97           } 
     98}; 
     99 
     100struct fis_image_desc { 
     101        unsigned char name[16]; // Null terminated name 
     102        unsigned long flash_base;       // Address within FLASH of image 
     103        unsigned long mem_base; // Address in memory where it executes 
     104        unsigned long size;     // Length of image 
     105        unsigned long entry_point;      // Execution entry point 
     106        unsigned long data_length;      // Length of actual data 
     107        unsigned char _pad[256 - (16 + 7 * sizeof(unsigned long))]; 
     108        unsigned long desc_cksum;       // Checksum over image descriptor 
     109        unsigned long file_cksum;       // Checksum over image data 
     110}; 
     111 
     112#define NUM_PARTITIONS  (sizeof(dir_parts)/sizeof(struct mtd_partition)) 
     113#endif 
    103114 
    104115int __init init_ar531x(void) 
    105116{ 
    106         static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", "map_rom", 0 }; 
     117        static const char *rom_probe_types[] = 
     118            { "cfi_probe", "jedec_probe", "map_rom", 0 }; 
    107119        const char **type; 
    108120        unsigned int flashctl; 
    109121        void *buf; 
    110         size_t  retlen; 
     122        size_t retlen; 
    111123        int ret; 
     124        unsigned char *p; 
     125        struct fis_image_desc *fis; 
    112126        struct img_info *image_info; 
    113127        struct squashfs_super_block *sb; 
    114         int len;                 
     128        int len; 
     129        size_t rootsize; 
    115130 
    116131        /* This is nasty, but needed as the new AR2312-01 parts only 
     
    126141        else { 
    127142                printk(KERN_ERR "ar531x illegal flash buswidth (%#x)\n", 
    128                         flashctl); 
     143                       flashctl); 
    129144                return -ENXIO; 
    130145        } 
    131146 
    132 //      printk(KERN_NOTICE "ar531x flash buswidth detected as %d\n", 
    133 //             ar531x_map.bankwidth); 
     147//      printk(KERN_NOTICE "ar531x flash buswidth detected as %d\n", 
     148//             ar531x_map.bankwidth); 
    134149 
    135150        /* 
     
    139154 
    140155        ar531x_map.phys = WINDOW_ADDR; 
    141         ar531x_map.virt = ioremap(WINDOW_ADDR,WINDOW_SIZE); 
    142          
     156        ar531x_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE); 
     157 
    143158        if (!ar531x_map.virt) { 
    144             printk("Failed to ioremap\n"); 
    145             return -EIO; 
     159                printk("Failed to ioremap\n"); 
     160                return -EIO; 
    146161        } 
    147162 
     
    150165        mymtd = 0; 
    151166        type = rom_probe_types; 
    152         for(; !mymtd && *type; type++) { 
     167        for (; !mymtd && *type; type++) { 
    153168                mymtd = do_map_probe(*type, &ar531x_map); 
    154169        } 
    155170        if (mymtd) { 
    156171                mymtd->owner = THIS_MODULE; 
    157 //              add_mtd_device(mymtd); 
    158                 printk(KERN_NOTICE "AR531x Flash device initialized: size 0x%x at 0x%x bankwidth 0x%x\n", 
    159                     mymtd->size, WINDOW_ADDR, ar531x_map.bankwidth); 
    160  
    161 #ifdef CONFIG_MTD_PARTITIONS 
    162                         if (buf) { 
    163                             int offset = 0x0; 
    164                             char *buf = (char*)0xbfc00000; 
    165                             while((offset+mymtd->erasesize)<mymtd->size) 
    166                             { 
    167                             if (*((__u32 *) buf) == SQUASHFS_MAGIC) 
    168                                     { 
    169                                         printk(KERN_EMERG "\nfound squashfs at %X\n",offset); 
    170                                         sb = (struct squashfs_super_block *) buf; 
    171                  
    172                                         ar531x_partitions[2].offset=offset;                                      
     172//              add_mtd_device(mymtd); 
     173                printk(KERN_NOTICE 
     174                       "AR531x Flash device initialized: size 0x%x at 0x%x bankwidth 0x%x\n", 
     175                       mymtd->size, WINDOW_ADDR, ar531x_map.bankwidth); 
     176 
     177#ifdef CONFIG_MTD_PARTITIONS 
     178                 { 
     179                        int offset = 0x0; 
     180                        unsigned char *buf = (unsigned char *)0xa8000000; 
     181                        while ((offset + mymtd->erasesize) < mymtd->size) { 
     182                                if (*((__u32 *)buf) == SQUASHFS_MAGIC) { 
     183                                        printk(KERN_EMERG 
     184                                               "\nfound squashfs at %X\n", 
     185                                               offset); 
     186                                        sb = (struct squashfs_super_block *)buf; 
     187 
     188                                        dir_parts[2].offset = offset; 
    173189                                        len = sb->bytes_used; 
    174                                         len +=  (mymtd->erasesize - 1); 
     190                                        len += (mymtd->erasesize - 1); 
    175191                                        len &= ~(mymtd->erasesize - 1); 
    176                                         ar531x_partitions[2].size = len;                                         
    177                                         ar531x_partitions[3].offset=offset+ar531x_partitions[2].size;                                    
    178                                         ar531x_partitions[3].size = ar531x_partitions[1].size-(ar531x_partitions[3].offset-0x30000);                                     
    179                                         ar531x_partitions[6].offset=mymtd->size-mymtd->erasesize;  
    180                                         ar531x_partitions[5].offset=mymtd->size-(mymtd->erasesize*2);  
    181                                         ar531x_partitions[4].offset=mymtd->size-(mymtd->erasesize*3);  
     192                                        dir_parts[2].size = len; 
     193                                        dir_parts[3].offset = 
     194                                            offset + dir_parts[2].size; 
     195                                        dir_parts[3].size = 
     196                                            dir_parts[1].size - 
     197                                            (dir_parts[3].offset - 
     198                                             0x30000); 
     199                                        dir_parts[6].offset = 
     200                                            mymtd->size - mymtd->erasesize; 
     201                                        dir_parts[5].offset = 
     202                                            mymtd->size - 
     203                                            (mymtd->erasesize * 2); 
     204                                        dir_parts[4].offset = 
     205                                            mymtd->size - 
     206                                            (mymtd->erasesize * 3); 
     207                                        rootsize = dir_parts[4].offset - offset;        //size of rootfs aligned to nvram offset 
     208 
     209                                        p = (unsigned char *)(0xa8000000 + 
     210                                                              dir_parts[5]. 
     211                                                              offset); 
     212                                        fis = (struct fis_image_desc *)p; 
     213                                        while (1) { 
     214                                                if (fis->name[0] == 0xff) { 
     215                                                        goto def; 
     216                                                } 
     217                                                if (!strcmp 
     218                                                    (fis->name, "RedBoot")) { 
     219                                                        printk(KERN_EMERG 
     220                                                               "found RedBoot partition at [0x%08lX]\n", 
     221                                                               fis->flash_base); 
     222                                                        dir_parts[0].size = 
     223                                                            fis->size; 
     224                                                        dir_parts[7].offset = 0; 
     225                                                } 
     226                                                if (!strcmp(fis->name, "linux") 
     227                                                    || !strncmp(fis->name, 
     228                                                                "vmlinux", 7) 
     229                                                    || !strcmp(fis->name, 
     230                                                               "kernel")) { 
     231                                                        printk(KERN_EMERG 
     232                                                               "found linux partition at [0x%08lX]\n", 
     233                                                               fis->flash_base); 
     234                                                        dir_parts[1].offset = 
     235                                                            fis-> 
     236                                                            flash_base & (mymtd-> 
     237                                                                          size - 
     238                                                                          1); 
     239                                                        dir_parts[1].size = 
     240                                                            (dir_parts[2]. 
     241                                                             offset - 
     242                                                             dir_parts[1]. 
     243                                                             offset) + rootsize; 
     244                                                        dir_parts[7].size = mymtd->size;        // linux + nvram = phy size 
     245                                                } 
     246                                                p += sizeof(struct 
     247                                                            fis_image_desc); 
     248                                                fis = 
     249                                                    (struct fis_image_desc *)p; 
     250                                        } 
    182251                                        break; 
    183                                     }  
    184                             offset+=mymtd->erasesize; 
    185                             buf+=mymtd->erasesize; 
    186                             } 
    187                                 if (NUM_PARTITIONS != 0)  
    188                                 { 
    189                                     printk(KERN_NOTICE "Using ar531x DD-WRT partition definition\n"); 
    190                                     add_mtd_partitions (mymtd, ar531x_partitions, NUM_PARTITIONS); 
    191252                                } 
    192  
    193                             } 
     253                                offset += mymtd->erasesize; 
     254                                buf += mymtd->erasesize; 
     255                        } 
     256                        def:; 
     257                        if (NUM_PARTITIONS != 0) { 
     258                                printk(KERN_NOTICE 
     259                                       "Using ar531x DD-WRT partition definition\n"); 
     260                                add_mtd_partitions(mymtd, dir_parts, 
     261                                                   NUM_PARTITIONS); 
     262                        } 
     263 
     264                } 
    194265#endif 
    195266 
    196267                return 0; 
    197268        } 
    198         iounmap ((void *)ar531x_map.virt); 
     269        iounmap((void *)ar531x_map.virt); 
    199270        return -ENXIO; 
    200271} 
     
    207278        } 
    208279        if (ar531x_map.virt) { 
    209             iounmap ((void *)ar531x_map.virt); 
    210             ar531x_map.virt=0; 
     280                iounmap((void *)ar531x_map.virt); 
     281                ar531x_map.virt = 0; 
    211282        } 
    212283} 
     
    214285module_init(init_ar531x); 
    215286module_exit(cleanup_ar531x); 
    216  
    217287 
    218288MODULE_LICENSE("GPL"); 
  • src/linux/ar531x/linux-2.6.23/fs/squashfs/LzmaDecode.c

    r8169 r12400  
    4646} CRangeDecoder; 
    4747 
    48 Byte RangeDecoderReadByte(CRangeDecoder *rd) 
     48static inline Byte RangeDecoderReadByte(CRangeDecoder *rd) 
    4949{ 
    5050  if (rd->Buffer == rd->BufferLim) 
     
    6767#define ReadByte (RangeDecoderReadByte(rd)) 
    6868 
    69 void RangeDecoderInit(CRangeDecoder *rd, 
     69static void RangeDecoderInit(CRangeDecoder *rd, 
    7070  #ifdef _LZMA_IN_CB 
    7171    ILzmaInCallback *inCallback 
     
    9494#define RC_NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | ReadByte; } 
    9595 
    96 UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits) 
     96static inline UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits) 
    9797{ 
    9898  RC_INIT_VAR 
     
    122122} 
    123123 
    124 int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd) 
     124static inline int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd) 
    125125{ 
    126126  UInt32 bound = (rd->Range >> kNumBitModelTotalBits) * *prob; 
     
    160160#define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;) 
    161161 
    162 int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd) 
     162static inline int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd) 
    163163{ 
    164164  int mi = 1; 
     
    182182} 
    183183 
    184 int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd) 
     184static inline int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd) 
    185185{ 
    186186  int mi = 1; 
     
    207207} 
    208208 
    209 Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd) 
     209static inline Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd) 
    210210{ 
    211211  int symbol = 1; 
     
    229229} 
    230230 
    231 Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte) 
     231static inline Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte) 
    232232{ 
    233233  int symbol = 1; 
     
    287287#define kNumLenProbs (LenHigh + kLenNumHighSymbols) 
    288288 
    289 int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState) 
     289static inline int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState) 
    290290{ 
    291291  if(RangeDecoderBitDecode(p + LenChoice, rd) == 0) 
  • src/linux/ar531x/linux-2.6.23/fs/squashfs/LzmaDecode.h

    r8169 r12400  
    2929/* Use read function for output data */ 
    3030 
    31 /* #define _LZMA_PROB32 */ 
     31#define _LZMA_PROB32 
    3232/* It can increase speed on some 32-bit CPUs, 
    3333   but memory usage will be doubled in that case */ 
    3434 
    35 /* #define _LZMA_LOC_OPT */ 
     35#define _LZMA_LOC_OPT 
    3636/* Enable local speed optimizations inside code */ 
    3737 
  • src/linux/ar531x/linux-2.6.23/include/asm-mips/module.h

    r8169 r12400  
    1010        const struct exception_table_entry *dbe_start; 
    1111        const struct exception_table_entry *dbe_end; 
     12 
     13        unsigned int core_plt_offset; 
     14        unsigned int init_plt_offset; 
    1215}; 
    1316 
     
    6669/* Given an address, look for it in the exception tables. */ 
    6770const struct exception_table_entry*search_module_dbetables(unsigned long addr); 
     71int module_relayout(Elf32_Ehdr *hdr, Elf32_Shdr *sechdrs, 
     72                    char *secstrings, unsigned symindex, struct module *me); 
    6873#else 
    6974/* Given an address, look for it in the exception tables. */ 
  • src/linux/ar531x/linux-2.6.23/include/asm-mips/string.h

    r8169 r12400  
    109109        ".set\tnoreorder\n\t" 
    110110        ".set\tnoat\n" 
    111         "1:\tlbu\t%3,(%0)\n\t" 
    112         "beqz\t%2,2f\n\t" 
     111        "1:\tbeqz\t%2,2f\n\t" 
     112        "nop\n\t" 
     113        "lbu\t%3,(%0)\n\t" 
    113114        "lbu\t$1,(%1)\n\t" 
    114115        "subu\t%2,1\n\t" 
  • src/linux/ar531x/linux-2.6.23/include/linux/netfilter_ipv4/ip_tables.h

    r8169 r12400  
    6363#define IPT_F_GOTO              0x02    /* Set if jump is a goto */ 
    6464#define IPT_F_MASK              0x03    /* All possible flag bits mask. */ 
     65#define IPT_F_NO_DEF_MATCH      0x80    /* Internal: no default match rules present */ 
    6566 
    6667/* Values for "inv" field in struct ipt_ip. */ 
  • src/linux/ar531x/linux-2.6.23/include/linux/skbuff.h

    r8438 r12400  
    12971297                                              gfp_t gfp_mask) 
    12981298{ 
    1299         struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD, gfp_mask); 
     1299        struct sk_buff *skb = alloc_skb(length + 64, gfp_mask); 
    13001300        if (likely(skb)) 
    1301                 skb_reserve(skb, NET_SKB_PAD); 
     1301                skb_reserve(skb, 64); 
    13021302        return skb; 
    13031303} 
  • src/linux/ar531x/linux-2.6.23/kernel/module.c

    r8169 r12400  
    17381738        layout_sections(mod, hdr, sechdrs, secstrings); 
    17391739 
     1740#ifdef __mips 
     1741        module_relayout(hdr, sechdrs, secstrings, symindex, mod); 
     1742#endif 
     1743 
    17401744        /* Do the allocs. */ 
    17411745        ptr = module_alloc(mod->core_size); 
  • src/linux/ar531x/linux-2.6.23/lib/string.c

    r8169 r12400  
    529529        const char *s = src; 
    530530 
    531         while (count--) 
    532                 *tmp++ = *s++; 
     531        unsigned int val,offset=0; 
     532        while(count--) //aligned copy 
     533        { 
     534        if (((unsigned int)offset % 4) == 0) { 
     535                val = *(unsigned int *)s; 
     536                s += 4; 
     537        } 
     538        *tmp++ = ((unsigned char *)&val) + (offset++ & 3); 
     539        } 
    533540        return dest; 
    534541} 
     542 
    535543EXPORT_SYMBOL(memcpy); 
    536544#endif 
    537545 
    538546#ifndef __HAVE_ARCH_MEMMOVE 
     547 
     548void *memcpy_rev(void *dest, const void *src, size_t count) 
     549{ 
     550        char *tmp = dest; 
     551        const char *s = src; 
     552        s+=count; 
     553        tmp+=count; 
     554        unsigned int val,offset=0; 
     555        while(count--) //aligned copy 
     556        { 
     557        if (((unsigned int)offset % 4) == 0) { 
     558                val = *(unsigned int *)s; 
     559                s -= 4; 
     560        } 
     561        *tmp-- = ((unsigned char *)&val) + (offset++ & 3); 
     562        } 
     563        return dest; 
     564} 
     565 
    539566/** 
    540567 * memmove - Copy one area of memory to another 
     
    553580                tmp = dest; 
    554581                s = src; 
    555                 while (count--) 
    556                         *tmp++ = *s++; 
     582                memcpy(tmp,s,count); 
    557583        } else { 
    558584                tmp = dest; 
     
    561587                s += count; 
    562588                while (count--) 
    563                         *--tmp = *--s; 
     589                    memcpy_rev(tmp,s,count); 
    564590        } 
    565591        return dest; 
  • src/linux/ar531x/linux-2.6.23/mm/page_alloc.c

    r8169 r12400  
    12651265 
    12661266        /* 
     1267         * Code in arch/mips/kernel/module.c wants physically 
     1268         * contiguous memory only if there is plenty of free of them. 
     1269         */ 
     1270        if ((gfp_mask & (__GFP_THISNODE | __GFP_NORETRY | __GFP_NOWARN)) 
     1271            == (__GFP_THISNODE | __GFP_NORETRY | __GFP_NOWARN)) 
     1272                goto nopage; 
     1273 
     1274        /* 
    12671275         * GFP_THISNODE (meaning __GFP_THISNODE, __GFP_NORETRY and 
    12681276         * __GFP_NOWARN set) should not cause reclaim since the subsystem 
     
    12771285        for (z = zonelist->zones; *z; z++) 
    12781286                wakeup_kswapd(*z, order); 
     1287 
     1288        if (gfp_mask & 0x80000000) 
     1289            goto nopage; 
    12791290 
    12801291        /* 
  • src/linux/ar531x/linux-2.6.23/net/core/skbuff.c

    r8169 r12400  
    221221        struct sk_buff *skb; 
    222222 
    223         skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node); 
     223        skb = __alloc_skb(length + 64, gfp_mask, 0, node); 
    224224        if (likely(skb)) { 
    225                 skb_reserve(skb, NET_SKB_PAD); 
     225                skb_reserve(skb, 64); 
    226226                skb->dev = dev; 
    227227        } 
  • src/linux/ar531x/linux-2.6.23/net/ipv4/netfilter/ip_tables.c

    r8169 r12400  
    8787#define FWINV(bool,invflg) ((bool) ^ !!(ipinfo->invflags & invflg)) 
    8888 
     89        if (ipinfo->flags & IPT_F_NO_DEF_MATCH) 
     90                return true; 
     91 
    8992        if (FWINV((ip->saddr&ipinfo->smsk.s_addr) != ipinfo->src.s_addr, 
    9093                  IPT_INV_SRCIP) 
     
    149152                return 0; 
    150153        } 
     154#undef FWINV 
    151155 
    152156        return 1; 
     
    154158 
    155159static inline bool 
    156 ip_checkentry(const struct ipt_ip *ip) 
    157 { 
    158         if (ip->flags & ~IPT_F_MASK) { 
     160ip_checkentry(struct ipt_ip *ip) 
     161{ 
     162#define FWINV(bool, invflg) ((bool) || (ip->invflags & (invflg))) 
     163 
     164        if (FWINV(ip->smsk.s_addr, IPT_INV_SRCIP) || 
     165                FWINV(ip->dmsk.s_addr, IPT_INV_DSTIP)) 
     166                goto has_match_rules; 
     167 
     168        if (FWINV(!!((const unsigned long *)ip->iniface_mask)[0], 
     169                IPT_INV_VIA_IN) || 
     170            FWINV(!!((const unsigned long *)ip->outiface_mask)[0], 
     171                IPT_INV_VIA_OUT)) 
     172                goto has_match_rules; 
     173 
     174        if (FWINV(ip->proto, IPT_INV_PROTO)) 
     175                goto has_match_rules; 
     176 
     177        if (FWINV(ip->flags&IPT_F_FRAG, IPT_INV_FRAG)) 
     178                goto has_match_rules; 
     179 
     180        ip->flags |= IPT_F_NO_DEF_MATCH; 
     181 
     182has_match_rules: 
     183        if (ip->flags & ~(IPT_F_MASK|IPT_F_NO_DEF_MATCH)) { 
    159184                duprintf("Unknown flag bits set: %08X\n", 
    160185                         ip->flags & ~IPT_F_MASK); 
     
    166191                return false; 
    167192        } 
     193#undef FWINV 
    168194        return true; 
    169195} 
     
    331357        struct xt_table_info *private; 
    332358 
     359        ip = ip_hdr(*pskb); 
     360 
     361        read_lock_bh(&table->lock); 
     362        IP_NF_ASSERT(table->valid_hooks & (1 << hook)); 
     363        private = table->private; 
     364        table_base = (void *)private->entries[smp_processor_id()]; 
     365        e = get_entry(table_base, private->hook_entry[hook]); 
     366        if (e->target_offset <= sizeof(struct ipt_entry) && 
     367                (e->ip.flags & IPT_F_NO_DEF_MATCH)) { 
     368                        struct ipt_entry_target *t = ipt_get_target(e); 
     369                        if (!t->u.kernel.target->target) { 
     370                                int v = ((struct ipt_standard_target *)t)->verdict; 
     371                                if ((v < 0) && (v != IPT_RETURN)) { 
     372                                        ADD_COUNTER(e->counters, ntohs(ip->tot_len), 1); 
     373                                        read_unlock_bh(&table->lock); 
     374                                        return (unsigned)(-v) - 1; 
     375                                } 
     376                        } 
     377        } 
     378 
    333379        /* Initialization */ 
    334         ip = ip_hdr(*pskb); 
    335380        datalen = (*pskb)->len - ip->ihl * 4; 
    336381        indev = in ? in->name : nulldevname; 
     
    344389        offset = ntohs(ip->frag_off) & IP_OFFSET; 
    345390 
    346         read_lock_bh(&table->lock); 
     391/*      read_lock_bh(&table->lock); 
    347392        IP_NF_ASSERT(table->valid_hooks & (1 << hook)); 
    348393        private = table->private; 
    349394        table_base = (void *)private->entries[smp_processor_id()]; 
    350395        e = get_entry(table_base, private->hook_entry[hook]); 
    351  
     396*/ 
    352397        /* For return from builtin chain */ 
    353398        back = get_entry(table_base, private->underflow[hook]); 
Note: See TracChangeset for help on using the changeset viewer.