Changeset 12400
- Timestamp:
- 06/29/09 18:24:49 (4 years ago)
- Location:
- src/linux/ar531x/linux-2.6.23
- Files:
-
- 20 edited
-
arch/mips/Makefile (modified) (1 diff)
-
arch/mips/atheros/ar5315/board.c (modified) (1 diff)
-
arch/mips/kernel/module.c (modified) (10 diffs)
-
arch/mips/kernel/scall32-o32.S (modified) (1 diff)
-
arch/mips/kernel/vmlinux.lds.S (modified) (1 diff)
-
arch/mips/mm/c-r4k.c (modified) (1 diff)
-
crypto/api.c (modified) (2 diffs)
-
drivers/mtd/devices/spiflash.c (modified) (1 diff)
-
drivers/mtd/maps/eoc5610_flash.c (modified) (8 diffs)
-
fs/squashfs/LzmaDecode.c (modified) (9 diffs)
-
fs/squashfs/LzmaDecode.h (modified) (1 diff)
-
include/asm-mips/module.h (modified) (2 diffs)
-
include/asm-mips/string.h (modified) (1 diff)
-
include/linux/netfilter_ipv4/ip_tables.h (modified) (1 diff)
-
include/linux/skbuff.h (modified) (1 diff)
-
kernel/module.c (modified) (1 diff)
-
lib/string.c (modified) (3 diffs)
-
mm/page_alloc.c (modified) (2 diffs)
-
net/core/skbuff.c (modified) (1 diff)
-
net/ipv4/netfilter/ip_tables.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/linux/ar531x/linux-2.6.23/arch/mips/Makefile
r9058 r12400 84 84 cflags-y += -msoft-float 85 85 LDFLAGS_vmlinux += -G 0 -static -n -nostdlib 86 MODFLAGS += -m long-calls86 MODFLAGS += -mno-long-calls 87 87 88 88 cflags-y += -ffreestanding -
src/linux/ar531x/linux-2.6.23/arch/mips/atheros/ar5315/board.c
r11759 r12400 236 236 /* reset the system */ 237 237 sysRegWrite(AR5315_COLD_RESET,AR5317_RESET_SYSTEM); 238 mdelay(100); 238 239 /* 239 240 * 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 30 30 #include <linux/module.h> 31 31 #include <linux/spinlock.h> 32 #include <linux/mm.h> 32 33 #include <asm/pgtable.h> /* MODULE_START */ 33 34 … … 43 44 static DEFINE_SPINLOCK(dbe_lock); 44 45 46 static 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 69 static 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 45 81 void *module_alloc(unsigned long size) 46 82 { … … 58 94 return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL); 59 95 #else 96 unsigned addr; 97 void *ptr; 98 99 size = PAGE_ALIGN(size); 60 100 if (size == 0) 61 101 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; 63 124 #endif 125 } 126 127 static inline int is_phys(void *ptr) 128 { 129 unsigned addr = (unsigned) ptr; 130 return addr && (addr < VMALLOC_START || addr > VMALLOC_END); 64 131 } 65 132 … … 67 134 void module_free(struct module *mod, void *module_region) 68 135 { 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 69 146 vfree(module_region); 70 147 /* FIXME: If module_region == mod->init_region, trim exception … … 78 155 } 79 156 157 /* Get the potential trampolines size required of the init and 158 non-init sections */ 159 static 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 229 int 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 80 251 static int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v) 81 252 { … … 94 265 *location = v; 95 266 267 return 0; 268 } 269 270 static 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 290 static 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 } 96 305 return 0; 97 306 } … … 105 314 106 315 if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { 316 v = add_plt_entry(me, location, 317 v + ((*location & 0x03ffffff) << 2)); 318 if (v == 0) { 107 319 printk(KERN_ERR 108 320 "module %s: relocation overflow\n", … … 110 322 return -ENOEXEC; 111 323 } 324 *location = (*location & ~0x03ffffff) | 325 ((v >> 2) & 0x03ffffff); 326 return 0; 327 } 112 328 113 329 *location = (*location & ~0x03ffffff) | … … 125 341 126 342 if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { 343 v = add_plt_entry(me, location, v); 344 if (v == 0) { 127 345 printk(KERN_ERR 128 346 "module %s: relocation overflow\n", 129 347 me->name); 130 348 return -ENOEXEC; 349 } 131 350 } 132 351 … … 400 619 spin_unlock_irq(&dbe_lock); 401 620 } 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 } 402 629 return 0; 403 630 } -
src/linux/ar531x/linux-2.6.23/arch/mips/kernel/scall32-o32.S
r8169 r12400 647 647 sys sys_ppoll 5 648 648 sys sys_unshare 1 649 sys sys_splice 4649 sys sys_splice 6 650 650 sys sys_sync_file_range 7 /* 4305 */ 651 651 sys sys_tee 4 -
src/linux/ar531x/linux-2.6.23/arch/mips/kernel/vmlinux.lds.S
r8169 r12400 135 135 *(.bss) 136 136 *(COMMON) 137 } 137 . = (ALIGN(_PAGE_SIZE) - .) < 8 ? ALIGN(_PAGE_SIZE) + 4 : . ; 138 } 138 139 __bss_stop = .; 139 140 -
src/linux/ar531x/linux-2.6.23/arch/mips/mm/c-r4k.c
r11387 r12400 932 932 c->dcache.waybit = __ffs(dcache_size/c->dcache.ways); 933 933 934 #ifdef CONFIG_CPU_HAS_PREFETCH 934 935 c->options |= MIPS_CPU_PREFETCH; 936 #endif 935 937 break; 936 938 } -
src/linux/ar531x/linux-2.6.23/crypto/api.c
r8169 r12400 394 394 return ERR_PTR(err); 395 395 } 396 EXPORT_SYMBOL _GPL(crypto_alloc_base);396 EXPORT_SYMBOL(crypto_alloc_base); 397 397 398 398 /* … … 422 422 } 423 423 424 EXPORT_SYMBOL _GPL(crypto_free_tfm);424 EXPORT_SYMBOL(crypto_free_tfm); 425 425 426 426 int crypto_alg_available(const char *name, u32 flags) -
src/linux/ar531x/linux-2.6.23/drivers/mtd/devices/spiflash.c
r9243 r12400 256 256 257 257 spiflash_regwrite32(SPI_FLASH_CTL, reg); 258 258 259 busy_wait(spiflash_regread32(SPI_FLASH_CTL) & SPI_CTL_BUSY, 0); 259 260 -
src/linux/ar531x/linux-2.6.23/drivers/mtd/maps/eoc5610_flash.c
r11767 r12400 6 6 * Copyright (C) 2006-2007 Tomas Dlabac <tomas@dlabac.net> 7 7 */ 8 8 9 9 /* 10 10 * … … 22 22 #include <linux/squashfs_fs.h> 23 23 24 25 24 #ifdef CONFIG_MTD_PARTITIONS 26 25 #include <linux/mtd/partitions.h> … … 31 30 #define WINDOW_SIZE 0x00800000 32 31 33 34 32 /* These ought to be somewhere common... */ 35 33 36 34 #define AR531X_FLASHCTL 0x18400000 37 35 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) */ 42 40 43 41 #define sysRegRead(phys) __raw_readl(KSEG1ADDR(phys)) 44 42 45 46 43 static struct mtd_info *mymtd; 47 44 48 45 #ifdef CONFIG_MTD_PARTITIONS 49 static const char *probes []={"cmdlinepart",NULL};46 static const char *probes[] = { "cmdlinepart", NULL }; 50 47 #endif 51 48 52 49 struct map_info ar531x_map = { 53 name:"ar531x",54 size:WINDOW_SIZE50 name:"ar531x", 51 size:WINDOW_SIZE 55 52 }; 56 53 57 54 #ifdef CONFIG_MTD_PARTITIONS 58 55 static struct mtd_partition *mtd_parts = 0; 59 static int mtd_parts_nb = 0;56 static int mtd_parts_nb = 0; 60 57 61 58 struct img_info { 62 59 uint32_t lenght; 63 60 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 63 static 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 100 struct 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 103 114 104 115 int __init init_ar531x(void) 105 116 { 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 }; 107 119 const char **type; 108 120 unsigned int flashctl; 109 121 void *buf; 110 size_t retlen;122 size_t retlen; 111 123 int ret; 124 unsigned char *p; 125 struct fis_image_desc *fis; 112 126 struct img_info *image_info; 113 127 struct squashfs_super_block *sb; 114 int len; 128 int len; 129 size_t rootsize; 115 130 116 131 /* This is nasty, but needed as the new AR2312-01 parts only … … 126 141 else { 127 142 printk(KERN_ERR "ar531x illegal flash buswidth (%#x)\n", 128 flashctl);143 flashctl); 129 144 return -ENXIO; 130 145 } 131 146 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); 134 149 135 150 /* … … 139 154 140 155 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 143 158 if (!ar531x_map.virt) { 144 printk("Failed to ioremap\n");145 return -EIO;159 printk("Failed to ioremap\n"); 160 return -EIO; 146 161 } 147 162 … … 150 165 mymtd = 0; 151 166 type = rom_probe_types; 152 for (; !mymtd && *type; type++) {167 for (; !mymtd && *type; type++) { 153 168 mymtd = do_map_probe(*type, &ar531x_map); 154 169 } 155 170 if (mymtd) { 156 171 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; 173 189 len = sb->bytes_used; 174 len += (mymtd->erasesize - 1);190 len += (mymtd->erasesize - 1); 175 191 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 } 182 251 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);191 252 } 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 } 194 265 #endif 195 266 196 267 return 0; 197 268 } 198 iounmap ((void *)ar531x_map.virt);269 iounmap((void *)ar531x_map.virt); 199 270 return -ENXIO; 200 271 } … … 207 278 } 208 279 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; 211 282 } 212 283 } … … 214 285 module_init(init_ar531x); 215 286 module_exit(cleanup_ar531x); 216 217 287 218 288 MODULE_LICENSE("GPL"); -
src/linux/ar531x/linux-2.6.23/fs/squashfs/LzmaDecode.c
r8169 r12400 46 46 } CRangeDecoder; 47 47 48 Byte RangeDecoderReadByte(CRangeDecoder *rd)48 static inline Byte RangeDecoderReadByte(CRangeDecoder *rd) 49 49 { 50 50 if (rd->Buffer == rd->BufferLim) … … 67 67 #define ReadByte (RangeDecoderReadByte(rd)) 68 68 69 void RangeDecoderInit(CRangeDecoder *rd,69 static void RangeDecoderInit(CRangeDecoder *rd, 70 70 #ifdef _LZMA_IN_CB 71 71 ILzmaInCallback *inCallback … … 94 94 #define RC_NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | ReadByte; } 95 95 96 UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits)96 static inline UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits) 97 97 { 98 98 RC_INIT_VAR … … 122 122 } 123 123 124 int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd)124 static inline int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd) 125 125 { 126 126 UInt32 bound = (rd->Range >> kNumBitModelTotalBits) * *prob; … … 160 160 #define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;) 161 161 162 int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)162 static inline int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd) 163 163 { 164 164 int mi = 1; … … 182 182 } 183 183 184 int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)184 static inline int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd) 185 185 { 186 186 int mi = 1; … … 207 207 } 208 208 209 Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd)209 static inline Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd) 210 210 { 211 211 int symbol = 1; … … 229 229 } 230 230 231 Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte)231 static inline Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte) 232 232 { 233 233 int symbol = 1; … … 287 287 #define kNumLenProbs (LenHigh + kLenNumHighSymbols) 288 288 289 int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState)289 static inline int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState) 290 290 { 291 291 if(RangeDecoderBitDecode(p + LenChoice, rd) == 0) -
src/linux/ar531x/linux-2.6.23/fs/squashfs/LzmaDecode.h
r8169 r12400 29 29 /* Use read function for output data */ 30 30 31 /* #define _LZMA_PROB32 */ 31 #define _LZMA_PROB32 32 32 /* It can increase speed on some 32-bit CPUs, 33 33 but memory usage will be doubled in that case */ 34 34 35 /* #define _LZMA_LOC_OPT */ 35 #define _LZMA_LOC_OPT 36 36 /* Enable local speed optimizations inside code */ 37 37 -
src/linux/ar531x/linux-2.6.23/include/asm-mips/module.h
r8169 r12400 10 10 const struct exception_table_entry *dbe_start; 11 11 const struct exception_table_entry *dbe_end; 12 13 unsigned int core_plt_offset; 14 unsigned int init_plt_offset; 12 15 }; 13 16 … … 66 69 /* Given an address, look for it in the exception tables. */ 67 70 const struct exception_table_entry*search_module_dbetables(unsigned long addr); 71 int module_relayout(Elf32_Ehdr *hdr, Elf32_Shdr *sechdrs, 72 char *secstrings, unsigned symindex, struct module *me); 68 73 #else 69 74 /* Given an address, look for it in the exception tables. */ -
src/linux/ar531x/linux-2.6.23/include/asm-mips/string.h
r8169 r12400 109 109 ".set\tnoreorder\n\t" 110 110 ".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" 113 114 "lbu\t$1,(%1)\n\t" 114 115 "subu\t%2,1\n\t" -
src/linux/ar531x/linux-2.6.23/include/linux/netfilter_ipv4/ip_tables.h
r8169 r12400 63 63 #define IPT_F_GOTO 0x02 /* Set if jump is a goto */ 64 64 #define IPT_F_MASK 0x03 /* All possible flag bits mask. */ 65 #define IPT_F_NO_DEF_MATCH 0x80 /* Internal: no default match rules present */ 65 66 66 67 /* Values for "inv" field in struct ipt_ip. */ -
src/linux/ar531x/linux-2.6.23/include/linux/skbuff.h
r8438 r12400 1297 1297 gfp_t gfp_mask) 1298 1298 { 1299 struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD, gfp_mask);1299 struct sk_buff *skb = alloc_skb(length + 64, gfp_mask); 1300 1300 if (likely(skb)) 1301 skb_reserve(skb, NET_SKB_PAD);1301 skb_reserve(skb, 64); 1302 1302 return skb; 1303 1303 } -
src/linux/ar531x/linux-2.6.23/kernel/module.c
r8169 r12400 1738 1738 layout_sections(mod, hdr, sechdrs, secstrings); 1739 1739 1740 #ifdef __mips 1741 module_relayout(hdr, sechdrs, secstrings, symindex, mod); 1742 #endif 1743 1740 1744 /* Do the allocs. */ 1741 1745 ptr = module_alloc(mod->core_size); -
src/linux/ar531x/linux-2.6.23/lib/string.c
r8169 r12400 529 529 const char *s = src; 530 530 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 } 533 540 return dest; 534 541 } 542 535 543 EXPORT_SYMBOL(memcpy); 536 544 #endif 537 545 538 546 #ifndef __HAVE_ARCH_MEMMOVE 547 548 void *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 539 566 /** 540 567 * memmove - Copy one area of memory to another … … 553 580 tmp = dest; 554 581 s = src; 555 while (count--) 556 *tmp++ = *s++; 582 memcpy(tmp,s,count); 557 583 } else { 558 584 tmp = dest; … … 561 587 s += count; 562 588 while (count--) 563 *--tmp = *--s;589 memcpy_rev(tmp,s,count); 564 590 } 565 591 return dest; -
src/linux/ar531x/linux-2.6.23/mm/page_alloc.c
r8169 r12400 1265 1265 1266 1266 /* 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 /* 1267 1275 * GFP_THISNODE (meaning __GFP_THISNODE, __GFP_NORETRY and 1268 1276 * __GFP_NOWARN set) should not cause reclaim since the subsystem … … 1277 1285 for (z = zonelist->zones; *z; z++) 1278 1286 wakeup_kswapd(*z, order); 1287 1288 if (gfp_mask & 0x80000000) 1289 goto nopage; 1279 1290 1280 1291 /* -
src/linux/ar531x/linux-2.6.23/net/core/skbuff.c
r8169 r12400 221 221 struct sk_buff *skb; 222 222 223 skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node);223 skb = __alloc_skb(length + 64, gfp_mask, 0, node); 224 224 if (likely(skb)) { 225 skb_reserve(skb, NET_SKB_PAD);225 skb_reserve(skb, 64); 226 226 skb->dev = dev; 227 227 } -
src/linux/ar531x/linux-2.6.23/net/ipv4/netfilter/ip_tables.c
r8169 r12400 87 87 #define FWINV(bool,invflg) ((bool) ^ !!(ipinfo->invflags & invflg)) 88 88 89 if (ipinfo->flags & IPT_F_NO_DEF_MATCH) 90 return true; 91 89 92 if (FWINV((ip->saddr&ipinfo->smsk.s_addr) != ipinfo->src.s_addr, 90 93 IPT_INV_SRCIP) … … 149 152 return 0; 150 153 } 154 #undef FWINV 151 155 152 156 return 1; … … 154 158 155 159 static inline bool 156 ip_checkentry(const struct ipt_ip *ip) 157 { 158 if (ip->flags & ~IPT_F_MASK) { 160 ip_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 182 has_match_rules: 183 if (ip->flags & ~(IPT_F_MASK|IPT_F_NO_DEF_MATCH)) { 159 184 duprintf("Unknown flag bits set: %08X\n", 160 185 ip->flags & ~IPT_F_MASK); … … 166 191 return false; 167 192 } 193 #undef FWINV 168 194 return true; 169 195 } … … 331 357 struct xt_table_info *private; 332 358 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 333 379 /* Initialization */ 334 ip = ip_hdr(*pskb);335 380 datalen = (*pskb)->len - ip->ihl * 4; 336 381 indev = in ? in->name : nulldevname; … … 344 389 offset = ntohs(ip->frag_off) & IP_OFFSET; 345 390 346 read_lock_bh(&table->lock);391 /* read_lock_bh(&table->lock); 347 392 IP_NF_ASSERT(table->valid_hooks & (1 << hook)); 348 393 private = table->private; 349 394 table_base = (void *)private->entries[smp_processor_id()]; 350 395 e = get_entry(table_base, private->hook_entry[hook]); 351 396 */ 352 397 /* For return from builtin chain */ 353 398 back = get_entry(table_base, private->underflow[hook]);
Note: See TracChangeset
for help on using the changeset viewer.
