mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-09 22:15:55 +02:00
uncompress patches, requested by Kaloz
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@460 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
f26476c862
commit
94756d4adc
25246
openwrt/package/linux/kernel-patches/000-linux-mips-cvs
Normal file
25246
openwrt/package/linux/kernel-patches/000-linux-mips-cvs
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
43
openwrt/package/linux/kernel-patches/001-Makefile
Normal file
43
openwrt/package/linux/kernel-patches/001-Makefile
Normal file
@ -0,0 +1,43 @@
|
||||
--- ../../../kernel/linux-mips-cvs/Makefile 2005-01-20 03:19:21.000000000 +0100
|
||||
+++ linux-2.4.29.new/Makefile 2005-03-15 01:15:27.441095231 +0100
|
||||
@@ -17,9 +17,9 @@
|
||||
FINDHPATH = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net $(HPATH)/math-emu
|
||||
|
||||
HOSTCC = gcc
|
||||
-HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
|
||||
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Os -fomit-frame-pointer
|
||||
|
||||
-CROSS_COMPILE =
|
||||
+CROSS_COMPILE=
|
||||
|
||||
#
|
||||
# Include the make variables (CC, etc...)
|
||||
@@ -91,8 +91,18 @@
|
||||
|
||||
CPPFLAGS := -D__KERNEL__ -I$(HPATH)
|
||||
|
||||
-CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
|
||||
+CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
|
||||
-fno-strict-aliasing -fno-common
|
||||
+
|
||||
+
|
||||
+# Turn on -pg to instrument the kernel with calls to mcount().
|
||||
+# Unfortunately, gcc won't allow -pg without frame pointers.
|
||||
+ifdef CONFIG_MCOUNT
|
||||
+ CFLAGS += -pg
|
||||
+ CFLAGS_KERNEL += -pg
|
||||
+ CONFIG_FRAME_POINTER = 1
|
||||
+endif
|
||||
+
|
||||
ifndef CONFIG_FRAME_POINTER
|
||||
CFLAGS += -fomit-frame-pointer
|
||||
endif
|
||||
@@ -501,7 +511,7 @@
|
||||
ifdef CONFIG_MODVERSIONS
|
||||
$(MAKE) update-modverfile
|
||||
endif
|
||||
- scripts/mkdep -- `find $(FINDHPATH) \( -name SCCS -o -name .svn \) -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend
|
||||
+ (find $(FINDHPATH) \( -name SCCS -o -name .svn \) -prune -o -follow -name \*.h ! -name modversions.h -print | xargs -r scripts/mkdep -- ) > .hdepend
|
||||
scripts/mkdep -- init/*.c > .depend
|
||||
|
||||
ifdef CONFIG_MODVERSIONS
|
Binary file not shown.
18
openwrt/package/linux/kernel-patches/002-Rules_make
Normal file
18
openwrt/package/linux/kernel-patches/002-Rules_make
Normal file
@ -0,0 +1,18 @@
|
||||
--- linux-mips-cvs/Rules.make 2003-08-13 17:39:03.000000000 +0200
|
||||
+++ linux-broadcom/Rules.make 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -176,7 +176,14 @@
|
||||
_modinst__: dummy
|
||||
ifneq "$(strip $(ALL_MOBJS))" ""
|
||||
mkdir -p $(MODLIB)/kernel/$(MOD_DESTDIR)
|
||||
- cp $(sort $(ALL_MOBJS)) $(MODLIB)/kernel/$(MOD_DESTDIR)
|
||||
+ @#cp $(sort $(ALL_MOBJS)) $(MODLIB)/kernel/$(MOD_DESTDIR)
|
||||
+ for f in $(ALL_MOBJS) ; do \
|
||||
+ $(OBJCOPY) -R __ksymtab -R .comment -R .note -x \
|
||||
+ `$(NM) $$f | cut -f3- -d' ' | sed -n \
|
||||
+ -e 's/__module_parm_\(.*\)/-K \1/p' \
|
||||
+ -e 's/__ks..tab_\(.*\)/-K \1/p'` \
|
||||
+ $$f $(MODLIB)/kernel/$(MOD_DESTDIR)$(MOD_TARGET)$$f ; \
|
||||
+ done
|
||||
endif
|
||||
|
||||
.PHONY: modules_install
|
Binary file not shown.
42
openwrt/package/linux/kernel-patches/003-arch_mips_Makefile
Normal file
42
openwrt/package/linux/kernel-patches/003-arch_mips_Makefile
Normal file
@ -0,0 +1,42 @@
|
||||
--- linux-mips-cvs/arch/mips/Makefile 2005-01-31 12:59:28.000000000 +0100
|
||||
+++ linux-broadcom/arch/mips/Makefile 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -47,9 +47,9 @@
|
||||
GCCFLAGS += -G 0 -mno-abicalls -fno-pic -pipe
|
||||
GCCFLAGS += $(call check_gcc, -finline-limit=100000,)
|
||||
LINKFLAGS += -G 0 -static -n
|
||||
-MODFLAGS += -mlong-calls
|
||||
+MODFLAGS += -mlong-calls -fno-common
|
||||
|
||||
-ifdef CONFIG_DEBUG_INFO
|
||||
+ifdef CONFIG_REMOTE_DEBUG
|
||||
GCCFLAGS += -g
|
||||
ifdef CONFIG_SB1XXX_CORELIS
|
||||
GCCFLAGS += -mno-sched-prolog -fno-omit-frame-pointer
|
||||
@@ -174,6 +174,7 @@
|
||||
endif
|
||||
|
||||
AFLAGS += $(GCCFLAGS)
|
||||
+ASFLAGS += $(GCCFLAGS)
|
||||
CFLAGS += $(GCCFLAGS)
|
||||
|
||||
LD += -m $(ld-emul)
|
||||
@@ -727,6 +728,19 @@
|
||||
endif
|
||||
|
||||
#
|
||||
+# Broadcom BCM947XX variants
|
||||
+#
|
||||
+ifdef CONFIG_BCM947XX
|
||||
+LIBS += arch/mips/brcm-boards/generic/brcm.o arch/mips/brcm-boards/bcm947xx/bcm947xx.o
|
||||
+SUBDIRS += arch/mips/brcm-boards/generic arch/mips/brcm-boards/bcm947xx
|
||||
+LOADADDR := 0x80001000
|
||||
+
|
||||
+zImage: vmlinux
|
||||
+ $(MAKE) -C arch/$(ARCH)/brcm-boards/bcm947xx/compressed
|
||||
+export LOADADDR
|
||||
+endif
|
||||
+
|
||||
+#
|
||||
# Choosing incompatible machines durings configuration will result in
|
||||
# error messages during linking. Select a default linkscript if
|
||||
# none has been choosen above.
|
Binary file not shown.
@ -0,0 +1,56 @@
|
||||
--- ../../../kernel/linux-mips-cvs/arch/mips/config-shared.in 2005-01-31 12:59:28.000000000 +0100
|
||||
+++ linux-2.4.29/arch/mips/config-shared.in 2005-03-12 19:51:22.474214917 +0100
|
||||
@@ -208,6 +208,14 @@
|
||||
fi
|
||||
define_bool CONFIG_MIPS_RTC y
|
||||
fi
|
||||
+dep_bool 'Support for Broadcom MIPS-based boards' CONFIG_MIPS_BRCM $CONFIG_EXPERIMENTAL
|
||||
+dep_bool 'Support for Broadcom BCM947XX' CONFIG_BCM947XX $CONFIG_MIPS_BRCM
|
||||
+if [ "$CONFIG_BCM947XX" = "y" ] ; then
|
||||
+ bool ' Support for Broadcom BCM4710' CONFIG_BCM4710
|
||||
+ bool ' Support for Broadcom BCM4310' CONFIG_BCM4310
|
||||
+ bool ' Support for Broadcom BCM4704' CONFIG_BCM4704
|
||||
+ bool ' Support for Broadcom BCM5365' CONFIG_BCM5365
|
||||
+fi
|
||||
bool 'Support for SNI RM200 PCI' CONFIG_SNI_RM200_PCI
|
||||
bool 'Support for TANBAC TB0226 (Mbase)' CONFIG_TANBAC_TB0226
|
||||
bool 'Support for TANBAC TB0229 (VR4131DIMM)' CONFIG_TANBAC_TB0229
|
||||
@@ -229,6 +237,11 @@
|
||||
define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM n
|
||||
|
||||
#
|
||||
+# Provide an option for a default kernel command line
|
||||
+#
|
||||
+string 'Default kernel command string' CONFIG_CMDLINE ""
|
||||
+
|
||||
+#
|
||||
# Select some configuration options automatically based on user selections.
|
||||
#
|
||||
if [ "$CONFIG_ACER_PICA_61" = "y" ]; then
|
||||
@@ -554,6 +567,13 @@
|
||||
define_bool CONFIG_SWAP_IO_SPACE_L y
|
||||
define_bool CONFIG_BOOT_ELF32 y
|
||||
fi
|
||||
+if [ "$CONFIG_BCM947XX" = "y" ] ; then
|
||||
+ define_bool CONFIG_PCI y
|
||||
+ define_bool CONFIG_NONCOHERENT_IO y
|
||||
+ define_bool CONFIG_NEW_TIME_C y
|
||||
+ define_bool CONFIG_NEW_IRQ y
|
||||
+ define_bool CONFIG_HND y
|
||||
+fi
|
||||
if [ "$CONFIG_SNI_RM200_PCI" = "y" ]; then
|
||||
define_bool CONFIG_ARC32 y
|
||||
define_bool CONFIG_ARC_MEMORY y
|
||||
@@ -1039,7 +1059,11 @@
|
||||
|
||||
bool 'Are you using a crosscompiler' CONFIG_CROSSCOMPILE
|
||||
bool 'Enable run-time debugging' CONFIG_RUNTIME_DEBUG
|
||||
-bool 'Remote GDB kernel debugging' CONFIG_KGDB
|
||||
+if [ "$CONFIG_BCM947XX" = "y" ] ; then
|
||||
+ bool 'Remote GDB kernel debugging' CONFIG_REMOTE_DEBUG
|
||||
+else
|
||||
+ bool 'Remote GDB kernel debugging' CONFIG_KGDB
|
||||
+fi
|
||||
dep_bool ' Console output to GDB' CONFIG_GDB_CONSOLE $CONFIG_KGDB
|
||||
if [ "$CONFIG_KGDB" = "y" ]; then
|
||||
define_bool CONFIG_DEBUG_INFO y
|
Binary file not shown.
@ -0,0 +1,121 @@
|
||||
--- linux-mips-cvs/arch/mips/kernel/cpu-probe.c 2005-01-31 12:59:30.000000000 +0100
|
||||
+++ linux-broadcom/arch/mips/kernel/cpu-probe.c 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -175,7 +175,7 @@
|
||||
|
||||
static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
|
||||
{
|
||||
- switch (c->processor_id & 0xff00) {
|
||||
+ switch (c->processor_id & PRID_IMP_MASK) {
|
||||
case PRID_IMP_R2000:
|
||||
c->cputype = CPU_R2000;
|
||||
c->isa_level = MIPS_CPU_ISA_I;
|
||||
@@ -185,7 +185,7 @@
|
||||
c->tlbsize = 64;
|
||||
break;
|
||||
case PRID_IMP_R3000:
|
||||
- if ((c->processor_id & 0xff) == PRID_REV_R3000A)
|
||||
+ if ((c->processor_id & PRID_REV_MASK) == PRID_REV_R3000A)
|
||||
if (cpu_has_confreg())
|
||||
c->cputype = CPU_R3081E;
|
||||
else
|
||||
@@ -200,12 +200,12 @@
|
||||
break;
|
||||
case PRID_IMP_R4000:
|
||||
if (read_c0_config() & CONF_SC) {
|
||||
- if ((c->processor_id & 0xff) >= PRID_REV_R4400)
|
||||
+ if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_R4400)
|
||||
c->cputype = CPU_R4400PC;
|
||||
else
|
||||
c->cputype = CPU_R4000PC;
|
||||
} else {
|
||||
- if ((c->processor_id & 0xff) >= PRID_REV_R4400)
|
||||
+ if ((c->processor_id & PRID_REV_MASK) >= PRID_REV_R4400)
|
||||
c->cputype = CPU_R4400SC;
|
||||
else
|
||||
c->cputype = CPU_R4000SC;
|
||||
@@ -451,7 +451,7 @@
|
||||
static inline void cpu_probe_mips(struct cpuinfo_mips *c)
|
||||
{
|
||||
decode_config1(c);
|
||||
- switch (c->processor_id & 0xff00) {
|
||||
+ switch (c->processor_id & PRID_IMP_MASK) {
|
||||
case PRID_IMP_4KC:
|
||||
c->cputype = CPU_4KC;
|
||||
c->isa_level = MIPS_CPU_ISA_M32;
|
||||
@@ -492,10 +492,10 @@
|
||||
{
|
||||
decode_config1(c);
|
||||
c->options |= MIPS_CPU_PREFETCH;
|
||||
- switch (c->processor_id & 0xff00) {
|
||||
+ switch (c->processor_id & PRID_IMP_MASK) {
|
||||
case PRID_IMP_AU1_REV1:
|
||||
case PRID_IMP_AU1_REV2:
|
||||
- switch ((c->processor_id >> 24) & 0xff) {
|
||||
+ switch ((c->processor_id >> 24) & PRID_REV_MASK) {
|
||||
case 0:
|
||||
c->cputype = CPU_AU1000;
|
||||
break;
|
||||
@@ -523,10 +523,34 @@
|
||||
}
|
||||
}
|
||||
|
||||
+static inline void cpu_probe_broadcom(struct cpuinfo_mips *c)
|
||||
+{
|
||||
+ decode_config1(c);
|
||||
+ c->options |= MIPS_CPU_PREFETCH;
|
||||
+ switch (c->processor_id & PRID_IMP_MASK) {
|
||||
+ case PRID_IMP_BCM4710:
|
||||
+ c->cputype = CPU_BCM4710;
|
||||
+ c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
|
||||
+ MIPS_CPU_4KTLB | MIPS_CPU_COUNTER;
|
||||
+ c->scache.flags = MIPS_CACHE_NOT_PRESENT;
|
||||
+ break;
|
||||
+ case PRID_IMP_4KC:
|
||||
+ case PRID_IMP_BCM3302:
|
||||
+ c->cputype = CPU_BCM3302;
|
||||
+ c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX |
|
||||
+ MIPS_CPU_4KTLB | MIPS_CPU_COUNTER;
|
||||
+ c->scache.flags = MIPS_CACHE_NOT_PRESENT;
|
||||
+ break;
|
||||
+ default:
|
||||
+ c->cputype = CPU_UNKNOWN;
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static inline void cpu_probe_sibyte(struct cpuinfo_mips *c)
|
||||
{
|
||||
decode_config1(c);
|
||||
- switch (c->processor_id & 0xff00) {
|
||||
+ switch (c->processor_id & PRID_IMP_MASK) {
|
||||
case PRID_IMP_SB1:
|
||||
c->cputype = CPU_SB1;
|
||||
c->isa_level = MIPS_CPU_ISA_M64;
|
||||
@@ -548,7 +572,7 @@
|
||||
static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c)
|
||||
{
|
||||
decode_config1(c);
|
||||
- switch (c->processor_id & 0xff00) {
|
||||
+ switch (c->processor_id & PRID_IMP_MASK) {
|
||||
case PRID_IMP_SR71000:
|
||||
c->cputype = CPU_SR71000;
|
||||
c->isa_level = MIPS_CPU_ISA_M64;
|
||||
@@ -573,7 +597,7 @@
|
||||
c->cputype = CPU_UNKNOWN;
|
||||
|
||||
c->processor_id = read_c0_prid();
|
||||
- switch (c->processor_id & 0xff0000) {
|
||||
+ switch (c->processor_id & PRID_COMP_MASK) {
|
||||
|
||||
case PRID_COMP_LEGACY:
|
||||
cpu_probe_legacy(c);
|
||||
@@ -584,6 +608,9 @@
|
||||
case PRID_COMP_ALCHEMY:
|
||||
cpu_probe_alchemy(c);
|
||||
break;
|
||||
+ case PRID_COMP_BROADCOM:
|
||||
+ cpu_probe_broadcom(c);
|
||||
+ break;
|
||||
case PRID_COMP_SIBYTE:
|
||||
cpu_probe_sibyte(c);
|
||||
break;
|
Binary file not shown.
@ -0,0 +1,24 @@
|
||||
--- linux-mips-cvs/arch/mips/kernel/head.S 2004-11-22 14:38:23.000000000 +0100
|
||||
+++ linux-broadcom/arch/mips/kernel/head.S 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -28,12 +28,20 @@
|
||||
#include <asm/mipsregs.h>
|
||||
#include <asm/stackframe.h>
|
||||
|
||||
+#ifdef CONFIG_BCM4710
|
||||
+#undef eret
|
||||
+#define eret nop; nop; eret
|
||||
+#endif
|
||||
+
|
||||
.text
|
||||
+ j kernel_entry
|
||||
+ nop
|
||||
+
|
||||
/*
|
||||
* Reserved space for exception handlers.
|
||||
* Necessary for machines which link their kernels at KSEG0.
|
||||
*/
|
||||
- .fill 0x400
|
||||
+ .fill 0x3f4
|
||||
|
||||
/* The following two symbols are used for kernel profiling. */
|
||||
EXPORT(stext)
|
Binary file not shown.
@ -0,0 +1,14 @@
|
||||
--- linux-mips-cvs/arch/mips/kernel/proc.c 2004-07-07 20:19:37.000000000 +0200
|
||||
+++ linux-broadcom/arch/mips/kernel/proc.c 2005-01-31 13:58:35.000000000 +0100
|
||||
@@ -78,9 +78,10 @@
|
||||
[CPU_AU1550] "Au1550",
|
||||
[CPU_24K] "MIPS 24K",
|
||||
[CPU_AU1200] "Au1200",
|
||||
+ [CPU_BCM4710] "BCM4710",
|
||||
+ [CPU_BCM3302] "BCM3302",
|
||||
};
|
||||
|
||||
-
|
||||
static int show_cpuinfo(struct seq_file *m, void *v)
|
||||
{
|
||||
unsigned int version = current_cpu_data.processor_id;
|
Binary file not shown.
@ -0,0 +1,22 @@
|
||||
--- linux-mips-cvs/arch/mips/kernel/setup.c 2005-01-13 22:15:57.000000000 +0100
|
||||
+++ linux-broadcom/arch/mips/kernel/setup.c 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -493,6 +493,7 @@
|
||||
void swarm_setup(void);
|
||||
void hp_setup(void);
|
||||
void au1x00_setup(void);
|
||||
+ void brcm_setup(void);
|
||||
void frame_info_init(void);
|
||||
|
||||
frame_info_init();
|
||||
@@ -691,6 +692,11 @@
|
||||
pmc_yosemite_setup();
|
||||
break;
|
||||
#endif
|
||||
+#if defined(CONFIG_BCM4710) || defined(CONFIG_BCM4310)
|
||||
+ case MACH_GROUP_BRCM:
|
||||
+ brcm_setup();
|
||||
+ break;
|
||||
+#endif
|
||||
default:
|
||||
panic("Unsupported architecture");
|
||||
}
|
Binary file not shown.
@ -0,0 +1,31 @@
|
||||
--- linux-mips-cvs/arch/mips/kernel/traps.c 2004-11-22 14:38:23.000000000 +0100
|
||||
+++ linux-broadcom/arch/mips/kernel/traps.c 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -919,6 +919,7 @@
|
||||
void __init trap_init(void)
|
||||
{
|
||||
extern char except_vec1_generic;
|
||||
+ extern char except_vec2_generic;
|
||||
extern char except_vec3_generic, except_vec3_r4000;
|
||||
extern char except_vec_ejtag_debug;
|
||||
extern char except_vec4;
|
||||
@@ -926,6 +927,7 @@
|
||||
|
||||
/* Copy the generic exception handler code to it's final destination. */
|
||||
memcpy((void *)(KSEG0 + 0x80), &except_vec1_generic, 0x80);
|
||||
+ memcpy((void *)(KSEG0 + 0x100), &except_vec2_generic, 0x80);
|
||||
|
||||
/*
|
||||
* Setup default vectors
|
||||
@@ -984,6 +986,12 @@
|
||||
set_except_vector(13, handle_tr);
|
||||
set_except_vector(22, handle_mdmx);
|
||||
|
||||
+ if (current_cpu_data.cputype == CPU_SB1) {
|
||||
+ /* Enable timer interrupt and scd mapped interrupt */
|
||||
+ clear_c0_status(0xf000);
|
||||
+ set_c0_status(0xc00);
|
||||
+ }
|
||||
+
|
||||
if (cpu_has_fpu && !cpu_has_nofpuex)
|
||||
set_except_vector(15, handle_fpe);
|
||||
|
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
--- linux-mips-cvs/arch/mips/pci/Makefile 2004-07-31 02:12:38.000000000 +0200
|
||||
+++ linux-broadcom/arch/mips/pci/Makefile 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -13,7 +13,9 @@
|
||||
obj-$(CONFIG_MIPS_MSC) += ops-msc.o
|
||||
obj-$(CONFIG_MIPS_NILE4) += ops-nile4.o
|
||||
obj-$(CONFIG_SNI_RM200_PCI) += ops-sni.o
|
||||
+ifndef CONFIG_BCM947XX
|
||||
obj-y += pci.o
|
||||
+endif
|
||||
obj-$(CONFIG_PCI_AUTO) += pci_auto.o
|
||||
|
||||
include $(TOPDIR)/Rules.make
|
Binary file not shown.
12
openwrt/package/linux/kernel-patches/018_drivers_char_mem_c
Normal file
12
openwrt/package/linux/kernel-patches/018_drivers_char_mem_c
Normal file
@ -0,0 +1,12 @@
|
||||
--- linux-mips-cvs/drivers/char/mem.c 2004-08-14 20:38:49.000000000 +0200
|
||||
+++ linux-broadcom/drivers/char/mem.c 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -713,7 +713,8 @@
|
||||
{1, "mem", S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops},
|
||||
{2, "kmem", S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops},
|
||||
{3, "null", S_IRUGO | S_IWUGO, &null_fops},
|
||||
-#if defined(CONFIG_ISA) || !defined(__mc68000__)
|
||||
+#if defined(CONFIG_ISA) || !defined(__mc68000__) || \
|
||||
+ defined(CONFIG_BCM94702_CPCI)
|
||||
{4, "port", S_IRUSR | S_IWUSR | S_IRGRP, &port_fops},
|
||||
#endif
|
||||
{5, "zero", S_IRUGO | S_IWUGO, &zero_fops},
|
Binary file not shown.
@ -0,0 +1,37 @@
|
||||
--- linux-mips-cvs/drivers/char/serial.c 2004-12-27 05:13:43.000000000 +0100
|
||||
+++ linux-broadcom/drivers/char/serial.c 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -444,6 +444,10 @@
|
||||
return inb(info->port+1);
|
||||
#endif
|
||||
case SERIAL_IO_MEM:
|
||||
+#ifdef CONFIG_BCM4310
|
||||
+ readb((unsigned long) info->iomem_base +
|
||||
+ (UART_SCR<<info->iomem_reg_shift));
|
||||
+#endif
|
||||
return readb((unsigned long) info->iomem_base +
|
||||
(offset<<info->iomem_reg_shift));
|
||||
default:
|
||||
@@ -464,6 +468,9 @@
|
||||
case SERIAL_IO_MEM:
|
||||
writeb(value, (unsigned long) info->iomem_base +
|
||||
(offset<<info->iomem_reg_shift));
|
||||
+#ifdef CONFIG_BCM4704
|
||||
+ *((volatile unsigned int *) KSEG1ADDR(0x18000000));
|
||||
+#endif
|
||||
break;
|
||||
default:
|
||||
outb(value, info->port+offset);
|
||||
@@ -5996,6 +6003,13 @@
|
||||
* Divisor, bytesize and parity
|
||||
*/
|
||||
state = rs_table + co->index;
|
||||
+ /*
|
||||
+ * Safe guard: state structure must have been initialized
|
||||
+ */
|
||||
+ if (state->iomem_base == NULL) {
|
||||
+ printk("!unable to setup serial console!\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
if (doflow)
|
||||
state->flags |= ASYNC_CONS_FLOW;
|
||||
info = &async_sercons;
|
Binary file not shown.
105
openwrt/package/linux/kernel-patches/020-drivers_mtd-jumbo
Normal file
105
openwrt/package/linux/kernel-patches/020-drivers_mtd-jumbo
Normal file
@ -0,0 +1,105 @@
|
||||
diff -Nur linux-mips-cvs/drivers/mtd/chips/Config.in linux-broadcom/drivers/mtd/chips/Config.in
|
||||
--- linux-mips-cvs/drivers/mtd/chips/Config.in 2003-02-26 01:53:49.000000000 +0100
|
||||
+++ linux-broadcom/drivers/mtd/chips/Config.in 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -45,6 +45,7 @@
|
||||
dep_tristate ' Support for Intel/Sharp flash chips' CONFIG_MTD_CFI_INTELEXT $CONFIG_MTD_GEN_PROBE
|
||||
dep_tristate ' Support for AMD/Fujitsu flash chips' CONFIG_MTD_CFI_AMDSTD $CONFIG_MTD_GEN_PROBE
|
||||
dep_tristate ' Support for ST (Advanced Architecture) flash chips' CONFIG_MTD_CFI_STAA $CONFIG_MTD_GEN_PROBE
|
||||
+dep_tristate ' Support for SST flash chips' CONFIG_MTD_CFI_SSTSTD $CONFIG_MTD_GEN_PROBE
|
||||
|
||||
dep_tristate ' Support for RAM chips in bus mapping' CONFIG_MTD_RAM $CONFIG_MTD
|
||||
dep_tristate ' Support for ROM chips in bus mapping' CONFIG_MTD_ROM $CONFIG_MTD
|
||||
diff -Nur linux-mips-cvs/drivers/mtd/chips/Makefile linux-broadcom/drivers/mtd/chips/Makefile
|
||||
--- linux-mips-cvs/drivers/mtd/chips/Makefile 2003-07-05 05:23:38.000000000 +0200
|
||||
+++ linux-broadcom/drivers/mtd/chips/Makefile 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -18,6 +18,7 @@
|
||||
obj-$(CONFIG_MTD_AMDSTD) += amd_flash.o
|
||||
obj-$(CONFIG_MTD_CFI) += cfi_probe.o
|
||||
obj-$(CONFIG_MTD_CFI_STAA) += cfi_cmdset_0020.o
|
||||
+obj-$(CONFIG_MTD_CFI_SSTSTD) += cfi_cmdset_0701.o
|
||||
obj-$(CONFIG_MTD_CFI_AMDSTD) += cfi_cmdset_0002.o
|
||||
obj-$(CONFIG_MTD_CFI_INTELEXT) += cfi_cmdset_0001.o
|
||||
obj-$(CONFIG_MTD_GEN_PROBE) += gen_probe.o
|
||||
diff -Nur linux-mips-cvs/drivers/mtd/chips/cfi_probe.c linux-broadcom/drivers/mtd/chips/cfi_probe.c
|
||||
--- linux-mips-cvs/drivers/mtd/chips/cfi_probe.c 2003-02-26 01:53:49.000000000 +0100
|
||||
+++ linux-broadcom/drivers/mtd/chips/cfi_probe.c 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -67,8 +67,15 @@
|
||||
cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
|
||||
cfi_send_gen_cmd(0x98, 0x55, base, map, cfi, cfi->device_type, NULL);
|
||||
|
||||
- if (!qry_present(map,base,cfi))
|
||||
- return 0;
|
||||
+ if (!qry_present(map,base,cfi)) {
|
||||
+ /* rather broken SST cfi probe (requires SST unlock) */
|
||||
+ cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
|
||||
+ cfi_send_gen_cmd(0xAA, 0x5555, base, map, cfi, cfi->device_type, NULL);
|
||||
+ cfi_send_gen_cmd(0x55, 0x2AAA, base, map, cfi, cfi->device_type, NULL);
|
||||
+ cfi_send_gen_cmd(0x98, 0x5555, base, map, cfi, cfi->device_type, NULL);
|
||||
+ if (!qry_present(map,base,cfi))
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
if (!cfi->numchips) {
|
||||
/* This is the first time we're called. Set up the CFI
|
||||
diff -Nur linux-mips-cvs/drivers/mtd/chips/gen_probe.c linux-broadcom/drivers/mtd/chips/gen_probe.c
|
||||
--- linux-mips-cvs/drivers/mtd/chips/gen_probe.c 2003-08-13 19:19:18.000000000 +0200
|
||||
+++ linux-broadcom/drivers/mtd/chips/gen_probe.c 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -332,9 +332,13 @@
|
||||
return cfi_cmdset_0002(map, primary);
|
||||
#endif
|
||||
#ifdef CONFIG_MTD_CFI_STAA
|
||||
- case 0x0020:
|
||||
+ case 0x0020:
|
||||
return cfi_cmdset_0020(map, primary);
|
||||
#endif
|
||||
+#ifdef CONFIG_MTD_CFI_SSTSTD
|
||||
+ case 0x0701:
|
||||
+ return cfi_cmdset_0701(map, primary);
|
||||
+#endif
|
||||
}
|
||||
|
||||
return cfi_cmdset_unknown(map, primary);
|
||||
diff -Nur linux-mips-cvs/drivers/mtd/devices/Config.in linux-broadcom/drivers/mtd/devices/Config.in
|
||||
--- linux-mips-cvs/drivers/mtd/devices/Config.in 2003-02-26 01:53:49.000000000 +0100
|
||||
+++ linux-broadcom/drivers/mtd/devices/Config.in 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -5,6 +5,7 @@
|
||||
mainmenu_option next_comment
|
||||
|
||||
comment 'Self-contained MTD device drivers'
|
||||
+bool ' Broadcom Chipcommon Serial Flash support' CONFIG_MTD_SFLASH
|
||||
dep_tristate ' Ramix PMC551 PCI Mezzanine RAM card support' CONFIG_MTD_PMC551 $CONFIG_MTD $CONFIG_PCI
|
||||
if [ "$CONFIG_MTD_PMC551" = "y" -o "$CONFIG_MTD_PMC551" = "m" ]; then
|
||||
bool ' PMC551 256M DRAM Bugfix' CONFIG_MTD_PMC551_BUGFIX
|
||||
diff -Nur linux-mips-cvs/drivers/mtd/devices/Makefile linux-broadcom/drivers/mtd/devices/Makefile
|
||||
--- linux-mips-cvs/drivers/mtd/devices/Makefile 2002-03-30 09:15:50.000000000 +0100
|
||||
+++ linux-broadcom/drivers/mtd/devices/Makefile 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -12,6 +12,7 @@
|
||||
# here where previously there was none. We now have to ensure that
|
||||
# doc200[01].o are linked before docprobe.o
|
||||
|
||||
+obj-$(CONFIG_MTD_SFLASH) += sflash.o
|
||||
obj-$(CONFIG_MTD_DOC1000) += doc1000.o
|
||||
obj-$(CONFIG_MTD_DOC2000) += doc2000.o
|
||||
obj-$(CONFIG_MTD_DOC2001) += doc2001.o
|
||||
diff -Nur linux-mips-cvs/drivers/mtd/maps/Config.in linux-broadcom/drivers/mtd/maps/Config.in
|
||||
--- linux-mips-cvs/drivers/mtd/maps/Config.in 2004-02-26 01:46:35.000000000 +0100
|
||||
+++ linux-broadcom/drivers/mtd/maps/Config.in 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -48,6 +48,7 @@
|
||||
fi
|
||||
|
||||
if [ "$CONFIG_MIPS" = "y" ]; then
|
||||
+ dep_tristate ' CFI Flash device mapped on Broadcom BCM947XX boards' CONFIG_MTD_BCM947XX $CONFIG_MTD_CFI
|
||||
dep_tristate ' Pb1000 MTD support' CONFIG_MTD_PB1000 $CONFIG_MIPS_PB1000
|
||||
dep_tristate ' Pb1500 MTD support' CONFIG_MTD_PB1500 $CONFIG_MIPS_PB1500
|
||||
dep_tristate ' Pb1100 MTD support' CONFIG_MTD_PB1100 $CONFIG_MIPS_PB1100
|
||||
diff -Nur linux-mips-cvs/drivers/mtd/maps/Makefile linux-broadcom/drivers/mtd/maps/Makefile
|
||||
--- linux-mips-cvs/drivers/mtd/maps/Makefile 2004-02-26 01:46:35.000000000 +0100
|
||||
+++ linux-broadcom/drivers/mtd/maps/Makefile 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -10,6 +10,7 @@
|
||||
endif
|
||||
|
||||
# Chip mappings
|
||||
+obj-$(CONFIG_MTD_BCM947XX) += bcm947xx-flash.o
|
||||
obj-$(CONFIG_MTD_CDB89712) += cdb89712.o
|
||||
obj-$(CONFIG_MTD_ARM_INTEGRATOR)+= integrator-flash.o
|
||||
obj-$(CONFIG_MTD_CFI_FLAGADM) += cfi_flagadm.o
|
Binary file not shown.
@ -0,0 +1,10 @@
|
||||
--- linux-mips-cvs/drivers/net/Config.in 2004-11-07 18:13:42.000000000 +0100
|
||||
+++ linux-broadcom/drivers/net/Config.in 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -2,6 +2,7 @@
|
||||
# Network device configuration
|
||||
#
|
||||
|
||||
+source drivers/net/hnd/Config.in
|
||||
source drivers/net/arcnet/Config.in
|
||||
|
||||
tristate 'Dummy net driver support' CONFIG_DUMMY
|
Binary file not shown.
@ -0,0 +1,48 @@
|
||||
--- ../../../kernel/linux-mips-cvs/drivers/net/Makefile 2004-08-14 20:38:51.000000000 +0200
|
||||
+++ linux/drivers/net/Makefile 2005-03-16 12:45:24.523263597 +0100
|
||||
@@ -21,6 +21,16 @@
|
||||
list-multi := rcpci.o
|
||||
rcpci-objs := rcpci45.o rclanmtl.o
|
||||
|
||||
+subdir-m += diag
|
||||
+
|
||||
+ifeq ($(CONFIG_HW_QOS),y)
|
||||
+subdir-m += port_based_qos
|
||||
+else
|
||||
+ ifeq ($(CONFIG_PERFORMANCE),y)
|
||||
+ subdir-m += port_based_qos
|
||||
+ endif
|
||||
+endif
|
||||
+
|
||||
ifeq ($(CONFIG_TULIP),y)
|
||||
obj-y += tulip/tulip.o
|
||||
endif
|
||||
@@ -265,6 +275,28 @@
|
||||
endif
|
||||
endif
|
||||
|
||||
+#
|
||||
+# Broadcom HND devices
|
||||
+#
|
||||
+ifdef CONFIG_HND
|
||||
+subdir-$(CONFIG_HND) += hnd
|
||||
+endif
|
||||
+ifdef CONFIG_ET
|
||||
+subdir-$(CONFIG_ET) += et
|
||||
+endif
|
||||
+ifdef CONFIG_WL
|
||||
+subdir-$(CONFIG_WL) += wl
|
||||
+endif
|
||||
+ifeq ($(CONFIG_HND),y)
|
||||
+ obj-y += hnd/hnd.o
|
||||
+endif
|
||||
+ifeq ($(CONFIG_ET),y)
|
||||
+ obj-y += et/et.o
|
||||
+endif
|
||||
+ifeq ($(CONFIG_WL),y)
|
||||
+ obj-y += wl/wl.o
|
||||
+endif
|
||||
+
|
||||
include $(TOPDIR)/Rules.make
|
||||
|
||||
clean:
|
Binary file not shown.
@ -0,0 +1,10 @@
|
||||
--- ../../../kernel/linux-mips-cvs/drivers/parport/Makefile 2004-08-14 20:38:53.000000000 +0200
|
||||
+++ linux-2.4.29/drivers/parport/Makefile 2005-03-21 13:57:53.338746517 +0100
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
obj-$(CONFIG_PARPORT) += parport.o
|
||||
obj-$(CONFIG_PARPORT_PC) += parport_pc.o
|
||||
+obj-$(CONFIG_PARPORT_SPLINK) += parport_splink.o
|
||||
obj-$(CONFIG_PARPORT_PC_PCMCIA) += parport_cs.o
|
||||
obj-$(CONFIG_PARPORT_AMIGA) += parport_amiga.o
|
||||
obj-$(CONFIG_PARPORT_MFC3) += parport_mfc3.o
|
Binary file not shown.
@ -0,0 +1,10 @@
|
||||
--- ../../../kernel/linux-mips-cvs/drivers/parport/Config.in 2004-02-20 02:22:18.000000000 +0100
|
||||
+++ linux-2.4.29/drivers/parport/Config.in 2005-03-21 13:59:33.958193664 +0100
|
||||
@@ -11,6 +11,7 @@
|
||||
tristate 'Parallel port support' CONFIG_PARPORT
|
||||
if [ "$CONFIG_PARPORT" != "n" ]; then
|
||||
dep_tristate ' PC-style hardware' CONFIG_PARPORT_PC $CONFIG_PARPORT
|
||||
+ dep_tristate ' Asus WL500g parallel port' CONFIG_PARPORT_SPLINK $CONFIG_PARPORT
|
||||
if [ "$CONFIG_PARPORT_PC" != "n" -a "$CONFIG_SERIAL" != "n" ]; then
|
||||
if [ "$CONFIG_SERIAL" = "m" ]; then
|
||||
define_tristate CONFIG_PARPORT_PC_CML1 m
|
Binary file not shown.
1173
openwrt/package/linux/kernel-patches/027-drivers_net_port_based_qos
Normal file
1173
openwrt/package/linux/kernel-patches/027-drivers_net_port_based_qos
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -0,0 +1,23 @@
|
||||
diff -Nur linux-mips-cvs/drivers/pcmcia/Makefile linux-broadcom/drivers/pcmcia/Makefile
|
||||
--- linux-mips-cvs/drivers/pcmcia/Makefile 2004-04-16 23:05:25.000000000 +0200
|
||||
+++ linux-broadcom/drivers/pcmcia/Makefile 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -72,6 +72,10 @@
|
||||
au1000_ss-objs-$(CONFIG_MIPS_HYDROGEN3) += au1000_hydrogen3.o
|
||||
au1000_ss-objs-$(CONFIG_MIPS_XXS1500) += au1000_xxs1500.o
|
||||
|
||||
+obj-$(CONFIG_PCMCIA_BCM4710) += bcm4710_ss.o
|
||||
+bcm4710_ss-objs := bcm4710_generic.o
|
||||
+bcm4710_ss-objs += bcm4710_pcmcia.o
|
||||
+
|
||||
obj-$(CONFIG_PCMCIA_SA1100) += sa1100_cs.o
|
||||
obj-$(CONFIG_PCMCIA_M8XX) += m8xx_pcmcia.o
|
||||
obj-$(CONFIG_PCMCIA_SIBYTE) += sibyte_generic.o
|
||||
@@ -110,5 +114,8 @@
|
||||
au1x00_ss.o: $(au1000_ss-objs-y)
|
||||
$(LD) -r -o $@ $(au1000_ss-objs-y)
|
||||
|
||||
+bcm4710_ss.o: $(bcm4710_ss-objs)
|
||||
+ $(LD) -r -o $@ $(bcm4710_ss-objs)
|
||||
+
|
||||
yenta_socket.o: $(yenta_socket-objs)
|
||||
$(LD) $(LD_RFLAG) -r -o $@ $(yenta_socket-objs)
|
Binary file not shown.
@ -0,0 +1,37 @@
|
||||
--- linux-mips-cvs/arch/mips/mm/c-r4k.c 2004-11-03 17:43:07.000000000 +0100
|
||||
+++ linux-cache/arch/mips/mm/c-r4k.c 2005-03-06 23:39:53.000000000 +0100
|
||||
@@ -1031,9 +1031,34 @@
|
||||
c->options |= MIPS_CPU_SUBSET_CACHES;
|
||||
}
|
||||
|
||||
+#if defined(CONFIG_BCM4310)
|
||||
+static void __init _change_cachability(u32 cm)
|
||||
+{
|
||||
+ struct cpuinfo_mips *c = ¤t_cpu_data;
|
||||
+
|
||||
+ change_c0_config(CONF_CM_CMASK, cm);
|
||||
+ if ((c->processor_id & (PRID_COMP_MASK | PRID_IMP_MASK)) ==
|
||||
+ (PRID_COMP_BROADCOM | PRID_IMP_BCM3302)) {
|
||||
+ cm = read_c0_diag();
|
||||
+ /* Enable icache */
|
||||
+ cm |= (1 << 31);
|
||||
+ /* Enable dcache */
|
||||
+ cm |= (1 << 30);
|
||||
+ write_c0_diag(cm);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void (*change_cachability)(u32);
|
||||
+#endif
|
||||
+
|
||||
static inline void coherency_setup(void)
|
||||
{
|
||||
+#if defined(CONFIG_BCM4310)
|
||||
+ change_cachability = (void (*)(u32)) KSEG1ADDR((unsigned long)(_change_cachability));
|
||||
+ change_cachability(CONF_CM_DEFAULT);
|
||||
+#else
|
||||
change_c0_config(CONF_CM_CMASK, CONF_CM_DEFAULT);
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* c0_status.cu=0 specifies that updates by the sc instruction use
|
Binary file not shown.
@ -0,0 +1,26 @@
|
||||
--- linux-mips-cvs/include/asm-mips/bootinfo.h 2005-01-31 12:59:49.000000000 +0100
|
||||
+++ linux-broadcom/include/asm-mips/bootinfo.h 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -37,6 +37,7 @@
|
||||
#define MACH_GROUP_HP_LJ 20 /* Hewlett Packard LaserJet */
|
||||
#define MACH_GROUP_LASAT 21
|
||||
#define MACH_GROUP_TITAN 22 /* PMC-Sierra Titan */
|
||||
+#define MACH_GROUP_BRCM 23 /* Broadcom */
|
||||
|
||||
/*
|
||||
* Valid machtype values for group unknown (low order halfword of mips_machtype)
|
||||
@@ -197,6 +198,15 @@
|
||||
#define MACH_TANBAC_TB0229 7 /* TANBAC TB0229 (VR4131DIMM) */
|
||||
|
||||
/*
|
||||
+ * Valid machtypes for group Broadcom
|
||||
+ */
|
||||
+#define MACH_BCM93725 0
|
||||
+#define MACH_BCM93725_VJ 1
|
||||
+#define MACH_BCM93730 2
|
||||
+#define MACH_BCM947XX 3
|
||||
+#define MACH_BCM933XX 4
|
||||
+
|
||||
+/*
|
||||
* Valid machtype for group TITAN
|
||||
*/
|
||||
#define MACH_TITAN_YOSEMITE 1 /* PMC-Sierra Yosemite */
|
Binary file not shown.
@ -0,0 +1,50 @@
|
||||
--- linux-mips-cvs/include/asm-mips/cpu.h 2004-07-07 20:19:37.000000000 +0200
|
||||
+++ linux-broadcom/include/asm-mips/cpu.h 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -22,6 +22,11 @@
|
||||
spec.
|
||||
*/
|
||||
|
||||
+#define PRID_COPT_MASK 0xff000000
|
||||
+#define PRID_COMP_MASK 0x00ff0000
|
||||
+#define PRID_IMP_MASK 0x0000ff00
|
||||
+#define PRID_REV_MASK 0x000000ff
|
||||
+
|
||||
#define PRID_COMP_LEGACY 0x000000
|
||||
#define PRID_COMP_MIPS 0x010000
|
||||
#define PRID_COMP_BROADCOM 0x020000
|
||||
@@ -58,6 +63,7 @@
|
||||
#define PRID_IMP_RM7000 0x2700
|
||||
#define PRID_IMP_NEVADA 0x2800 /* RM5260 ??? */
|
||||
#define PRID_IMP_RM9000 0x3400
|
||||
+#define PRID_IMP_BCM4710 0x4000
|
||||
#define PRID_IMP_R5432 0x5400
|
||||
#define PRID_IMP_R5500 0x5500
|
||||
#define PRID_IMP_4KC 0x8000
|
||||
@@ -66,10 +72,16 @@
|
||||
#define PRID_IMP_4KEC 0x8400
|
||||
#define PRID_IMP_4KSC 0x8600
|
||||
#define PRID_IMP_25KF 0x8800
|
||||
+#define PRID_IMP_BCM3302 0x9000
|
||||
+#define PRID_IMP_BCM3303 0x9100
|
||||
#define PRID_IMP_24K 0x9300
|
||||
|
||||
#define PRID_IMP_UNKNOWN 0xff00
|
||||
|
||||
+#define BCM330X(id) \
|
||||
+ (((id & (PRID_COMP_MASK | PRID_IMP_MASK)) == (PRID_COMP_BROADCOM | PRID_IMP_BCM3302)) \
|
||||
+ || ((id & (PRID_COMP_MASK | PRID_IMP_MASK)) == (PRID_COMP_BROADCOM | PRID_IMP_BCM3303)))
|
||||
+
|
||||
/*
|
||||
* These are the PRID's for when 23:16 == PRID_COMP_SIBYTE
|
||||
*/
|
||||
@@ -174,7 +186,9 @@
|
||||
#define CPU_AU1550 57
|
||||
#define CPU_24K 58
|
||||
#define CPU_AU1200 59
|
||||
-#define CPU_LAST 59
|
||||
+#define CPU_BCM4710 60
|
||||
+#define CPU_BCM3302 61
|
||||
+#define CPU_LAST 61
|
||||
|
||||
/*
|
||||
* ISA Level encodings
|
Binary file not shown.
@ -0,0 +1,24 @@
|
||||
--- linux-mips-cvs/include/asm-mips/serial.h 2004-08-20 00:33:33.000000000 +0200
|
||||
+++ linux-broadcom/include/asm-mips/serial.h 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -223,6 +223,13 @@
|
||||
#define TXX927_SERIAL_PORT_DEFNS
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_BCM947XX
|
||||
+/* reserve 4 ports to be configured at runtime */
|
||||
+#define BCM947XX_SERIAL_PORT_DEFNS { 0, }, { 0, }, { 0, }, { 0, },
|
||||
+#else
|
||||
+#define BCM947XX_SERIAL_PORT_DEFNS
|
||||
+#endif
|
||||
+
|
||||
#ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT
|
||||
#define STD_SERIAL_PORT_DEFNS \
|
||||
/* UART CLK PORT IRQ FLAGS */ \
|
||||
@@ -470,6 +477,7 @@
|
||||
#define SERIAL_PORT_DFNS \
|
||||
ATLAS_SERIAL_PORT_DEFNS \
|
||||
AU1000_SERIAL_PORT_DEFNS \
|
||||
+ BCM947XX_SERIAL_PORT_DEFNS \
|
||||
COBALT_SERIAL_PORT_DEFNS \
|
||||
DDB5477_SERIAL_PORT_DEFNS \
|
||||
EV96100_SERIAL_PORT_DEFNS \
|
Binary file not shown.
16
openwrt/package/linux/kernel-patches/037-init_do_mounts_c
Normal file
16
openwrt/package/linux/kernel-patches/037-init_do_mounts_c
Normal file
@ -0,0 +1,16 @@
|
||||
--- linux-mips-cvs/init/do_mounts.c 2005-01-20 03:19:24.000000000 +0100
|
||||
+++ linux-broadcom/init/do_mounts.c 2005-01-31 13:13:14.000000000 +0100
|
||||
@@ -253,7 +253,13 @@
|
||||
{ "ftlb", 0x2c08 },
|
||||
{ "ftlc", 0x2c10 },
|
||||
{ "ftld", 0x2c18 },
|
||||
+#if defined(CONFIG_MTD_BLOCK) || defined(CONFIG_MTD_BLOCK_RO)
|
||||
{ "mtdblock", 0x1f00 },
|
||||
+ { "mtdblock0",0x1f00 },
|
||||
+ { "mtdblock1",0x1f01 },
|
||||
+ { "mtdblock2",0x1f02 },
|
||||
+ { "mtdblock3",0x1f03 },
|
||||
+#endif
|
||||
{ "nb", 0x2b00 },
|
||||
{ NULL, 0 }
|
||||
};
|
Binary file not shown.
28
openwrt/package/linux/kernel-patches/100-gcc3-mtune
Normal file
28
openwrt/package/linux/kernel-patches/100-gcc3-mtune
Normal file
@ -0,0 +1,28 @@
|
||||
--- linux-mips-cvs-21012005/arch/mips/Makefile 2004-11-18 05:16:52.000000000 +0100
|
||||
+++ linux-broadcom/arch/mips/Makefile 2005-01-24 02:56:02.000000000 +0100
|
||||
@@ -71,13 +74,13 @@
|
||||
set_gccflags = $(shell \
|
||||
while :; do \
|
||||
cpu=$(1); isa=-$(2); \
|
||||
- for gcc_opt in -march= -mcpu=; do \
|
||||
+ for gcc_opt in -march= -mtune=; do \
|
||||
$(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \
|
||||
-xc /dev/null > /dev/null 2>&1 && \
|
||||
break 2; \
|
||||
done; \
|
||||
cpu=$(3); isa=-$(4); \
|
||||
- for gcc_opt in -march= -mcpu=; do \
|
||||
+ for gcc_opt in -march= -mtune=; do \
|
||||
$(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \
|
||||
-xc /dev/null > /dev/null 2>&1 && \
|
||||
break 2; \
|
||||
@@ -92,7 +95,7 @@
|
||||
fi; \
|
||||
gas_abi=-Wa,-32; gas_cpu=$$cpu; gas_isa=-Wa,$$isa; \
|
||||
while :; do \
|
||||
- for gas_opt in -Wa,-march= -Wa,-mcpu=; do \
|
||||
+ for gas_opt in -Wa,-march= -Wa,-mtune=; do \
|
||||
$(CC) $$gas_abi $$gas_opt$$cpu $$gas_isa -Wa,-Z -c \
|
||||
-o /dev/null -xassembler /dev/null > /dev/null 2>&1 && \
|
||||
break 2; \
|
||||
|
Binary file not shown.
@ -0,0 +1,45 @@
|
||||
--- linux-mips-cvs-21012005/net/core/dev.c 2004-04-16 05:14:21.000000000 +0200
|
||||
+++ linux-bridge/net/core/dev.c 2005-01-25 08:15:53.000000000 +0100
|
||||
@@ -1289,6 +1289,19 @@
|
||||
local_irq_save(flags);
|
||||
|
||||
netdev_rx_stat[this_cpu].total++;
|
||||
+
|
||||
+#if defined(CONFIG_BCM4710) && defined(CONFIG_BRIDGE)
|
||||
+ /* Optimisation for framebursting (allow interleaving of pkts by
|
||||
+ immediately processing the rx pkt instead of Qing the pkt and deferring
|
||||
+ the processing). Only optimise for bridging and guard against non
|
||||
+ TASKLET based netif_rx calls.
|
||||
+ */
|
||||
+ if (!in_irq() && skb->dev->br_port != NULL && br_handle_frame_hook != NULL){
|
||||
+ local_irq_restore(flags);
|
||||
+ return(netif_receive_skb(skb));
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
if (queue->input_pkt_queue.qlen <= netdev_max_backlog) {
|
||||
if (queue->input_pkt_queue.qlen) {
|
||||
if (queue->throttle)
|
||||
@@ -2053,6 +2066,7 @@
|
||||
{
|
||||
struct net_device *dev;
|
||||
int err;
|
||||
+ struct net_device_stats *stats;
|
||||
|
||||
if ((dev = __dev_get_by_name(ifr->ifr_name)) == NULL)
|
||||
return -ENODEV;
|
||||
@@ -2167,6 +2181,14 @@
|
||||
ifr->ifr_ifindex = dev->ifindex;
|
||||
return 0;
|
||||
|
||||
+#ifdef PERFORMANCE_SUPPORT
|
||||
+ case SIOCGIFSTATS:
|
||||
+ if (!dev->get_stats || !(stats = dev->get_stats(dev)))
|
||||
+ return -ENODEV;
|
||||
+ if (copy_to_user(ifr->ifr_data, stats, sizeof(struct net_device_stats)))
|
||||
+ return -EFAULT;
|
||||
+ return 0;
|
||||
+#endif
|
||||
case SIOCGIFTXQLEN:
|
||||
ifr->ifr_qlen = dev->tx_queue_len;
|
||||
return 0;
|
Binary file not shown.
@ -0,0 +1,28 @@
|
||||
--- linux-mips-cvs-21012005/include/linux/netdevice.h 2004-11-19 01:28:51.000000000 +0100
|
||||
+++ linux-broadcom/include/linux/netdevice.h 2005-01-26 19:51:37.000000000 +0100
|
||||
@@ -297,7 +297,10 @@
|
||||
* See <net/iw_handler.h> for details. Jean II */
|
||||
struct iw_handler_def * wireless_handlers;
|
||||
|
||||
+#ifndef CONFIG_BCM4710
|
||||
struct ethtool_ops *ethtool_ops;
|
||||
+#endif
|
||||
+
|
||||
|
||||
/*
|
||||
* This marks the end of the "visible" part of the structure. All
|
||||
@@ -353,7 +356,14 @@
|
||||
struct Qdisc *qdisc;
|
||||
struct Qdisc *qdisc_sleeping;
|
||||
struct Qdisc *qdisc_ingress;
|
||||
+ /*
|
||||
+ * this is needed for the wlan driver binary blob from linksys
|
||||
+ */
|
||||
+#ifdef CONFIG_BCM4710
|
||||
+ struct Qdisc *qdisc_list;
|
||||
+#else
|
||||
struct list_head qdisc_list;
|
||||
+#endif
|
||||
unsigned long tx_queue_len; /* Max frames per queue allowed */
|
||||
|
||||
/* hard_start_xmit synchronizer */
|
Binary file not shown.
@ -0,0 +1,28 @@
|
||||
--- linux-mips-cvs-21012005/net/core/Makefile 2004-11-19 01:28:53.000000000 +0100
|
||||
+++ linux-broadcom/net/core/Makefile 2005-01-26 15:56:36.000000000 +0100
|
||||
@@ -9,7 +9,11 @@
|
||||
|
||||
O_TARGET := core.o
|
||||
|
||||
+ifeq ($(CONFIG_BCM4710),y)
|
||||
+export-objs := netfilter.o profile.o neighbour.o
|
||||
+else
|
||||
export-objs := netfilter.o profile.o ethtool.o neighbour.o
|
||||
+endif
|
||||
|
||||
obj-y := sock.o skbuff.o iovec.o datagram.o scm.o
|
||||
|
||||
@@ -21,8 +25,13 @@
|
||||
|
||||
obj-$(CONFIG_FILTER) += filter.o
|
||||
|
||||
+ifeq ($(CONFIG_BCM4710),y)
|
||||
+obj-$(CONFIG_NET) += dev.o dev_mcast.o dst.o neighbour.o \
|
||||
+ rtnetlink.o utils.o
|
||||
+else
|
||||
obj-$(CONFIG_NET) += dev.o ethtool.o dev_mcast.o dst.o neighbour.o \
|
||||
rtnetlink.o utils.o
|
||||
+endif
|
||||
|
||||
obj-$(CONFIG_NETFILTER) += netfilter.o
|
||||
obj-$(CONFIG_NET_DIVERT) += dv.o
|
Binary file not shown.
@ -0,0 +1,60 @@
|
||||
--- linux-mips-cvs-21012005/net/sched/sch_generic.c 2005-01-26 16:31:42.000000000 +0100
|
||||
+++ linux-broadcom/net/sched/sch_generic.c 2005-01-27 05:13:47.000000000 +0100
|
||||
@@ -392,7 +392,11 @@
|
||||
return NULL;
|
||||
memset(sch, 0, size);
|
||||
|
||||
+#ifdef CONFIG_BCM4710
|
||||
+ sch->next = NULL;
|
||||
+#else
|
||||
INIT_LIST_HEAD(&sch->list);
|
||||
+#endif
|
||||
skb_queue_head_init(&sch->q);
|
||||
sch->ops = ops;
|
||||
sch->enqueue = ops->enqueue;
|
||||
@@ -426,7 +430,9 @@
|
||||
if (qdisc->flags&TCQ_F_BUILTIN ||
|
||||
!atomic_dec_and_test(&qdisc->refcnt))
|
||||
return;
|
||||
+#ifndef CONFIG_BCM4710
|
||||
list_del(&qdisc->list);
|
||||
+#endif
|
||||
#ifdef CONFIG_NET_ESTIMATOR
|
||||
qdisc_kill_estimator(&qdisc->stats);
|
||||
#endif
|
||||
@@ -454,9 +460,11 @@
|
||||
printk(KERN_INFO "%s: activation failed\n", dev->name);
|
||||
return;
|
||||
}
|
||||
+#ifndef CONFIG_BCM4710
|
||||
write_lock(&qdisc_tree_lock);
|
||||
list_add_tail(&qdisc->list, &dev->qdisc_list);
|
||||
write_unlock(&qdisc_tree_lock);
|
||||
+#endif
|
||||
|
||||
} else {
|
||||
qdisc = &noqueue_qdisc;
|
||||
@@ -501,7 +509,11 @@
|
||||
dev->qdisc = &noop_qdisc;
|
||||
spin_unlock_bh(&dev->queue_lock);
|
||||
dev->qdisc_sleeping = &noop_qdisc;
|
||||
+#ifdef CONFIG_BCM4710
|
||||
+ dev->qdisc_list = NULL;
|
||||
+#else
|
||||
INIT_LIST_HEAD(&dev->qdisc_list);
|
||||
+#endif
|
||||
write_unlock(&qdisc_tree_lock);
|
||||
|
||||
dev_watchdog_init(dev);
|
||||
@@ -523,7 +535,11 @@
|
||||
qdisc_destroy(qdisc);
|
||||
}
|
||||
#endif
|
||||
+#ifdef CONFIG_BCM4710
|
||||
+ BUG_TRAP(dev->qdisc_list == NULL);
|
||||
+#else
|
||||
BUG_TRAP(list_empty(&dev->qdisc_list));
|
||||
+#endif
|
||||
BUG_TRAP(!timer_pending(&dev->watchdog_timer));
|
||||
spin_unlock_bh(&dev->queue_lock);
|
||||
write_unlock(&qdisc_tree_lock);
|
Binary file not shown.
@ -0,0 +1,34 @@
|
||||
--- linux-mips-cvs-21012005/include/net/pkt_sched.h 2004-11-19 01:28:51.000000000 +0100
|
||||
+++ linux-broadcom/include/net/pkt_sched.h 2005-01-27 04:34:10.000000000 +0100
|
||||
@@ -59,7 +59,11 @@
|
||||
int (*enqueue)(struct sk_buff *, struct Qdisc *);
|
||||
struct sk_buff * (*dequeue)(struct Qdisc *);
|
||||
int (*requeue)(struct sk_buff *, struct Qdisc *);
|
||||
+#ifdef CONFIG_BCM4710
|
||||
+ int (*drop)(struct Qdisc *);
|
||||
+#else
|
||||
unsigned int (*drop)(struct Qdisc *);
|
||||
+#endif
|
||||
|
||||
int (*init)(struct Qdisc *, struct rtattr *arg);
|
||||
void (*reset)(struct Qdisc *);
|
||||
@@ -80,12 +84,19 @@
|
||||
#define TCQ_F_THROTTLED 2
|
||||
#define TCQ_F_INGRESS 4
|
||||
struct Qdisc_ops *ops;
|
||||
+#ifdef CONFIG_BCM4710
|
||||
+ struct Qdisc *next;
|
||||
+#endif
|
||||
u32 handle;
|
||||
+#ifndef CONFIG_BCM4710
|
||||
u32 parent;
|
||||
+#endif
|
||||
atomic_t refcnt;
|
||||
struct sk_buff_head q;
|
||||
struct net_device *dev;
|
||||
+#ifndef CONFIG_BCM4710
|
||||
struct list_head list;
|
||||
+#endif
|
||||
|
||||
struct tc_stats stats;
|
||||
int (*reshape_fail)(struct sk_buff *skb, struct Qdisc *q);
|
Binary file not shown.
@ -0,0 +1,83 @@
|
||||
--- linux-mips-cvs/net/sched/sch_api.c 2004-11-19 01:29:09.000000000 +0100
|
||||
+++ linux-broadcom/net/sched/sch_api.c 2005-01-31 18:07:45.000000000 +0100
|
||||
@@ -194,7 +194,11 @@
|
||||
{
|
||||
struct Qdisc *q;
|
||||
|
||||
+#ifdef CONFIG_BCM4710
|
||||
+ for (q = dev->qdisc_list; q; q = q->next) {
|
||||
+#else
|
||||
list_for_each_entry(q, &dev->qdisc_list, list) {
|
||||
+#endif
|
||||
if (q->handle == handle)
|
||||
return q;
|
||||
}
|
||||
@@ -371,8 +375,10 @@
|
||||
unsigned long cl = cops->get(parent, classid);
|
||||
if (cl) {
|
||||
err = cops->graft(parent, cl, new, old);
|
||||
+#ifndef CONFIG_BCM4710
|
||||
if (new)
|
||||
new->parent = classid;
|
||||
+#endif
|
||||
cops->put(parent, cl);
|
||||
}
|
||||
}
|
||||
@@ -427,7 +433,11 @@
|
||||
|
||||
memset(sch, 0, size);
|
||||
|
||||
+#ifdef CONFIG_BCM4710
|
||||
+ sch->next = NULL;
|
||||
+#else
|
||||
INIT_LIST_HEAD(&sch->list);
|
||||
+#endif
|
||||
skb_queue_head_init(&sch->q);
|
||||
|
||||
if (handle == TC_H_INGRESS)
|
||||
@@ -453,7 +463,12 @@
|
||||
|
||||
if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS-1])) == 0) {
|
||||
write_lock(&qdisc_tree_lock);
|
||||
+#ifdef CONFIG_BCM4710
|
||||
+ sch->next = dev->qdisc_list;
|
||||
+ dev->qdisc_list = sch;
|
||||
+#else
|
||||
list_add_tail(&sch->list, &dev->qdisc_list);
|
||||
+#endif
|
||||
write_unlock(&qdisc_tree_lock);
|
||||
#ifdef CONFIG_NET_ESTIMATOR
|
||||
if (tca[TCA_RATE-1])
|
||||
@@ -809,12 +824,20 @@
|
||||
s_q_idx = 0;
|
||||
read_lock(&qdisc_tree_lock);
|
||||
q_idx = 0;
|
||||
+#ifdef CONFIG_BCM4710
|
||||
+ for (q = dev->qdisc_list, q_idx = 0; q; q = q->next, q_idx++) {
|
||||
+#else
|
||||
list_for_each_entry(q, &dev->qdisc_list, list) {
|
||||
+#endif
|
||||
if (q_idx < s_q_idx) {
|
||||
q_idx++;
|
||||
continue;
|
||||
}
|
||||
+#ifdef CONFIG_BCM4710
|
||||
+ if (tc_fill_qdisc(skb, q, 0, NETLINK_CB(cb->skb).pid,
|
||||
+#else
|
||||
if (tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).pid,
|
||||
+#endif
|
||||
cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) {
|
||||
read_unlock(&qdisc_tree_lock);
|
||||
goto done;
|
||||
@@ -1033,7 +1056,11 @@
|
||||
t = 0;
|
||||
|
||||
read_lock(&qdisc_tree_lock);
|
||||
+#ifdef CONFIG_BCM4710
|
||||
+ for (q=dev->qdisc_list, t=0; q; q = q->next, t++) {
|
||||
+#else
|
||||
list_for_each_entry(q, &dev->qdisc_list, list) {
|
||||
+#endif
|
||||
if (t < s_t || !q->ops->cl_ops ||
|
||||
(tcm->tcm_parent &&
|
||||
TC_H_MAJ(tcm->tcm_parent) != q->handle)) {
|
Binary file not shown.
@ -0,0 +1,18 @@
|
||||
--- linux-mips-cvs-21012005/net/core/dev.c 2004-04-16 05:14:21.000000000 +0200
|
||||
+++ linux-broadcom/net/core/dev.c 2005-01-26 20:06:32.000000000 +0100
|
||||
@@ -2295,6 +2295,7 @@
|
||||
}
|
||||
return ret;
|
||||
|
||||
+#ifndef CONFIG_BCM4710
|
||||
case SIOCETHTOOL:
|
||||
dev_load(ifr.ifr_name);
|
||||
rtnl_lock();
|
||||
@@ -2308,6 +2309,7 @@
|
||||
ret = -EFAULT;
|
||||
}
|
||||
return ret;
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* These ioctl calls:
|
Binary file not shown.
@ -0,0 +1,24 @@
|
||||
--- linux-mips-cvs-21012005/include/linux/skbuff.h 2005-01-31 12:56:47.000000000 +0100
|
||||
+++ linux-broadcom/include/linux/skbuff.h 2005-01-31 12:55:24.000000000 +0100
|
||||
@@ -135,10 +135,6 @@
|
||||
struct sock *sk; /* Socket we are owned by */
|
||||
struct timeval stamp; /* Time we arrived */
|
||||
struct net_device *dev; /* Device we arrived on/are leaving by */
|
||||
- struct net_device *real_dev; /* For support of point to point protocols
|
||||
- (e.g. 802.3ad) over bonding, we must save the
|
||||
- physical device that got the packet before
|
||||
- replacing skb->dev with the virtual device. */
|
||||
|
||||
/* Transport layer header */
|
||||
union
|
||||
@@ -219,6 +215,10 @@
|
||||
#ifdef CONFIG_NET_SCHED
|
||||
__u32 tc_index; /* traffic control index */
|
||||
#endif
|
||||
+ struct net_device *real_dev; /* For support of point to point protocols
|
||||
+ (e.g. 802.3ad) over bonding, we must save the
|
||||
+ physical device that got the packet before
|
||||
+ replacing skb->dev with the virtual device. */
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
Binary file not shown.
2454
openwrt/package/linux/kernel-patches/300-squashfs2.1
Normal file
2454
openwrt/package/linux/kernel-patches/300-squashfs2.1
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
9119
openwrt/package/linux/kernel-patches/301-jffs-compression
Normal file
9119
openwrt/package/linux/kernel-patches/301-jffs-compression
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
9355
openwrt/package/linux/kernel-patches/302-ebtables
Normal file
9355
openwrt/package/linux/kernel-patches/302-ebtables
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
1649
openwrt/package/linux/kernel-patches/303-mppe-mppc
Normal file
1649
openwrt/package/linux/kernel-patches/303-mppe-mppc
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
720
openwrt/package/linux/kernel-patches/304-netfilter-ipp2p-0.7.4
Normal file
720
openwrt/package/linux/kernel-patches/304-netfilter-ipp2p-0.7.4
Normal file
@ -0,0 +1,720 @@
|
||||
diff -urN linux-2.4.29.old/include/linux/netfilter_ipv4/ipt_ipp2p.h linux-2.4.29/include/linux/netfilter_ipv4/ipt_ipp2p.h
|
||||
--- linux-2.4.29.old/include/linux/netfilter_ipv4/ipt_ipp2p.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ linux-2.4.29/include/linux/netfilter_ipv4/ipt_ipp2p.h 2005-03-12 00:44:17.000000000 +0100
|
||||
@@ -0,0 +1,29 @@
|
||||
+#ifndef __IPT_IPP2P_H
|
||||
+#define __IPT_IPP2P_H
|
||||
+#define IPP2P_VERSION "0.7.4"
|
||||
+
|
||||
+struct ipt_p2p_info {
|
||||
+ int cmd;
|
||||
+ int debug;
|
||||
+};
|
||||
+
|
||||
+#endif //__IPT_IPP2P_H
|
||||
+
|
||||
+#define SHORT_HAND_IPP2P 1 /* --ipp2p switch*/
|
||||
+#define SHORT_HAND_DATA 4 /* --ipp2p-data switch*/
|
||||
+#define SHORT_HAND_NONE 5 /* no short hand*/
|
||||
+
|
||||
+#define IPP2P_EDK 2
|
||||
+#define IPP2P_DATA_KAZAA 8
|
||||
+#define IPP2P_DATA_EDK 16
|
||||
+#define IPP2P_DATA_DC 32
|
||||
+#define IPP2P_DC 64
|
||||
+#define IPP2P_DATA_GNU 128
|
||||
+#define IPP2P_GNU 256
|
||||
+#define IPP2P_KAZAA 512
|
||||
+#define IPP2P_BIT 1024
|
||||
+#define IPP2P_APPLE 2048
|
||||
+#define IPP2P_SOUL 4096
|
||||
+#define IPP2P_WINMX 8192
|
||||
+#define IPP2P_ARES 16384
|
||||
+
|
||||
diff -urN linux-2.4.29.old/net/ipv4/netfilter/Config.in linux-2.4.29/net/ipv4/netfilter/Config.in
|
||||
--- linux-2.4.29.old/net/ipv4/netfilter/Config.in 2005-03-12 00:40:38.000000000 +0100
|
||||
+++ linux-2.4.29/net/ipv4/netfilter/Config.in 2005-03-12 00:42:57.000000000 +0100
|
||||
@@ -26,6 +26,7 @@
|
||||
dep_tristate ' TOS match support' CONFIG_IP_NF_MATCH_TOS $CONFIG_IP_NF_IPTABLES
|
||||
dep_tristate ' recent match support' CONFIG_IP_NF_MATCH_RECENT $CONFIG_IP_NF_IPTABLES
|
||||
dep_tristate ' ECN match support' CONFIG_IP_NF_MATCH_ECN $CONFIG_IP_NF_IPTABLES
|
||||
+ dep_tristate ' peer to peer traffic match support' CONFIG_IP_NF_MATCH_IPP2P $CONFIG_IP_NF_IPTABLES
|
||||
|
||||
dep_tristate ' DSCP match support' CONFIG_IP_NF_MATCH_DSCP $CONFIG_IP_NF_IPTABLES
|
||||
|
||||
diff -urN linux-2.4.29.old/net/ipv4/netfilter/ipt_ipp2p.c linux-2.4.29/net/ipv4/netfilter/ipt_ipp2p.c
|
||||
--- linux-2.4.29.old/net/ipv4/netfilter/ipt_ipp2p.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ linux-2.4.29/net/ipv4/netfilter/ipt_ipp2p.c 2005-03-12 00:44:02.000000000 +0100
|
||||
@@ -0,0 +1,661 @@
|
||||
+#if defined(MODVERSIONS)
|
||||
+#include <linux/modversions.h>
|
||||
+#endif
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/netfilter_ipv4/ip_tables.h>
|
||||
+#include <linux/version.h>
|
||||
+#include <linux/netfilter_ipv4/ipt_ipp2p.h>
|
||||
+//#include "ipt_ipp2p.h"
|
||||
+#include <net/tcp.h>
|
||||
+#include <net/udp.h>
|
||||
+
|
||||
+#define get_u8(X,O) (*(__u8 *)(X + O))
|
||||
+#define get_u16(X,O) (*(__u16 *)(X + O))
|
||||
+#define get_u32(X,O) (*(__u32 *)(X + O))
|
||||
+
|
||||
+MODULE_AUTHOR("Eicke Friedrich <ipp2p@ipp2p.org>");
|
||||
+MODULE_DESCRIPTION("An extension to iptables to identify P2P traffic.");
|
||||
+MODULE_LICENSE("GPL");
|
||||
+
|
||||
+
|
||||
+/*Search for UDP eDonkey/eMule/Kad commands*/
|
||||
+int
|
||||
+udp_search_edk (unsigned char *haystack, int packet_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ t += 8;
|
||||
+
|
||||
+ switch (t[0]) {
|
||||
+ case 0xe3: { /*edonkey*/
|
||||
+ switch (t[1]) {
|
||||
+ /* e3 9a + 16Bytes Hash | size == 26 */
|
||||
+ case 0x9a: if (packet_len == 26) return ((IPP2P_EDK * 100) + 1);
|
||||
+ /* e3 96 xx yy zz kk | size == 14 | server status request */
|
||||
+ case 0x96: if (packet_len == 14) return ((IPP2P_EDK * 100) + 2);
|
||||
+ /* e3 a2 | size == 10 or 14 <-- recheck*/
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ case 0xc5: { /*emule*/
|
||||
+ switch (t[1]) {
|
||||
+ /* c5 91 xx yy | size == 12 (8+4) | xx != 0x00 -- xx yy queue rating */
|
||||
+ case 0x91: if ((packet_len == 12) && (t[2] != 0x00)) return ((IPP2P_EDK * 100) + 3);
|
||||
+ /* c5 90 xx .. yy | size == 26 (8+2+16) | xx .. yy == hash -- file ping */
|
||||
+ case 0x90: if ((packet_len == 26) && (t[2] != 0x00)) return ((IPP2P_EDK * 100) + 4);
|
||||
+ /* c5 92 | size == 10 (8+2) -- file not found */
|
||||
+ case 0x92: if (packet_len == 10) return ((IPP2P_EDK * 100) + 5);
|
||||
+ /* c5 93 | size == 10 (8+2) -- queue full */
|
||||
+ case 0x93: if (packet_len == 10) return ((IPP2P_EDK * 100) + 6);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ case 0xe4: { /*kad*/
|
||||
+ switch (t[1]) {
|
||||
+ /* e4 50 | size == 12 */
|
||||
+ case 0x50: if (packet_len == 12) return ((IPP2P_EDK * 100) + 7);
|
||||
+ /* e4 58 | size == 14 */
|
||||
+ case 0x58: if ((packet_len == 14) && (t[2] != 0x00)) return ((IPP2P_EDK * 100) + 8);
|
||||
+ /* e4 59 | size == 10 */
|
||||
+ case 0x59: if (packet_len == 10) return ((IPP2P_EDK * 100) + 9);
|
||||
+ /* e4 30 .. | t[18] == 0x01 | size > 26 | --> search */
|
||||
+ case 0x30: if ((packet_len > 26) && (t[18] == 0x01)) return ((IPP2P_EDK * 100) + 10);
|
||||
+ /* e4 28 .. 00 | t[68] == 0x00 | size > 76 */
|
||||
+ case 0x28: if ((packet_len > 76) && (t[68] == 0x00)) return ((IPP2P_EDK * 100) + 11);
|
||||
+ /* e4 20 .. | size == 43 */
|
||||
+ case 0x20: if ((packet_len == 43) && (t[2] != 0x00) && (t[34] != 0x00)) return ((IPP2P_EDK * 100) + 12);
|
||||
+ /* e4 00 .. 00 | size == 35 ? */
|
||||
+ case 0x00: if ((packet_len == 35) && (t[26] == 0x00)) return ((IPP2P_EDK * 100) + 13);
|
||||
+ /* e4 10 .. 00 | size == 35 ? */
|
||||
+ case 0x10: if ((packet_len == 35) && (t[26] == 0x00)) return ((IPP2P_EDK * 100) + 14);
|
||||
+ /* e4 18 .. 00 | size == 35 ? */
|
||||
+ case 0x18: if ((packet_len == 35) && (t[26] == 0x00)) return ((IPP2P_EDK * 100) + 15);
|
||||
+ /* e4 40 .. | t[18] == 0x01 | t[19] == 0x00 | size > 40 */
|
||||
+ case 0x40: if ((packet_len > 40) && (t[18] == 0x01) && (t[19] == 0x00)) return ((IPP2P_EDK * 100) + 16);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ default: return 0;
|
||||
+ } /* end of switch (t[0]) */
|
||||
+}/*udp_search_edk*/
|
||||
+
|
||||
+
|
||||
+/*Search for UDP Gnutella commands*/
|
||||
+int
|
||||
+udp_search_gnu (unsigned char *haystack, int packet_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ t += 8;
|
||||
+
|
||||
+ if (memcmp(t, "GND", 3) == 0) return ((IPP2P_GNU * 100) + 1);
|
||||
+ if (memcmp(t, "GNUTELLA ", 9) == 0) return ((IPP2P_GNU * 100) + 2);
|
||||
+ return 0;
|
||||
+}/*udp_search_gnu*/
|
||||
+
|
||||
+
|
||||
+/*Search for UDP KaZaA commands*/
|
||||
+int
|
||||
+udp_search_kazaa (unsigned char *haystack, int packet_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+
|
||||
+ if (t[packet_len-1] == 0x00){
|
||||
+ t += (packet_len - 6);
|
||||
+ if (memcmp(t, "KaZaA", 5) == 0) return (IPP2P_KAZAA * 100);
|
||||
+ }
|
||||
+ return 0;
|
||||
+}/*udp_search_kazaa*/
|
||||
+
|
||||
+
|
||||
+/*Search for UDP BitTorrent commands*/
|
||||
+int
|
||||
+udp_search_bit (unsigned char *haystack, int packet_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+
|
||||
+ /* packet_len has to be 24 */
|
||||
+ if (packet_len != 24) return 0;
|
||||
+
|
||||
+ t += 8;
|
||||
+
|
||||
+ /* ^ 00 00 04 17 27 10 19 80 */
|
||||
+ if ((ntohl(get_u32(t, 0)) == 0x00000417) && (ntohl(get_u32(t, 4)) == 0x27101980)) return (IPP2P_BIT * 100);
|
||||
+
|
||||
+ return 0;
|
||||
+}/*udp_search_bit*/
|
||||
+
|
||||
+
|
||||
+
|
||||
+/*Search for Ares commands*/
|
||||
+int
|
||||
+search_ares (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ t += head_len;
|
||||
+
|
||||
+ if ((packet_len - head_len) == 6){ /* possible connect command*/
|
||||
+ if ((t[0] == 0x03) && (t[1] == 0x00) && (t[2] == 0x5a) && (t[3] == 0x04) && (t[4] == 0x03) && (t[5] == 0x05))
|
||||
+ return ((IPP2P_ARES * 100) + 1); /* found connect packet: 03 00 5a 04 03 05 */
|
||||
+ }
|
||||
+ if ((packet_len - head_len) == 60){ /* possible download command*/
|
||||
+ if ((t[59] == 0x0a) && (t[58] == 0x0a)){
|
||||
+ if (memcmp(t, "PUSH SHA1:", 10) == 0) /* found download command */
|
||||
+ return ((IPP2P_ARES * 100) + 2);
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+} /*search_ares*/
|
||||
+
|
||||
+
|
||||
+/*Search for SoulSeek commands*/
|
||||
+int
|
||||
+search_soul (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ t += head_len;
|
||||
+
|
||||
+ if (get_u16(t, 0) == (packet_len - head_len - 4)){
|
||||
+ /* xx xx 00 00 yy zz 00 00 .. | xx = sizeof(payload) - 4 */
|
||||
+ if ((get_u16(t,2) == 0x0000) &&(t[4] != 0x00) && (get_u16(t,6) == 0x0000))
|
||||
+ return ((IPP2P_SOUL * 100) + 1);
|
||||
+ } else {
|
||||
+ /* 00 00 00 00 00 00 00 00 + sizeof(payload) == 8*/
|
||||
+ if (((packet_len - head_len) == 8) && (get_u32(t, 0) == 0x00000000) && (get_u32(t, 4) == 0x00000000))
|
||||
+ return ((IPP2P_SOUL * 100) + 2);
|
||||
+ }
|
||||
+
|
||||
+ /* 01 xx 00 00 00 yy .. zz 00 00 00 .. | xx == sizeof(nick) | yy .. zz == nick */
|
||||
+ if ((t[0] == 0x01) && (t[2] == 0x00) && (get_u16(t,3) == 0x0000) && ((packet_len - head_len) > ((get_u8(t,1))+6)) &&
|
||||
+ (t[(get_u8(t,1))+4] != 0x00) && (t[(get_u8(t,1))+5] == 0x01) && (t[(get_u8(t,1))+6] == 0x00))
|
||||
+ return ((IPP2P_SOUL * 100) + 3);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*Search for WinMX commands*/
|
||||
+int
|
||||
+search_winmx (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ int c;
|
||||
+ t += head_len;
|
||||
+
|
||||
+ if (((packet_len - head_len) == 4) && (memcmp(t, "SEND", 4) == 0)) return ((IPP2P_WINMX * 100) + 1);
|
||||
+ if (((packet_len - head_len) == 3) && (memcmp(t, "GET", 3) == 0)) return ((IPP2P_WINMX * 100) + 2);
|
||||
+ if (packet_len < (head_len + 10)) return 0;
|
||||
+
|
||||
+ if ((memcmp(t, "SEND", 4) == 0) || (memcmp(t, "GET", 3) == 0)){
|
||||
+ c = head_len + 4;
|
||||
+ t += 4;
|
||||
+ while (c < packet_len - 5) {
|
||||
+ if ((t[0] == 0x20) && (t[1] == 0x22)){
|
||||
+ c += 2;
|
||||
+ t += 2;
|
||||
+ while (c < packet_len - 2) {
|
||||
+ if ((t[0] == 0x22) && (t[1] == 0x20)) return ((IPP2P_WINMX * 100) + 3);
|
||||
+ t++;
|
||||
+ c++;
|
||||
+ }
|
||||
+ }
|
||||
+ t++;
|
||||
+ c++;
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+} /*search_winmx*/
|
||||
+
|
||||
+
|
||||
+/*Search for appleJuice commands*/
|
||||
+int
|
||||
+search_apple (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ t += head_len;
|
||||
+
|
||||
+ if ((memcmp(t, "ajprot", 6) == 0) && (t[6] == 0x0d) && (t[7] == 0x0a)) return (IPP2P_APPLE * 100);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*Search for BitTorrent commands*/
|
||||
+int
|
||||
+search_bittorrent (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+
|
||||
+ unsigned char *t = haystack;
|
||||
+ if (*(haystack+head_len) != 0x13) return 0; /*Bail out of first byte != 0x13*/
|
||||
+
|
||||
+ t += head_len + 1;
|
||||
+
|
||||
+ if (memcmp(t, "BitTorrent protocol", 19) == 0) return (IPP2P_BIT * 100);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
+/*check for Kazaa get command*/
|
||||
+int
|
||||
+search_kazaa (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+
|
||||
+ if (!((*(haystack + packet_len - 2) == 0x0d) && (*(haystack + packet_len - 1) == 0x0a))) return 0;
|
||||
+
|
||||
+ t += head_len;
|
||||
+ if (memcmp(t, "GET /.hash=", 11) == 0)
|
||||
+ return (IPP2P_DATA_KAZAA * 100);
|
||||
+ else
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*check for gnutella get command*/
|
||||
+int
|
||||
+search_gnu (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+
|
||||
+ if (!((*(haystack + packet_len - 2) == 0x0d) && (*(haystack + packet_len - 1) == 0x0a))) return 0;
|
||||
+
|
||||
+ t += head_len;
|
||||
+ if (memcmp(t, "GET /get/", 9) == 0) return ((IPP2P_DATA_GNU * 100) + 1);
|
||||
+ if (memcmp(t, "GET /uri-res/", 13) == 0) return ((IPP2P_DATA_GNU * 100) + 2);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*check for gnutella get commands and other typical data*/
|
||||
+int
|
||||
+search_all_gnu (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ int c;
|
||||
+
|
||||
+ if (!((*(haystack + packet_len - 2) == 0x0d) && (*(haystack + packet_len - 1) == 0x0a))) return 0;
|
||||
+
|
||||
+ t += head_len;
|
||||
+
|
||||
+ if (memcmp(t, "GNUTELLA CONNECT/", 17) == 0) return ((IPP2P_GNU * 100) + 1);
|
||||
+ if (memcmp(t, "GNUTELLA/", 9) == 0) return ((IPP2P_GNU * 100) + 2);
|
||||
+
|
||||
+ if ((memcmp(t, "GET /get/", 9) == 0) || (memcmp(t, "GET /uri-res/", 13) == 0))
|
||||
+ {
|
||||
+ c = head_len + 8;
|
||||
+ t += 8;
|
||||
+ while (c < packet_len - 22) {
|
||||
+ if ((t[0] == 0x0d) && (t[1] == 0x0a)) {
|
||||
+ t += 2;
|
||||
+ c += 2;
|
||||
+ if ((memcmp(t, "X-Gnutella-", 11) == 0) || (memcmp(t, "X-Queue:", 8) == 0)) return ((IPP2P_GNU * 100) + 3);
|
||||
+ } else {
|
||||
+ t++;
|
||||
+ c++;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*check for KaZaA download commands and other typical data*/
|
||||
+int
|
||||
+search_all_kazaa (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ int c;
|
||||
+
|
||||
+ if (!((*(haystack + packet_len - 2) == 0x0d) && (*(haystack + packet_len - 1) == 0x0a))) return 0;
|
||||
+
|
||||
+ t += head_len;
|
||||
+ if (memcmp(t, "GIVE ", 5) == 0) return ((IPP2P_KAZAA * 100) + 1);
|
||||
+
|
||||
+ if (memcmp(t, "GET /", 5) == 0) {
|
||||
+ c = head_len + 8;
|
||||
+ t += 8;
|
||||
+ while (c < packet_len - 22) {
|
||||
+ if ((t[0] == 0x0d) && (t[1] == 0x0a)) {
|
||||
+ t += 2;
|
||||
+ c += 2;
|
||||
+ if ( memcmp(t, "X-Kazaa-Username: ", 18) == 0 ) return ((IPP2P_KAZAA * 100) + 2);
|
||||
+ if ( memcmp(t, "User-Agent: PeerEnabler/", 24) == 0 ) return ((IPP2P_KAZAA * 100) + 3);
|
||||
+ } else {
|
||||
+ t++;
|
||||
+ c++;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/*fast check for edonkey file segment transfer command*/
|
||||
+int
|
||||
+search_edk (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ if (*(haystack+head_len) != 0xe3)
|
||||
+ return 0;
|
||||
+ else {
|
||||
+ if (*(haystack+head_len+5) == 0x47)
|
||||
+ return (IPP2P_DATA_EDK * 100);
|
||||
+ else
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
+/*intensive but slower search for some edonkey packets including size-check*/
|
||||
+int
|
||||
+search_all_edk (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+ int cmd;
|
||||
+
|
||||
+ if (*(haystack+head_len) == 0xd4) {
|
||||
+ t += head_len;
|
||||
+ cmd = get_u16(t, 1);
|
||||
+ if (cmd == (packet_len - head_len - 5)) {
|
||||
+ switch (t[5]) {
|
||||
+ case 0x82: return ((IPP2P_EDK * 100) + 42);
|
||||
+ case 0x15: return ((IPP2P_EDK * 100) + 43);
|
||||
+ default: return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ if (*(haystack+head_len) == 0xc5) { /*search for additional eMule packets*/
|
||||
+ t += head_len;
|
||||
+ cmd = get_u16(t, 1);
|
||||
+
|
||||
+ if (cmd == (packet_len - head_len - 5)) {
|
||||
+ switch (t[5]) {
|
||||
+ case 0x01: return ((IPP2P_EDK * 100) + 30);
|
||||
+ case 0x02: return ((IPP2P_EDK * 100) + 31);
|
||||
+ case 0x60: return ((IPP2P_EDK * 100) + 32);
|
||||
+ case 0x81: return ((IPP2P_EDK * 100) + 33);
|
||||
+ case 0x82: return ((IPP2P_EDK * 100) + 34);
|
||||
+ case 0x85: return ((IPP2P_EDK * 100) + 35);
|
||||
+ case 0x86: return ((IPP2P_EDK * 100) + 36);
|
||||
+ case 0x87: return ((IPP2P_EDK * 100) + 37);
|
||||
+ case 0x40: return ((IPP2P_EDK * 100) + 38);
|
||||
+ case 0x92: return ((IPP2P_EDK * 100) + 39);
|
||||
+ case 0x93: return ((IPP2P_EDK * 100) + 40);
|
||||
+ case 0x12: return ((IPP2P_EDK * 100) + 41);
|
||||
+ default: return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ if (*(haystack+head_len) != 0xe3)
|
||||
+ return 0;
|
||||
+ else {
|
||||
+ t += head_len;
|
||||
+ cmd = get_u16(t, 1);
|
||||
+ if (cmd == (packet_len - head_len - 5)) {
|
||||
+ switch (t[5]) {
|
||||
+ case 0x01: return ((IPP2P_EDK * 100) + 1); /*Client: hello or Server:hello*/
|
||||
+ case 0x50: return ((IPP2P_EDK * 100) + 2); /*Client: file status*/
|
||||
+ case 0x16: return ((IPP2P_EDK * 100) + 3); /*Client: search*/
|
||||
+ case 0x58: return ((IPP2P_EDK * 100) + 4); /*Client: file request*/
|
||||
+ case 0x48: return ((IPP2P_EDK * 100) + 5); /*???*/
|
||||
+ case 0x54: return ((IPP2P_EDK * 100) + 6); /*???*/
|
||||
+ case 0x47: return ((IPP2P_EDK * 100) + 7); /*Client: file segment request*/
|
||||
+ case 0x46: return ((IPP2P_EDK * 100) + 8); /*Client: download segment*/
|
||||
+ case 0x4c: return ((IPP2P_EDK * 100) + 9); /*Client: Hello-Answer*/
|
||||
+ case 0x4f: return ((IPP2P_EDK * 100) + 10); /*Client: file status request*/
|
||||
+ case 0x59: return ((IPP2P_EDK * 100) + 11); /*Client: file request answer*/
|
||||
+ case 0x65: return ((IPP2P_EDK * 100) + 12); /*Client: ???*/
|
||||
+ case 0x66: return ((IPP2P_EDK * 100) + 13); /*Client: ???*/
|
||||
+ case 0x51: return ((IPP2P_EDK * 100) + 14); /*Client: ???*/
|
||||
+ case 0x52: return ((IPP2P_EDK * 100) + 15); /*Client: ???*/
|
||||
+ case 0x4d: return ((IPP2P_EDK * 100) + 16); /*Client: ???*/
|
||||
+ case 0x5c: return ((IPP2P_EDK * 100) + 17); /*Client: ???*/
|
||||
+ case 0x38: return ((IPP2P_EDK * 100) + 18); /*Client: ???*/
|
||||
+ case 0x69: return ((IPP2P_EDK * 100) + 19); /*Client: ???*/
|
||||
+ case 0x19: return ((IPP2P_EDK * 100) + 20); /*Client: ???*/
|
||||
+ case 0x42: return ((IPP2P_EDK * 100) + 21); /*Client: ???*/
|
||||
+ case 0x34: return ((IPP2P_EDK * 100) + 22); /*Client: ???*/
|
||||
+ case 0x94: return ((IPP2P_EDK * 100) + 23); /*Client: ???*/
|
||||
+ case 0x1c: return ((IPP2P_EDK * 100) + 24); /*Client: ???*/
|
||||
+ case 0x6a: return ((IPP2P_EDK * 100) + 25); /*Client: ???*/
|
||||
+ default: return 0;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (cmd > packet_len - head_len - 5) {
|
||||
+ if ((t[3] == 0x00) && (t[4] == 0x00)) {
|
||||
+ if (t[5] == 0x01) return ((IPP2P_EDK * 100) + 26);
|
||||
+ if (t[5] == 0x4c) return ((IPP2P_EDK * 100) + 27);
|
||||
+ }
|
||||
+ return 0;
|
||||
+
|
||||
+ } /*non edk packet*/
|
||||
+ if (t[cmd+5] == 0xe3) return ((IPP2P_EDK * 100) + 28);/*found another edk-command*/
|
||||
+ if (t[cmd+5] == 0xc5) return ((IPP2P_EDK * 100) + 29);/*found an emule-command*/
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*fast check for Direct Connect send command*/
|
||||
+int
|
||||
+search_dc (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+
|
||||
+ if (*(haystack+head_len) != 0x24 )
|
||||
+ return 0;
|
||||
+ else {
|
||||
+ t += head_len + 1;
|
||||
+ if (memcmp(t, "Send|", 5) == 0)
|
||||
+ return (IPP2P_DATA_DC * 100);
|
||||
+ else
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*intensive but slower check for all direct connect packets*/
|
||||
+int
|
||||
+search_all_dc (unsigned char *haystack, int packet_len, int head_len)
|
||||
+{
|
||||
+ unsigned char *t = haystack;
|
||||
+
|
||||
+ if ((*(haystack + head_len) == 0x24) && (*(haystack + packet_len - 1) == 0x7c)) {
|
||||
+ t += head_len + 1;
|
||||
+ if (memcmp(t, "Lock ", 5) == 0) return ((IPP2P_DC * 100) + 1); /*hub: hello*/
|
||||
+ if (memcmp(t, "Key ", 4) == 0) return ((IPP2P_DC * 100) + 2); /*client: hello*/
|
||||
+ if (memcmp(t, "Hello ", 6) == 0) return ((IPP2P_DC * 100) + 3); /*hub:connected*/
|
||||
+ if (memcmp(t, "MyNick ", 7) == 0) return ((IPP2P_DC * 100) + 4); /*client-client: hello*/
|
||||
+ if (memcmp(t, "Search ", 7) == 0) return ((IPP2P_DC * 100) + 5); /*client: search*/
|
||||
+ if (memcmp(t, "Send", 4) == 0) return ((IPP2P_DC * 100) + 6); /*client: start download*/
|
||||
+ return 0;
|
||||
+ } else
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static struct {
|
||||
+ int command;
|
||||
+ __u8 short_hand; /*for fucntions included in short hands*/
|
||||
+ int packet_len;
|
||||
+ int (*function_name) (unsigned char *, int, int);
|
||||
+} matchlist[] = {
|
||||
+ {IPP2P_EDK,SHORT_HAND_IPP2P,40, &search_all_edk},
|
||||
+ {IPP2P_DATA_KAZAA,SHORT_HAND_DATA,200, &search_kazaa},
|
||||
+ {IPP2P_DATA_EDK,SHORT_HAND_DATA,60, &search_edk},
|
||||
+ {IPP2P_DATA_DC,SHORT_HAND_DATA,26, &search_dc},
|
||||
+ {IPP2P_DC,SHORT_HAND_IPP2P,25, search_all_dc},
|
||||
+ {IPP2P_DATA_GNU,SHORT_HAND_DATA,40, &search_gnu},
|
||||
+ {IPP2P_GNU,SHORT_HAND_IPP2P,35, &search_all_gnu},
|
||||
+ {IPP2P_KAZAA,SHORT_HAND_IPP2P,35, &search_all_kazaa},
|
||||
+ {IPP2P_BIT,SHORT_HAND_NONE,40, &search_bittorrent},
|
||||
+ {IPP2P_APPLE,SHORT_HAND_NONE,20, &search_apple},
|
||||
+ {IPP2P_SOUL,SHORT_HAND_NONE,25, &search_soul},
|
||||
+ {IPP2P_WINMX,SHORT_HAND_NONE,20, &search_winmx},
|
||||
+ {IPP2P_ARES,SHORT_HAND_NONE,25, &search_ares},
|
||||
+ {0,0,0,NULL}
|
||||
+};
|
||||
+
|
||||
+
|
||||
+static struct {
|
||||
+ int command;
|
||||
+ __u8 short_hand; /*for fucntions included in short hands*/
|
||||
+ int packet_len;
|
||||
+ int (*function_name) (unsigned char *, int);
|
||||
+} udp_list[] = {
|
||||
+ {IPP2P_KAZAA,SHORT_HAND_IPP2P,14, &udp_search_kazaa},
|
||||
+ {IPP2P_BIT,SHORT_HAND_NONE,23, &udp_search_bit},
|
||||
+ {IPP2P_GNU,SHORT_HAND_IPP2P,11, &udp_search_gnu},
|
||||
+ {IPP2P_EDK,SHORT_HAND_IPP2P,9, &udp_search_edk},
|
||||
+ {0,0,0,NULL}
|
||||
+};
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+match(const struct sk_buff *skb,
|
||||
+ const struct net_device *in,
|
||||
+ const struct net_device *out,
|
||||
+ const void *matchinfo,
|
||||
+ int offset,
|
||||
+
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
|
||||
+ const void *hdr,
|
||||
+ u_int16_t datalen,
|
||||
+#endif
|
||||
+
|
||||
+ int *hotdrop)
|
||||
+{
|
||||
+ const struct ipt_p2p_info *info = matchinfo;
|
||||
+ unsigned char *haystack;
|
||||
+ struct iphdr *ip = skb->nh.iph;
|
||||
+ int p2p_result = 0, i = 0;
|
||||
+ int head_len;
|
||||
+ int hlen = ntohs(ip->tot_len)-(ip->ihl*4); /*hlen = packet-data length*/
|
||||
+
|
||||
+ /*must not be a fragment*/
|
||||
+ if (offset) {
|
||||
+ if (info->debug) printk("IPP2P.match: offset found %i \n",offset);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /*make sure that skb is linear*/
|
||||
+ if(skb_is_nonlinear(skb)){
|
||||
+ if (info->debug) printk("IPP2P.match: nonlinear skb found\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ haystack=(char *)ip+(ip->ihl*4); /*haystack = packet data*/
|
||||
+
|
||||
+ switch (ip->protocol){
|
||||
+ case IPPROTO_TCP: /*what to do with a TCP packet*/
|
||||
+ {
|
||||
+ struct tcphdr *tcph = (void *) ip + ip->ihl * 4;
|
||||
+
|
||||
+ if (tcph->fin) return 0; /*if FIN bit is set bail out*/
|
||||
+ if (tcph->syn) return 0; /*if SYN bit is set bail out*/
|
||||
+ if (tcph->rst) return 0; /*if RST bit is set bail out*/
|
||||
+ head_len = tcph->doff * 4; /*get TCP-Header-Size*/
|
||||
+ while (matchlist[i].command) {
|
||||
+ if ((((info->cmd & matchlist[i].command) == matchlist[i].command) ||
|
||||
+ ((info->cmd & matchlist[i].short_hand) == matchlist[i].short_hand)) &&
|
||||
+ (hlen > matchlist[i].packet_len)) {
|
||||
+ p2p_result = matchlist[i].function_name(haystack, hlen, head_len);
|
||||
+ if (p2p_result)
|
||||
+ {
|
||||
+ if (info->debug) printk("IPP2P.debug:TCP-match: %i from: %u.%u.%u.%u:%i to: %u.%u.%u.%u:%i Length: %i\n",
|
||||
+ p2p_result, NIPQUAD(ip->saddr),ntohs(tcph->source), NIPQUAD(ip->daddr),ntohs(tcph->dest),hlen);
|
||||
+ return p2p_result;
|
||||
+ }
|
||||
+ }
|
||||
+ i++;
|
||||
+ }
|
||||
+ return p2p_result;
|
||||
+ }
|
||||
+
|
||||
+ case IPPROTO_UDP: /*what to do with an UDP packet*/
|
||||
+ {
|
||||
+ struct udphdr *udph = (void *) ip + ip->ihl * 4;
|
||||
+
|
||||
+ while (udp_list[i].command){
|
||||
+ if ((((info->cmd & udp_list[i].command) == udp_list[i].command) ||
|
||||
+ ((info->cmd & udp_list[i].short_hand) == udp_list[i].short_hand)) &&
|
||||
+ (hlen > udp_list[i].packet_len)) {
|
||||
+ p2p_result = udp_list[i].function_name(haystack, hlen);
|
||||
+ if (p2p_result){
|
||||
+ if (info->debug) printk("IPP2P.debug:UDP-match: %i from: %u.%u.%u.%u:%i to: %u.%u.%u.%u:%i Length: %i\n",
|
||||
+ p2p_result, NIPQUAD(ip->saddr),ntohs(udph->source), NIPQUAD(ip->daddr),ntohs(udph->dest),hlen);
|
||||
+ return p2p_result;
|
||||
+ }
|
||||
+ }
|
||||
+ i++;
|
||||
+ }
|
||||
+ return p2p_result;
|
||||
+ }
|
||||
+
|
||||
+ default: return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+checkentry(const char *tablename,
|
||||
+ const struct ipt_ip *ip,
|
||||
+ void *matchinfo,
|
||||
+ unsigned int matchsize,
|
||||
+ unsigned int hook_mask)
|
||||
+{
|
||||
+ /* Must specify -p tcp */
|
||||
+/* if (ip->proto != IPPROTO_TCP || (ip->invflags & IPT_INV_PROTO)) {
|
||||
+ * printk("ipp2p: Only works on TCP packets, use -p tcp\n");
|
||||
+ * return 0;
|
||||
+ * }*/
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+static struct ipt_match ipp2p_match = {
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
|
||||
+ { NULL, NULL },
|
||||
+ "ipp2p",
|
||||
+ &match,
|
||||
+ &checkentry,
|
||||
+ NULL,
|
||||
+ THIS_MODULE
|
||||
+#endif
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
|
||||
+ .name = "ipp2p",
|
||||
+ .match = &match,
|
||||
+ .checkentry = &checkentry,
|
||||
+ .me = THIS_MODULE,
|
||||
+#endif
|
||||
+};
|
||||
+
|
||||
+
|
||||
+static int __init init(void)
|
||||
+{
|
||||
+ printk(KERN_INFO "IPP2P v%s loading\n", IPP2P_VERSION);
|
||||
+ return ipt_register_match(&ipp2p_match);
|
||||
+}
|
||||
+
|
||||
+static void __exit fini(void)
|
||||
+{
|
||||
+ ipt_unregister_match(&ipp2p_match);
|
||||
+ printk(KERN_INFO "IPP2P v%s unloaded\n", IPP2P_VERSION);
|
||||
+}
|
||||
+
|
||||
+module_init(init);
|
||||
+module_exit(fini);
|
||||
+
|
||||
+
|
||||
diff -urN linux-2.4.29.old/net/ipv4/netfilter/Makefile linux-2.4.29/net/ipv4/netfilter/Makefile
|
||||
--- linux-2.4.29.old/net/ipv4/netfilter/Makefile 2005-03-12 00:40:38.000000000 +0100
|
||||
+++ linux-2.4.29/net/ipv4/netfilter/Makefile 2005-03-12 00:42:57.000000000 +0100
|
||||
@@ -67,6 +67,7 @@
|
||||
obj-$(CONFIG_IP_NF_MATCH_LIMIT) += ipt_limit.o
|
||||
obj-$(CONFIG_IP_NF_MATCH_MARK) += ipt_mark.o
|
||||
obj-$(CONFIG_IP_NF_MATCH_MAC) += ipt_mac.o
|
||||
+obj-$(CONFIG_IP_NF_MATCH_IPP2P) += ipt_ipp2p.o
|
||||
|
||||
obj-$(CONFIG_IP_NF_MATCH_PKTTYPE) += ipt_pkttype.o
|
||||
obj-$(CONFIG_IP_NF_MATCH_MULTIPORT) += ipt_multiport.o
|
Binary file not shown.
22022
openwrt/package/linux/kernel-patches/305-cifs-1.20c
Normal file
22022
openwrt/package/linux/kernel-patches/305-cifs-1.20c
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
887
openwrt/package/linux/kernel-patches/600-linux-squashfs-lzma
Normal file
887
openwrt/package/linux/kernel-patches/600-linux-squashfs-lzma
Normal file
@ -0,0 +1,887 @@
|
||||
This patch adds LZMA support to the squashfs code, you should also
|
||||
change mksquashfs appropriately.
|
||||
|
||||
Oleg I. Vdovikin <oleg@cs.msu.su>
|
||||
|
||||
--- linuz/fs/squashfs/inode.c 2004-12-15 22:56:47.000000000 +0300
|
||||
+++ linux/fs/squashfs/inode.c 2005-01-20 20:27:27.490010968 +0300
|
||||
@@ -3,6 +3,9 @@
|
||||
*
|
||||
* Copyright (c) 2002, 2003, 2004 Phillip Lougher <plougher@users.sourceforge.net>
|
||||
*
|
||||
+ * LZMA decompressor support added by Oleg I. Vdovikin
|
||||
+ * Copyright (c) 2005 Oleg I.Vdovikin <oleg@cs.msu.su>
|
||||
+ *
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2,
|
||||
@@ -21,7 +24,11 @@
|
||||
* inode.c
|
||||
*/
|
||||
|
||||
+#define SQUASHFS_LZMA
|
||||
+
|
||||
+#ifndef SQUASHFS_LZMA
|
||||
#define SQUASHFS_1_0_COMPATIBILITY
|
||||
+#endif
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/squashfs_fs.h>
|
||||
@@ -39,6 +46,19 @@
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
+#ifdef SQUASHFS_LZMA
|
||||
+#include "LzmaDecode.h"
|
||||
+
|
||||
+/* default LZMA settings, should be in sync with mksquashfs */
|
||||
+#define LZMA_LC 3
|
||||
+#define LZMA_LP 0
|
||||
+#define LZMA_PB 2
|
||||
+
|
||||
+#define LZMA_WORKSPACE_SIZE ((LZMA_BASE_SIZE + \
|
||||
+ (LZMA_LIT_SIZE << (LZMA_LC + LZMA_LP))) * sizeof(CProb))
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
#ifdef SQUASHFS_TRACE
|
||||
#define TRACE(s, args...) printk(KERN_NOTICE "SQUASHFS: "s, ## args)
|
||||
#else
|
||||
@@ -77,7 +97,11 @@
|
||||
|
||||
DECLARE_MUTEX(read_data_mutex);
|
||||
|
||||
+#ifdef SQUASHFS_LZMA
|
||||
+static unsigned char lzma_workspace[LZMA_WORKSPACE_SIZE];
|
||||
+#else
|
||||
static z_stream stream;
|
||||
+#endif
|
||||
|
||||
static DECLARE_FSTYPE_DEV(squashfs_fs_type, "squashfs", squashfs_read_super);
|
||||
|
||||
@@ -232,6 +256,15 @@
|
||||
if(compressed) {
|
||||
int zlib_err;
|
||||
|
||||
+#ifdef SQUASHFS_LZMA
|
||||
+ if ((zlib_err = LzmaDecode(lzma_workspace,
|
||||
+ LZMA_WORKSPACE_SIZE, LZMA_LC, LZMA_LP, LZMA_PB,
|
||||
+ c_buffer, c_byte, buffer, msBlk->read_size, &bytes)) != LZMA_RESULT_OK)
|
||||
+ {
|
||||
+ ERROR("lzma returned unexpected result 0x%x\n", zlib_err);
|
||||
+ bytes = 0;
|
||||
+ }
|
||||
+#else
|
||||
stream.next_in = c_buffer;
|
||||
stream.avail_in = c_byte;
|
||||
stream.next_out = buffer;
|
||||
@@ -243,6 +276,7 @@
|
||||
bytes = 0;
|
||||
} else
|
||||
bytes = stream.total_out;
|
||||
+#endif
|
||||
up(&read_data_mutex);
|
||||
}
|
||||
|
||||
@@ -1491,17 +1525,21 @@
|
||||
static int __init init_squashfs_fs(void)
|
||||
{
|
||||
|
||||
+#ifndef SQUASHFS_LZMA
|
||||
if(!(stream.workspace = (char *) vmalloc(zlib_inflate_workspacesize()))) {
|
||||
ERROR("Failed to allocate zlib workspace\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
+#endif
|
||||
return register_filesystem(&squashfs_fs_type);
|
||||
}
|
||||
|
||||
|
||||
static void __exit exit_squashfs_fs(void)
|
||||
{
|
||||
+#ifndef SQUASHFS_LZMA
|
||||
vfree(stream.workspace);
|
||||
+#endif
|
||||
unregister_filesystem(&squashfs_fs_type);
|
||||
}
|
||||
|
||||
--- linuz/fs/squashfs/LzmaDecode.c 1970-01-01 03:00:00.000000000 +0300
|
||||
+++ linux/fs/squashfs/LzmaDecode.c 2005-01-20 19:40:35.400513552 +0300
|
||||
@@ -0,0 +1,663 @@
|
||||
+/*
|
||||
+ LzmaDecode.c
|
||||
+ LZMA Decoder
|
||||
+
|
||||
+ LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
|
||||
+ http://www.7-zip.org/
|
||||
+
|
||||
+ LZMA SDK is licensed under two licenses:
|
||||
+ 1) GNU Lesser General Public License (GNU LGPL)
|
||||
+ 2) Common Public License (CPL)
|
||||
+ It means that you can select one of these two licenses and
|
||||
+ follow rules of that license.
|
||||
+
|
||||
+ SPECIAL EXCEPTION:
|
||||
+ Igor Pavlov, as the author of this code, expressly permits you to
|
||||
+ statically or dynamically link your code (or bind by name) to the
|
||||
+ interfaces of this file without subjecting your linked code to the
|
||||
+ terms of the CPL or GNU LGPL. Any modifications or additions
|
||||
+ to this file, however, are subject to the LGPL or CPL terms.
|
||||
+*/
|
||||
+
|
||||
+#include "LzmaDecode.h"
|
||||
+
|
||||
+#ifndef Byte
|
||||
+#define Byte unsigned char
|
||||
+#endif
|
||||
+
|
||||
+#define kNumTopBits 24
|
||||
+#define kTopValue ((UInt32)1 << kNumTopBits)
|
||||
+
|
||||
+#define kNumBitModelTotalBits 11
|
||||
+#define kBitModelTotal (1 << kNumBitModelTotalBits)
|
||||
+#define kNumMoveBits 5
|
||||
+
|
||||
+typedef struct _CRangeDecoder
|
||||
+{
|
||||
+ Byte *Buffer;
|
||||
+ Byte *BufferLim;
|
||||
+ UInt32 Range;
|
||||
+ UInt32 Code;
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ ILzmaInCallback *InCallback;
|
||||
+ int Result;
|
||||
+ #endif
|
||||
+ int ExtraBytes;
|
||||
+} CRangeDecoder;
|
||||
+
|
||||
+Byte RangeDecoderReadByte(CRangeDecoder *rd)
|
||||
+{
|
||||
+ if (rd->Buffer == rd->BufferLim)
|
||||
+ {
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ UInt32 size;
|
||||
+ rd->Result = rd->InCallback->Read(rd->InCallback, &rd->Buffer, &size);
|
||||
+ rd->BufferLim = rd->Buffer + size;
|
||||
+ if (size == 0)
|
||||
+ #endif
|
||||
+ {
|
||||
+ rd->ExtraBytes = 1;
|
||||
+ return 0xFF;
|
||||
+ }
|
||||
+ }
|
||||
+ return (*rd->Buffer++);
|
||||
+}
|
||||
+
|
||||
+/* #define ReadByte (*rd->Buffer++) */
|
||||
+#define ReadByte (RangeDecoderReadByte(rd))
|
||||
+
|
||||
+void RangeDecoderInit(CRangeDecoder *rd,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ ILzmaInCallback *inCallback
|
||||
+ #else
|
||||
+ Byte *stream, UInt32 bufferSize
|
||||
+ #endif
|
||||
+ )
|
||||
+{
|
||||
+ int i;
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ rd->InCallback = inCallback;
|
||||
+ rd->Buffer = rd->BufferLim = 0;
|
||||
+ #else
|
||||
+ rd->Buffer = stream;
|
||||
+ rd->BufferLim = stream + bufferSize;
|
||||
+ #endif
|
||||
+ rd->ExtraBytes = 0;
|
||||
+ rd->Code = 0;
|
||||
+ rd->Range = (0xFFFFFFFF);
|
||||
+ for(i = 0; i < 5; i++)
|
||||
+ rd->Code = (rd->Code << 8) | ReadByte;
|
||||
+}
|
||||
+
|
||||
+#define RC_INIT_VAR UInt32 range = rd->Range; UInt32 code = rd->Code;
|
||||
+#define RC_FLUSH_VAR rd->Range = range; rd->Code = code;
|
||||
+#define RC_NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | ReadByte; }
|
||||
+
|
||||
+UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits)
|
||||
+{
|
||||
+ RC_INIT_VAR
|
||||
+ UInt32 result = 0;
|
||||
+ int i;
|
||||
+ for (i = numTotalBits; i > 0; i--)
|
||||
+ {
|
||||
+ /* UInt32 t; */
|
||||
+ range >>= 1;
|
||||
+
|
||||
+ result <<= 1;
|
||||
+ if (code >= range)
|
||||
+ {
|
||||
+ code -= range;
|
||||
+ result |= 1;
|
||||
+ }
|
||||
+ /*
|
||||
+ t = (code - range) >> 31;
|
||||
+ t &= 1;
|
||||
+ code -= range & (t - 1);
|
||||
+ result = (result + result) | (1 - t);
|
||||
+ */
|
||||
+ RC_NORMALIZE
|
||||
+ }
|
||||
+ RC_FLUSH_VAR
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
+int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd)
|
||||
+{
|
||||
+ UInt32 bound = (rd->Range >> kNumBitModelTotalBits) * *prob;
|
||||
+ if (rd->Code < bound)
|
||||
+ {
|
||||
+ rd->Range = bound;
|
||||
+ *prob += (kBitModelTotal - *prob) >> kNumMoveBits;
|
||||
+ if (rd->Range < kTopValue)
|
||||
+ {
|
||||
+ rd->Code = (rd->Code << 8) | ReadByte;
|
||||
+ rd->Range <<= 8;
|
||||
+ }
|
||||
+ return 0;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ rd->Range -= bound;
|
||||
+ rd->Code -= bound;
|
||||
+ *prob -= (*prob) >> kNumMoveBits;
|
||||
+ if (rd->Range < kTopValue)
|
||||
+ {
|
||||
+ rd->Code = (rd->Code << 8) | ReadByte;
|
||||
+ rd->Range <<= 8;
|
||||
+ }
|
||||
+ return 1;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+#define RC_GET_BIT2(prob, mi, A0, A1) \
|
||||
+ UInt32 bound = (range >> kNumBitModelTotalBits) * *prob; \
|
||||
+ if (code < bound) \
|
||||
+ { A0; range = bound; *prob += (kBitModelTotal - *prob) >> kNumMoveBits; mi <<= 1; } \
|
||||
+ else \
|
||||
+ { A1; range -= bound; code -= bound; *prob -= (*prob) >> kNumMoveBits; mi = (mi + mi) + 1; } \
|
||||
+ RC_NORMALIZE
|
||||
+
|
||||
+#define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;)
|
||||
+
|
||||
+int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
|
||||
+{
|
||||
+ int mi = 1;
|
||||
+ int i;
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_INIT_VAR
|
||||
+ #endif
|
||||
+ for(i = numLevels; i > 0; i--)
|
||||
+ {
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ CProb *prob = probs + mi;
|
||||
+ RC_GET_BIT(prob, mi)
|
||||
+ #else
|
||||
+ mi = (mi + mi) + RangeDecoderBitDecode(probs + mi, rd);
|
||||
+ #endif
|
||||
+ }
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_FLUSH_VAR
|
||||
+ #endif
|
||||
+ return mi - (1 << numLevels);
|
||||
+}
|
||||
+
|
||||
+int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
|
||||
+{
|
||||
+ int mi = 1;
|
||||
+ int i;
|
||||
+ int symbol = 0;
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_INIT_VAR
|
||||
+ #endif
|
||||
+ for(i = 0; i < numLevels; i++)
|
||||
+ {
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ CProb *prob = probs + mi;
|
||||
+ RC_GET_BIT2(prob, mi, ; , symbol |= (1 << i))
|
||||
+ #else
|
||||
+ int bit = RangeDecoderBitDecode(probs + mi, rd);
|
||||
+ mi = mi + mi + bit;
|
||||
+ symbol |= (bit << i);
|
||||
+ #endif
|
||||
+ }
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_FLUSH_VAR
|
||||
+ #endif
|
||||
+ return symbol;
|
||||
+}
|
||||
+
|
||||
+Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd)
|
||||
+{
|
||||
+ int symbol = 1;
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_INIT_VAR
|
||||
+ #endif
|
||||
+ do
|
||||
+ {
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ CProb *prob = probs + symbol;
|
||||
+ RC_GET_BIT(prob, symbol)
|
||||
+ #else
|
||||
+ symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
|
||||
+ #endif
|
||||
+ }
|
||||
+ while (symbol < 0x100);
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_FLUSH_VAR
|
||||
+ #endif
|
||||
+ return symbol;
|
||||
+}
|
||||
+
|
||||
+Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte)
|
||||
+{
|
||||
+ int symbol = 1;
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_INIT_VAR
|
||||
+ #endif
|
||||
+ do
|
||||
+ {
|
||||
+ int bit;
|
||||
+ int matchBit = (matchByte >> 7) & 1;
|
||||
+ matchByte <<= 1;
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ {
|
||||
+ CProb *prob = probs + ((1 + matchBit) << 8) + symbol;
|
||||
+ RC_GET_BIT2(prob, symbol, bit = 0, bit = 1)
|
||||
+ }
|
||||
+ #else
|
||||
+ bit = RangeDecoderBitDecode(probs + ((1 + matchBit) << 8) + symbol, rd);
|
||||
+ symbol = (symbol << 1) | bit;
|
||||
+ #endif
|
||||
+ if (matchBit != bit)
|
||||
+ {
|
||||
+ while (symbol < 0x100)
|
||||
+ {
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ CProb *prob = probs + symbol;
|
||||
+ RC_GET_BIT(prob, symbol)
|
||||
+ #else
|
||||
+ symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
|
||||
+ #endif
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ while (symbol < 0x100);
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_FLUSH_VAR
|
||||
+ #endif
|
||||
+ return symbol;
|
||||
+}
|
||||
+
|
||||
+#define kNumPosBitsMax 4
|
||||
+#define kNumPosStatesMax (1 << kNumPosBitsMax)
|
||||
+
|
||||
+#define kLenNumLowBits 3
|
||||
+#define kLenNumLowSymbols (1 << kLenNumLowBits)
|
||||
+#define kLenNumMidBits 3
|
||||
+#define kLenNumMidSymbols (1 << kLenNumMidBits)
|
||||
+#define kLenNumHighBits 8
|
||||
+#define kLenNumHighSymbols (1 << kLenNumHighBits)
|
||||
+
|
||||
+#define LenChoice 0
|
||||
+#define LenChoice2 (LenChoice + 1)
|
||||
+#define LenLow (LenChoice2 + 1)
|
||||
+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
|
||||
+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
|
||||
+#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
|
||||
+
|
||||
+int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState)
|
||||
+{
|
||||
+ if(RangeDecoderBitDecode(p + LenChoice, rd) == 0)
|
||||
+ return RangeDecoderBitTreeDecode(p + LenLow +
|
||||
+ (posState << kLenNumLowBits), kLenNumLowBits, rd);
|
||||
+ if(RangeDecoderBitDecode(p + LenChoice2, rd) == 0)
|
||||
+ return kLenNumLowSymbols + RangeDecoderBitTreeDecode(p + LenMid +
|
||||
+ (posState << kLenNumMidBits), kLenNumMidBits, rd);
|
||||
+ return kLenNumLowSymbols + kLenNumMidSymbols +
|
||||
+ RangeDecoderBitTreeDecode(p + LenHigh, kLenNumHighBits, rd);
|
||||
+}
|
||||
+
|
||||
+#define kNumStates 12
|
||||
+
|
||||
+#define kStartPosModelIndex 4
|
||||
+#define kEndPosModelIndex 14
|
||||
+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
|
||||
+
|
||||
+#define kNumPosSlotBits 6
|
||||
+#define kNumLenToPosStates 4
|
||||
+
|
||||
+#define kNumAlignBits 4
|
||||
+#define kAlignTableSize (1 << kNumAlignBits)
|
||||
+
|
||||
+#define kMatchMinLen 2
|
||||
+
|
||||
+#define IsMatch 0
|
||||
+#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
|
||||
+#define IsRepG0 (IsRep + kNumStates)
|
||||
+#define IsRepG1 (IsRepG0 + kNumStates)
|
||||
+#define IsRepG2 (IsRepG1 + kNumStates)
|
||||
+#define IsRep0Long (IsRepG2 + kNumStates)
|
||||
+#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
|
||||
+#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
|
||||
+#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
|
||||
+#define LenCoder (Align + kAlignTableSize)
|
||||
+#define RepLenCoder (LenCoder + kNumLenProbs)
|
||||
+#define Literal (RepLenCoder + kNumLenProbs)
|
||||
+
|
||||
+#if Literal != LZMA_BASE_SIZE
|
||||
+StopCompilingDueBUG
|
||||
+#endif
|
||||
+
|
||||
+#ifdef _LZMA_OUT_READ
|
||||
+
|
||||
+typedef struct _LzmaVarState
|
||||
+{
|
||||
+ CRangeDecoder RangeDecoder;
|
||||
+ Byte *Dictionary;
|
||||
+ UInt32 DictionarySize;
|
||||
+ UInt32 DictionaryPos;
|
||||
+ UInt32 GlobalPos;
|
||||
+ UInt32 Reps[4];
|
||||
+ int lc;
|
||||
+ int lp;
|
||||
+ int pb;
|
||||
+ int State;
|
||||
+ int PreviousIsMatch;
|
||||
+ int RemainLen;
|
||||
+} LzmaVarState;
|
||||
+
|
||||
+int LzmaDecoderInit(
|
||||
+ unsigned char *buffer, UInt32 bufferSize,
|
||||
+ int lc, int lp, int pb,
|
||||
+ unsigned char *dictionary, UInt32 dictionarySize,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ ILzmaInCallback *inCallback
|
||||
+ #else
|
||||
+ unsigned char *inStream, UInt32 inSize
|
||||
+ #endif
|
||||
+ )
|
||||
+{
|
||||
+ LzmaVarState *vs = (LzmaVarState *)buffer;
|
||||
+ CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
|
||||
+ UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
|
||||
+ UInt32 i;
|
||||
+ if (bufferSize < numProbs * sizeof(CProb) + sizeof(LzmaVarState))
|
||||
+ return LZMA_RESULT_NOT_ENOUGH_MEM;
|
||||
+ vs->Dictionary = dictionary;
|
||||
+ vs->DictionarySize = dictionarySize;
|
||||
+ vs->DictionaryPos = 0;
|
||||
+ vs->GlobalPos = 0;
|
||||
+ vs->Reps[0] = vs->Reps[1] = vs->Reps[2] = vs->Reps[3] = 1;
|
||||
+ vs->lc = lc;
|
||||
+ vs->lp = lp;
|
||||
+ vs->pb = pb;
|
||||
+ vs->State = 0;
|
||||
+ vs->PreviousIsMatch = 0;
|
||||
+ vs->RemainLen = 0;
|
||||
+ dictionary[dictionarySize - 1] = 0;
|
||||
+ for (i = 0; i < numProbs; i++)
|
||||
+ p[i] = kBitModelTotal >> 1;
|
||||
+ RangeDecoderInit(&vs->RangeDecoder,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ inCallback
|
||||
+ #else
|
||||
+ inStream, inSize
|
||||
+ #endif
|
||||
+ );
|
||||
+ return LZMA_RESULT_OK;
|
||||
+}
|
||||
+
|
||||
+int LzmaDecode(unsigned char *buffer,
|
||||
+ unsigned char *outStream, UInt32 outSize,
|
||||
+ UInt32 *outSizeProcessed)
|
||||
+{
|
||||
+ LzmaVarState *vs = (LzmaVarState *)buffer;
|
||||
+ CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
|
||||
+ CRangeDecoder rd = vs->RangeDecoder;
|
||||
+ int state = vs->State;
|
||||
+ int previousIsMatch = vs->PreviousIsMatch;
|
||||
+ Byte previousByte;
|
||||
+ UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3];
|
||||
+ UInt32 nowPos = 0;
|
||||
+ UInt32 posStateMask = (1 << (vs->pb)) - 1;
|
||||
+ UInt32 literalPosMask = (1 << (vs->lp)) - 1;
|
||||
+ int lc = vs->lc;
|
||||
+ int len = vs->RemainLen;
|
||||
+ UInt32 globalPos = vs->GlobalPos;
|
||||
+
|
||||
+ Byte *dictionary = vs->Dictionary;
|
||||
+ UInt32 dictionarySize = vs->DictionarySize;
|
||||
+ UInt32 dictionaryPos = vs->DictionaryPos;
|
||||
+
|
||||
+ if (len == -1)
|
||||
+ {
|
||||
+ *outSizeProcessed = 0;
|
||||
+ return LZMA_RESULT_OK;
|
||||
+ }
|
||||
+
|
||||
+ while(len > 0 && nowPos < outSize)
|
||||
+ {
|
||||
+ UInt32 pos = dictionaryPos - rep0;
|
||||
+ if (pos >= dictionarySize)
|
||||
+ pos += dictionarySize;
|
||||
+ outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos];
|
||||
+ if (++dictionaryPos == dictionarySize)
|
||||
+ dictionaryPos = 0;
|
||||
+ len--;
|
||||
+ }
|
||||
+ if (dictionaryPos == 0)
|
||||
+ previousByte = dictionary[dictionarySize - 1];
|
||||
+ else
|
||||
+ previousByte = dictionary[dictionaryPos - 1];
|
||||
+#else
|
||||
+
|
||||
+int LzmaDecode(
|
||||
+ Byte *buffer, UInt32 bufferSize,
|
||||
+ int lc, int lp, int pb,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ ILzmaInCallback *inCallback,
|
||||
+ #else
|
||||
+ unsigned char *inStream, UInt32 inSize,
|
||||
+ #endif
|
||||
+ unsigned char *outStream, UInt32 outSize,
|
||||
+ UInt32 *outSizeProcessed)
|
||||
+{
|
||||
+ UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
|
||||
+ CProb *p = (CProb *)buffer;
|
||||
+ CRangeDecoder rd;
|
||||
+ UInt32 i;
|
||||
+ int state = 0;
|
||||
+ int previousIsMatch = 0;
|
||||
+ Byte previousByte = 0;
|
||||
+ UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
|
||||
+ UInt32 nowPos = 0;
|
||||
+ UInt32 posStateMask = (1 << pb) - 1;
|
||||
+ UInt32 literalPosMask = (1 << lp) - 1;
|
||||
+ int len = 0;
|
||||
+ if (bufferSize < numProbs * sizeof(CProb))
|
||||
+ return LZMA_RESULT_NOT_ENOUGH_MEM;
|
||||
+ for (i = 0; i < numProbs; i++)
|
||||
+ p[i] = kBitModelTotal >> 1;
|
||||
+ RangeDecoderInit(&rd,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ inCallback
|
||||
+ #else
|
||||
+ inStream, inSize
|
||||
+ #endif
|
||||
+ );
|
||||
+#endif
|
||||
+
|
||||
+ *outSizeProcessed = 0;
|
||||
+ while(nowPos < outSize)
|
||||
+ {
|
||||
+ int posState = (int)(
|
||||
+ (nowPos
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ + globalPos
|
||||
+ #endif
|
||||
+ )
|
||||
+ & posStateMask);
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ if (rd.Result != LZMA_RESULT_OK)
|
||||
+ return rd.Result;
|
||||
+ #endif
|
||||
+ if (rd.ExtraBytes != 0)
|
||||
+ return LZMA_RESULT_DATA_ERROR;
|
||||
+ if (RangeDecoderBitDecode(p + IsMatch + (state << kNumPosBitsMax) + posState, &rd) == 0)
|
||||
+ {
|
||||
+ CProb *probs = p + Literal + (LZMA_LIT_SIZE *
|
||||
+ (((
|
||||
+ (nowPos
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ + globalPos
|
||||
+ #endif
|
||||
+ )
|
||||
+ & literalPosMask) << lc) + (previousByte >> (8 - lc))));
|
||||
+
|
||||
+ if (state < 4) state = 0;
|
||||
+ else if (state < 10) state -= 3;
|
||||
+ else state -= 6;
|
||||
+ if (previousIsMatch)
|
||||
+ {
|
||||
+ Byte matchByte;
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ UInt32 pos = dictionaryPos - rep0;
|
||||
+ if (pos >= dictionarySize)
|
||||
+ pos += dictionarySize;
|
||||
+ matchByte = dictionary[pos];
|
||||
+ #else
|
||||
+ matchByte = outStream[nowPos - rep0];
|
||||
+ #endif
|
||||
+ previousByte = LzmaLiteralDecodeMatch(probs, &rd, matchByte);
|
||||
+ previousIsMatch = 0;
|
||||
+ }
|
||||
+ else
|
||||
+ previousByte = LzmaLiteralDecode(probs, &rd);
|
||||
+ outStream[nowPos++] = previousByte;
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ dictionary[dictionaryPos] = previousByte;
|
||||
+ if (++dictionaryPos == dictionarySize)
|
||||
+ dictionaryPos = 0;
|
||||
+ #endif
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ previousIsMatch = 1;
|
||||
+ if (RangeDecoderBitDecode(p + IsRep + state, &rd) == 1)
|
||||
+ {
|
||||
+ if (RangeDecoderBitDecode(p + IsRepG0 + state, &rd) == 0)
|
||||
+ {
|
||||
+ if (RangeDecoderBitDecode(p + IsRep0Long + (state << kNumPosBitsMax) + posState, &rd) == 0)
|
||||
+ {
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ UInt32 pos;
|
||||
+ #endif
|
||||
+ if (
|
||||
+ (nowPos
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ + globalPos
|
||||
+ #endif
|
||||
+ )
|
||||
+ == 0)
|
||||
+ return LZMA_RESULT_DATA_ERROR;
|
||||
+ state = state < 7 ? 9 : 11;
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ pos = dictionaryPos - rep0;
|
||||
+ if (pos >= dictionarySize)
|
||||
+ pos += dictionarySize;
|
||||
+ previousByte = dictionary[pos];
|
||||
+ dictionary[dictionaryPos] = previousByte;
|
||||
+ if (++dictionaryPos == dictionarySize)
|
||||
+ dictionaryPos = 0;
|
||||
+ #else
|
||||
+ previousByte = outStream[nowPos - rep0];
|
||||
+ #endif
|
||||
+ outStream[nowPos++] = previousByte;
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ UInt32 distance;
|
||||
+ if(RangeDecoderBitDecode(p + IsRepG1 + state, &rd) == 0)
|
||||
+ distance = rep1;
|
||||
+ else
|
||||
+ {
|
||||
+ if(RangeDecoderBitDecode(p + IsRepG2 + state, &rd) == 0)
|
||||
+ distance = rep2;
|
||||
+ else
|
||||
+ {
|
||||
+ distance = rep3;
|
||||
+ rep3 = rep2;
|
||||
+ }
|
||||
+ rep2 = rep1;
|
||||
+ }
|
||||
+ rep1 = rep0;
|
||||
+ rep0 = distance;
|
||||
+ }
|
||||
+ len = LzmaLenDecode(p + RepLenCoder, &rd, posState);
|
||||
+ state = state < 7 ? 8 : 11;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ int posSlot;
|
||||
+ rep3 = rep2;
|
||||
+ rep2 = rep1;
|
||||
+ rep1 = rep0;
|
||||
+ state = state < 7 ? 7 : 10;
|
||||
+ len = LzmaLenDecode(p + LenCoder, &rd, posState);
|
||||
+ posSlot = RangeDecoderBitTreeDecode(p + PosSlot +
|
||||
+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
|
||||
+ kNumPosSlotBits), kNumPosSlotBits, &rd);
|
||||
+ if (posSlot >= kStartPosModelIndex)
|
||||
+ {
|
||||
+ int numDirectBits = ((posSlot >> 1) - 1);
|
||||
+ rep0 = ((2 | ((UInt32)posSlot & 1)) << numDirectBits);
|
||||
+ if (posSlot < kEndPosModelIndex)
|
||||
+ {
|
||||
+ rep0 += RangeDecoderReverseBitTreeDecode(
|
||||
+ p + SpecPos + rep0 - posSlot - 1, numDirectBits, &rd);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ rep0 += RangeDecoderDecodeDirectBits(&rd,
|
||||
+ numDirectBits - kNumAlignBits) << kNumAlignBits;
|
||||
+ rep0 += RangeDecoderReverseBitTreeDecode(p + Align, kNumAlignBits, &rd);
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ rep0 = posSlot;
|
||||
+ rep0++;
|
||||
+ }
|
||||
+ if (rep0 == (UInt32)(0))
|
||||
+ {
|
||||
+ /* it's for stream version */
|
||||
+ len = -1;
|
||||
+ break;
|
||||
+ }
|
||||
+ if (rep0 > nowPos
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ + globalPos
|
||||
+ #endif
|
||||
+ )
|
||||
+ {
|
||||
+ return LZMA_RESULT_DATA_ERROR;
|
||||
+ }
|
||||
+ len += kMatchMinLen;
|
||||
+ do
|
||||
+ {
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ UInt32 pos = dictionaryPos - rep0;
|
||||
+ if (pos >= dictionarySize)
|
||||
+ pos += dictionarySize;
|
||||
+ previousByte = dictionary[pos];
|
||||
+ dictionary[dictionaryPos] = previousByte;
|
||||
+ if (++dictionaryPos == dictionarySize)
|
||||
+ dictionaryPos = 0;
|
||||
+ #else
|
||||
+ previousByte = outStream[nowPos - rep0];
|
||||
+ #endif
|
||||
+ outStream[nowPos++] = previousByte;
|
||||
+ len--;
|
||||
+ }
|
||||
+ while(len > 0 && nowPos < outSize);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ vs->RangeDecoder = rd;
|
||||
+ vs->DictionaryPos = dictionaryPos;
|
||||
+ vs->GlobalPos = globalPos + nowPos;
|
||||
+ vs->Reps[0] = rep0;
|
||||
+ vs->Reps[1] = rep1;
|
||||
+ vs->Reps[2] = rep2;
|
||||
+ vs->Reps[3] = rep3;
|
||||
+ vs->State = state;
|
||||
+ vs->PreviousIsMatch = previousIsMatch;
|
||||
+ vs->RemainLen = len;
|
||||
+ #endif
|
||||
+
|
||||
+ *outSizeProcessed = nowPos;
|
||||
+ return LZMA_RESULT_OK;
|
||||
+}
|
||||
--- linuz/fs/squashfs/LzmaDecode.h 1970-01-01 03:00:00.000000000 +0300
|
||||
+++ linux/fs/squashfs/LzmaDecode.h 2005-01-20 19:40:36.794301664 +0300
|
||||
@@ -0,0 +1,100 @@
|
||||
+/*
|
||||
+ LzmaDecode.h
|
||||
+ LZMA Decoder interface
|
||||
+
|
||||
+ LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
|
||||
+ http://www.7-zip.org/
|
||||
+
|
||||
+ LZMA SDK is licensed under two licenses:
|
||||
+ 1) GNU Lesser General Public License (GNU LGPL)
|
||||
+ 2) Common Public License (CPL)
|
||||
+ It means that you can select one of these two licenses and
|
||||
+ follow rules of that license.
|
||||
+
|
||||
+ SPECIAL EXCEPTION:
|
||||
+ Igor Pavlov, as the author of this code, expressly permits you to
|
||||
+ statically or dynamically link your code (or bind by name) to the
|
||||
+ interfaces of this file without subjecting your linked code to the
|
||||
+ terms of the CPL or GNU LGPL. Any modifications or additions
|
||||
+ to this file, however, are subject to the LGPL or CPL terms.
|
||||
+*/
|
||||
+
|
||||
+#ifndef __LZMADECODE_H
|
||||
+#define __LZMADECODE_H
|
||||
+
|
||||
+/* #define _LZMA_IN_CB */
|
||||
+/* Use callback for input data */
|
||||
+
|
||||
+/* #define _LZMA_OUT_READ */
|
||||
+/* Use read function for output data */
|
||||
+
|
||||
+/* #define _LZMA_PROB32 */
|
||||
+/* It can increase speed on some 32-bit CPUs,
|
||||
+ but memory usage will be doubled in that case */
|
||||
+
|
||||
+/* #define _LZMA_LOC_OPT */
|
||||
+/* Enable local speed optimizations inside code */
|
||||
+
|
||||
+#ifndef UInt32
|
||||
+#ifdef _LZMA_UINT32_IS_ULONG
|
||||
+#define UInt32 unsigned long
|
||||
+#else
|
||||
+#define UInt32 unsigned int
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
+#ifdef _LZMA_PROB32
|
||||
+#define CProb UInt32
|
||||
+#else
|
||||
+#define CProb unsigned short
|
||||
+#endif
|
||||
+
|
||||
+#define LZMA_RESULT_OK 0
|
||||
+#define LZMA_RESULT_DATA_ERROR 1
|
||||
+#define LZMA_RESULT_NOT_ENOUGH_MEM 2
|
||||
+
|
||||
+#ifdef _LZMA_IN_CB
|
||||
+typedef struct _ILzmaInCallback
|
||||
+{
|
||||
+ int (*Read)(void *object, unsigned char **buffer, UInt32 *bufferSize);
|
||||
+} ILzmaInCallback;
|
||||
+#endif
|
||||
+
|
||||
+#define LZMA_BASE_SIZE 1846
|
||||
+#define LZMA_LIT_SIZE 768
|
||||
+
|
||||
+/*
|
||||
+bufferSize = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)))* sizeof(CProb)
|
||||
+bufferSize += 100 in case of _LZMA_OUT_READ
|
||||
+by default CProb is unsigned short,
|
||||
+but if specify _LZMA_PROB_32, CProb will be UInt32(unsigned int)
|
||||
+*/
|
||||
+
|
||||
+#ifdef _LZMA_OUT_READ
|
||||
+int LzmaDecoderInit(
|
||||
+ unsigned char *buffer, UInt32 bufferSize,
|
||||
+ int lc, int lp, int pb,
|
||||
+ unsigned char *dictionary, UInt32 dictionarySize,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ ILzmaInCallback *inCallback
|
||||
+ #else
|
||||
+ unsigned char *inStream, UInt32 inSize
|
||||
+ #endif
|
||||
+);
|
||||
+#endif
|
||||
+
|
||||
+int LzmaDecode(
|
||||
+ unsigned char *buffer,
|
||||
+ #ifndef _LZMA_OUT_READ
|
||||
+ UInt32 bufferSize,
|
||||
+ int lc, int lp, int pb,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ ILzmaInCallback *inCallback,
|
||||
+ #else
|
||||
+ unsigned char *inStream, UInt32 inSize,
|
||||
+ #endif
|
||||
+ #endif
|
||||
+ unsigned char *outStream, UInt32 outSize,
|
||||
+ UInt32 *outSizeProcessed);
|
||||
+
|
||||
+#endif
|
||||
--- linuz/fs/squashfs/Makefile 2004-12-15 22:56:47.000000000 +0300
|
||||
+++ linux/fs/squashfs/Makefile 2005-01-19 23:04:25.000000000 +0300
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
O_TARGET := squashfs.o
|
||||
|
||||
-obj-y := inode.o
|
||||
+obj-y := inode.o LzmaDecode.o
|
||||
|
||||
obj-m := $(O_TARGET)
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user